Skip to content
Merged
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-misk.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|actionRequestContentTypePrefix|Request ContentType Prefix for Action| |MediaTypes|
|addModelMoshiJsonAnnotation|Add a Moshi JSON adapter annotation to all model classes| |true|
|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', 'original', and 'bestEffortBacktick' (like 'original' but tries to wrap values in backticks before falling back to sanitizing, e.g. `name,asc` stays `name,asc` rather than becoming nameCommaAsc; useful for sort/order enums)| |original|
Expand Down
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|
|delegatePattern|Whether to generate the server files using the delegate pattern. This option is currently supported only when using ktor library.| |false|
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|
|artifactId|Generated artifact id (name of jar).| |openapi-spring|
|artifactVersion|Generated artifact's package version.| |1.0.0|
|autoXSpringPaginated|Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected.| |false|
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', 'original', and 'bestEffortBacktick' (like 'original' but tries to wrap values in backticks before falling back to sanitizing, e.g. `name,asc` stays `name,asc` rather than becoming nameCommaAsc; useful for sort/order enums)| |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', 'original', and 'bestEffortBacktick' (like 'original' but tries to wrap values in backticks before falling back to sanitizing, e.g. `name,asc` stays `name,asc` rather than becoming nameCommaAsc; useful for sort/order enums)| |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 @@ -41,9 +41,6 @@ public class CodegenConstants {
public static final String API_PACKAGE = "apiPackage";
public static final String API_PACKAGE_DESC = "package for generated api classes";

public static final String API_SUFFIX = "apiSuffix";
public static final String API_SUFFIX_DESC = "suffix for api classes";

public static final String AUTOSET_CONSTANTS = "autosetConstants";

public static final String MODEL_PACKAGE = "modelPackage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,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 @@ -309,7 +308,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 @@ -576,10 +574,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 @@ -761,7 +755,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 @@ -227,7 +227,6 @@ public KtormSchemaCodegen() {
// cliOptions default redefinition need to be updated
updateOption(CodegenConstants.ARTIFACT_ID, artifactId);
updateOption(CodegenConstants.PACKAGE_NAME, packageName);
removeOption(CodegenConstants.API_SUFFIX);
removeOption(CodegenConstants.PARCELIZE_MODELS);
removeOption(CodegenConstants.SERIALIZABLE_MODEL);
removeOption(CodegenConstants.SERIALIZATION_LIBRARY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,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
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ protected void verifyOptions() {
verify(codegen).setEnumPropertyNaming(KotlinMiskServerCodegenOptionsProvider.ENUM_PROPERTY_NAMING_VALUE);
verify(codegen).setSerializableModel(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.SERIALIZABLE_MODEL_VALUE));
verify(codegen).setParcelizeModels(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.PARCELIZE_MODELS_VALUE));
verify(codegen).setApiSuffix(KotlinMiskServerCodegenOptionsProvider.API_SUFFIX_VALUE);
verify(codegen).setAdditionalModelTypeAnnotations(List.of(KotlinMiskServerCodegenOptionsProvider.ADDITIONAL_MODEL_TYPE_ANNOTATIONS_VALUE));
verify(codegen).setUseBeanValidation(Boolean.valueOf(KotlinMiskServerCodegenOptionsProvider.USE_BEAN_VALIDATION));
verify(codegen).setModuleClassName(KotlinMiskServerCodegenOptionsProvider.MODULE_CLASS_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public Map<String, String> createOptions() {
.put(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING_VALUE)
.put(CodegenConstants.SERIALIZABLE_MODEL, SERIALIZABLE_MODEL_VALUE)
.put(CodegenConstants.PARCELIZE_MODELS, PARCELIZE_MODELS_VALUE)
.put(CodegenConstants.API_SUFFIX, API_SUFFIX_VALUE)
.put(AbstractKotlinCodegen.MODEL_MUTABLE, MODEL_MUTABLE_VALUE)
.put(AbstractKotlinCodegen.ADDITIONAL_MODEL_TYPE_ANNOTATIONS,
ADDITIONAL_MODEL_TYPE_ANNOTATIONS_VALUE)
Expand Down
Loading