[BUG] Schema mappings in configuration file do not work
Created by: ventsyv
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I'm getting an error when I try to generate a model with a schema mappings defined in a config file.
openapi-generator version
6.4.0
OpenAPI declaration file content or url
Generation Details
Generating with --schema-mappings argument on the command line works:
openapi-generator-cli generate -i common_components.yaml -g cpp-pistache-server --schema-mapping Arm=org.openapitools.server.model.Arm
Steps to reproduce
If I try to move the schema mapping to a config file, I get an error:
openapi-generator-cli generate -i common_components.yaml -g cpp-pistache-server --config config.yaml
Config.yaml looks like this:
schemaMappings: "Arm=org.openapitools.server.model.Arm"
Results in the following error:
[main] ERROR o.o.c.config.CodegenConfigurator - Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('Arm=org.openapitools.server.model.Arm')
at [Source: (File); line: 2, column: 1] (through reference chain: org.openapitools.codegen.config.GeneratorSettings["schemaMappings"])
[main] ERROR o.o.c.config.CodegenConfigurator - Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('Arm=org.openapitools.server.model.Arm')
at [Source: (File); line: 2, column: 1] (through reference chain: org.openapitools.codegen.config.GeneratorSettings["schemaMappings"])
Exception in thread "main" java.lang.RuntimeException: Unable to deserialize config file: config.yaml
at org.openapitools.codegen.config.CodegenConfigurator.readDynamicSettings(CodegenConfigurator.java:171)
at org.openapitools.codegen.config.CodegenConfigurator.fromFile(CodegenConfigurator.java:90)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:314)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)