Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions modules/swagger-codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
<properties>
<diffutils-version>1.3.0</diffutils-version>
<swagger-codegen-v2-version>2.4.46</swagger-codegen-v2-version>
<lombok.version>1.18.38</lombok.version>
</properties>
<dependencies>
<dependency>
Expand Down Expand Up @@ -312,5 +313,15 @@
<version>2.27.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>2.9.3</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ public interface CodegenConfig {

void setUnflattenedOpenAPI(OpenAPI unflattenedOpenAPI);

Map<String, String> inlineSchemaNameMapping();

Map<String, String> inlineSchemaOption();

boolean getIgnoreImportMapping();

void setIgnoreImportMapping(boolean ignoreImportMapping);
Expand All @@ -269,4 +273,7 @@ default int getPriority() {
default String getCodeName() {
return getName();
}

Schema unaliasSchema(Schema schema);

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Map;

public enum CodegenType {
CLIENT, SERVER, DOCUMENTATION, CONFIG, OTHER;
CLIENT, SERVER, DOCUMENTATION, CONFIG,SCHEMA, OTHER;

private static Map<String, CodegenType> names = new HashMap<String, CodegenType>();

Expand All @@ -31,6 +31,7 @@ public String toValue() {
names.put("client", CLIENT);
names.put("server", SERVER);
names.put("documentation", DOCUMENTATION);
names.put("schema", SCHEMA);
names.put("config", CONFIG);
names.put("other", OTHER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ public Generator opts(ClientOptInput opts) {
this.openAPI = opts.getOpenAPI();
this.config = opts.getConfig();
this.config.additionalProperties().putAll(opts.getOpts().getProperties());
// resolve inline models
if (true) {
InlineModelResolver inlineModelResolver = new InlineModelResolver();
inlineModelResolver.setInlineSchemaNameMapping(config.inlineSchemaNameMapping());
inlineModelResolver.setInlineSchemaOptions(config.inlineSchemaOption());

inlineModelResolver.flatten(openAPI);
}

// set OpenAPI to make these available to all methods
Map<String, Schema> allDefinitions = openAPI.getComponents().getSchemas();
Set<String> modelKeys = allDefinitions.keySet();

String ignoreFileLocation = this.config.getIgnoreFilePathOverride();
if(ignoreFileLocation != null) {
Expand Down
Loading