We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The hierarchy in chase of inheritance is not created properly for kotlin language. after I fixed the mustache files the generated code is compiling.
annotations are not allowed nor necessary in the interface:
the interface is called, which is wrong:
5.0.1
BaseFileManagerObject: type: object required: - id - name - self - objectType properties: self: type: string name: type: string parent: type: string id: type: string format: uuid objectType: type: string discriminator: propertyName: objectType mapping: FolderObject: '#/components/schemas/FolderObject' FileObject: '#/components/schemas/FileObject' FolderObject: type: object allOf: - $ref: '#/components/schemas/BaseFileManagerObject' - type: object required: - files - updatedAt properties: files: type: string updatedAt: type: string format: date-time FileObject: allOf: - $ref: '#/components/schemas/BaseFileManagerObject' - type: object required: - contentType - downloadUrl - scanStatus - size - updatedAt type: object properties: contentType: type: string size: type: integer format: int32 downloadUrl: type: string scanStatus: type: string updatedAt: type: string format: date-time
I'm using the gradle plugin. this is the config:
tasks.named<GenerateTask>("openApiGenerate") { setProperty("generatorName", "kotlin-spring") setProperty("inputSpec", "$rootDir/swagger/swagger.yaml") setProperty("outputDir", "$buildDir/generated/kotlin") // setProperty("templateDir", "$rootDir/swagger/template/") setProperty("apiPackage", "io.tenera.filemanager.generated.api") setProperty("modelPackage", "io.tenera.filemanager.generated.model") setProperty("skipValidateSpec", true) setProperty("configOptions", mapOf( Pair("tile", "File Manager Api"), Pair("dateLibrary", "java8"), Pair("useBeanValidation", "true"), Pair("hideGenerationTimestamp", "false"), Pair("swaggerAnnotations", "true"), Pair("useTags", "true"), Pair("delegatePattern", "false"), Pair("interfaceOnly", "false"), Pair("serviceInterface", "true"), Pair("serviceImplementation", "false"), Pair("reactive", "false") )) setProperty("globalProperties", mapOf( Pair("apis", ""), //no value or comma-separated Pair("apiTests", "false"), Pair("models", ""), Pair("modelTests", "false"), Pair("invoker", "false") )) }
just run the generator for kotlin-spring with any spec with inheritance.
the following are my version of the templates:
dataClass.mustache (removed () in {{{parent}}}{{/parent}} )
{{{parent}}}{{/parent}}
/** * {{{description}}} {{#vars}} * @param {{name}} {{{description}}} {{/vars}} */{{#discriminator}} {{>typeInfoAnnotation}}{{/discriminator}} {{#discriminator}}interface {{classname}}{{/discriminator}}{{^discriminator}}{{#hasVars}}data {{/hasVars}}class {{classname}}( {{#requiredVars}} {{>dataClassReqVar}}{{^-last}}, {{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, {{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>dataClassOptVar}}{{^-last}}, {{/-last}}{{/optionalVars}} ) {{/discriminator}}{{#parent}}: {{{parent}}}{{/parent}}{ {{#discriminator}} {{#requiredVars}} {{>interfaceReqVar}} {{/requiredVars}} {{#optionalVars}} {{>interfaceOptVar}} {{/optionalVars}} {{/discriminator}} {{#hasEnums}}{{#vars}}{{#isEnum}} /** * {{{description}}} * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} */ enum class {{nameInCamelCase}}(val value: {{#isContainer}}{{#items}}{{{dataType}}}{{/items}}{{/isContainer}}{{^isContainer}}{{{dataType}}}{{/isContainer}}) { {{#allowableValues}}{{#enumVars}} @JsonProperty({{{value}}}) {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} {{/enumVars}}{{/allowableValues}} } {{/isEnum}}{{/vars}}{{/hasEnums}} }
interfaceReqVar.mustache (added ^discriminator)
{{^discriminator}} {{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} {{/discriminator}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}
interfaceOptVar.mustache
{{^discriminator}} {{#swaggerAnnotations}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}{{#isReadOnly}}readOnly = {{{isReadOnly}}}, {{/isReadOnly}}value = "{{{description}}}"){{/swaggerAnnotations}} {{/discriminator}} {{>modelMutable}} {{{name}}}: {{#isEnum}}{{classname}}.{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}? {{^discriminator}}= {{#defaultvalue}}{{defaultvalue}}{{/defaultvalue}}{{^defaultvalue}}null{{/defaultvalue}}{{/discriminator}}
The text was updated successfully, but these errors were encountered:
+1 it is still present in v5.1.1
Sorry, something went wrong.
I've tried to remove "()" from dataClass.mustache as suggested here - and I confirm this helps and looks similar to the code generated by 4.3.1
Successfully merging a pull request may close this issue.
Bug Report Checklist
Description
The hierarchy in chase of inheritance is not created properly for kotlin language. after I fixed the mustache files the generated code is compiling.
annotations are not allowed nor necessary in the interface:
the interface is called, which is wrong:
openapi-generator version
5.0.1
OpenAPI declaration file content or url
Generation Details
I'm using the gradle plugin. this is the config:
Steps to reproduce
just run the generator for kotlin-spring with any spec with inheritance.
Related issues/PRs
Suggest a fix
the following are my version of the templates:
dataClass.mustache (removed () in
{{{parent}}}{{/parent}}
)interfaceReqVar.mustache (added ^discriminator)
interfaceOptVar.mustache
The text was updated successfully, but these errors were encountered: