Open
Description
Description
I have a set of custom templates for generating rust code.
It is based of v5.4 rust / request client templates.
Generating code with openapi definition with properties like 'type' works with
the standard v7.0.1 generation, but not with my custom template.
I have a configuration file with all kinds of options set.
Like
# java -jar openapi-generator-cli-5.4.0.jar generate -c d42/OpenAPI_Gen.yml --skip-validate-spec > d42\Generated.out
# --global-propery apiDocs=false,apiTests=true,modelDocs=false,modelTests=true
generatorName: rust
outputDir: d42
library: reqwest
#direct
inputSpec: d42/device42.yaml
#inputSpec: d42\spec2.json
templateDir: ../openapi_templates5/
skipFormModel: false
apiDocs: false
apiTests: true
modelDocs: false
modelTests: true
#reserved-words-mappings: type=r#type
files: # https://openapi-generator.tech/docs/customization/
impl/api_impl.mustache:
templateType: API
folder: src/api_impl
destinationFilename: _impl.rs_
impl/model_impl.mustache:
templateType: Model
folder: src/model_impl
destinationFilename: _impl.rs_
impl/errors_impl.mustache:
templateType: SupportingFiles
folder: src/model_impl
destinationFilename: errors_impl.rs_
impl/api_mod_impl.mustache:
destinationFilename: mod.rs_
templateType: SupportingFiles
folder: src/api_impl
impl/model_mod_impl.mustache:
destinationFilename: mod.rs_
templateType: SupportingFiles
folder: src/model_impl
impl/warp_impl.mustache:
destinationFilename: warp_impl.rs_
templateType: SupportingFiles
folder: src
impl/sensor_impl.mustache:
destinationFilename: sensor_impl.rs_
templateType: SupportingFiles
folder: src
impl/build.mustache:
destinationFilename: build.rs_
templateType: SupportingFiles
impl/main_impl.mustache:
destinationFilename: src/main.rs_
templateType: SupportingFiles
additionalProperties:
vendorExtensions.x-outputDir: d42
httpUserAgent: prtgclib_rust
vendorExtensions.x-gen-exe: prtgc_d42
supportAsync: true
supportMultipleResponses: true
packageName: prtgclib_d42api
packageVersion: 0.2.33
vendorExtensions.x-moahclient: true
Exception in thread "main" java.lang.RuntimeException: Could not generate model 'device'
at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:583)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:960)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:511)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.RuntimeException: reserved word type not allowed
How to I force the generator to use the standard rust reserved word substitution?
openapi-generator version
v 7.0.1
OpenAPI declaration file content or url
https://api.device42.com/device42.yaml
Command line used for generation
java -jar ../openapi-generator-cli-7.0.1.jar generate -c d42/OpenAPI_Gen.yml --skip-validate-spec > d42\Generated.out