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
1 change: 0 additions & 1 deletion docs/generators/kotlin-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|apiSuffix|suffix for api classes| |Api|
|artifactId|Generated artifact id (name of jar).| |kotlin-server|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
Expand Down
1 change: 0 additions & 1 deletion docs/generators/kotlin-spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|annotationLibrary|Select the complementary documentation annotation library.|<dl><dt>**none**</dt><dd>Do not annotate Model and Api with complementary annotations.</dd><dt>**swagger1**</dt><dd>Annotate Model and Api using the Swagger Annotations 1.x library.</dd><dt>**swagger2**</dt><dd>Annotate Model and Api using the Swagger Annotations 2.x library.</dd></dl>|swagger2|
|apiPackage|api package for generated code| |org.openapitools.api|
|apiSuffix|suffix for api classes| |Api|
|appendRequestToHandler|Append ServerHttpRequest to handler method for getting request stuff| |false|
|artifactId|Generated artifact id (name of jar).| |openapi-spring|
|artifactVersion|Generated artifact's package version.| |1.0.0|
Expand Down
1 change: 0 additions & 1 deletion docs/generators/kotlin-vertx.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|apiSuffix|suffix for api classes| |Api|
|artifactId|Generated artifact id (name of jar).| |null|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
Expand Down
1 change: 0 additions & 1 deletion docs/generators/kotlin-wiremock.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|apiSuffix|suffix for api classes| |Api|
|artifactId|Generated artifact id (name of jar).| |null|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
Expand Down
1 change: 0 additions & 1 deletion docs/generators/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
| Option | Description | Values | Default |
| ------ | ----------- | ------ | ------- |
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations). List separated by semicolon(;) or new line (Linux or Windows)| |null|
|apiSuffix|suffix for api classes| |Api|
|artifactId|Generated artifact id (name of jar).| |kotlin-client|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|collectionType|Option. Collection type to use|<dl><dt>**array**</dt><dd>kotlin.Array</dd><dt>**list**</dt><dd>kotlin.collections.List</dd></dl>|list|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co
@Setter protected String artifactVersion = "1.0.0";
@Setter protected String groupId = "org.openapitools";
@Setter protected String packageName = "org.openapitools";
@Setter protected String apiSuffix = "Api";

@Setter protected String sourceFolder = "src/main/kotlin";
@Setter protected String testFolder = "src/test/kotlin";
Expand Down Expand Up @@ -253,7 +252,6 @@ public AbstractKotlinCodegen() {
cliOptions.clear();
addOption(CodegenConstants.SOURCE_FOLDER, CodegenConstants.SOURCE_FOLDER_DESC, sourceFolder);
addOption(CodegenConstants.PACKAGE_NAME, "Generated artifact package name.", packageName);
addOption(CodegenConstants.API_SUFFIX, CodegenConstants.API_SUFFIX_DESC, apiSuffix);
addOption(CodegenConstants.GROUP_ID, "Generated artifact package's organization (i.e. maven groupId).", groupId);
addOption(CodegenConstants.ARTIFACT_ID, "Generated artifact id (name of jar).", artifactId);
addOption(CodegenConstants.ARTIFACT_VERSION, "Generated artifact's package version.", artifactVersion);
Expand Down Expand Up @@ -458,10 +456,6 @@ public void processOpts() {
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
}

if (additionalProperties.containsKey(CodegenConstants.API_SUFFIX)) {
this.setApiSuffix((String) additionalProperties.get(CodegenConstants.API_SUFFIX));
}

if (additionalProperties.containsKey(CodegenConstants.ARTIFACT_ID)) {
this.setArtifactId((String) additionalProperties.get(CodegenConstants.ARTIFACT_ID));
} else {
Expand Down Expand Up @@ -615,7 +609,7 @@ public String toApiName(String name) {
if (name.length() == 0) {
return "DefaultApi";
}
return (this.apiSuffix.isEmpty() ? camelize(name) : camelize(name) + this.apiSuffix);
return this.apiNamePrefix + camelize(name) + this.apiNameSuffix;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,26 @@ public void convertApiNameWithEmptySuffix() {

@Test
public void convertApiNameWithSuffix() {
codegen.setApiSuffix("Test");
codegen.setApiNameSuffix("Test");
assertEquals(codegen.toApiName("Fake"), "FakeTest");
assertEquals(codegen.toApiName(""), "DefaultApi");
}

@Test
public void convertApiNameWithPrefix() {
codegen.setApiNamePrefix("Prefix");
assertEquals(codegen.toApiName("Fake"), "PrefixFakeApi");
assertEquals(codegen.toApiName(""), "DefaultApi");
}

@Test
public void convertApiNameWithPrefixAndSuffix() {
codegen.setApiNamePrefix("Prefix");
codegen.setApiNameSuffix("Suffix");
assertEquals(codegen.toApiName("Fake"), "PrefixFakeSuffix");
assertEquals(codegen.toApiName(""), "DefaultApi");
}

@Test
public void apIFileFolder() {
codegen.setOutputDir("/User/open/api/tools");
Expand Down
Loading