OpenAPITools / OpenAPITools/openapi-generator

[BUG] Need to convert exsting POJO to OpenApiformatted POJO

Open
#21,270 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

My use case is to convert existing POJO into openapi format POJO.

Question is POJO to new openapi formatted -POJO conversion supported?

### Executed below command:

openapi-generator-cli generate --import-mappings== -i -g java --language-specific-primitives=

Below exception is encountered:

[main] WARN i.s.v.p.util.DeserializationUtils - Error snake-parsing yaml content
io.swagger.v3.parser.util.DeserializationUtils$SnakeException: Exception safe-checking yaml content (maxDepth 2000, maxYamlAliasesForCollections 2147483647)
at io.swagger.v3.parser.util.DeserializationUtils$CustomSnakeYamlConstructor.getSingleData(DeserializationUtils.java:483)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:507)
at org.yaml.snakeyaml.Yaml.load(Yaml.java:436)
at io.swagger.v3.parser.util.DeserializationUtils.readYamlTree(DeserializationUtils.java:258)
at io.swagger.v3.parser.util.DeserializationUtils.deserializeIntoTree(DeserializationUtils.java:172)
at io.swagger.v3.parser.OpenAPIV3Parser.readContents(OpenAPIV3Parser.java:170)
at io.swagger.v3.parser.OpenAPIV3Parser.readLocation(OpenAPIV3Parser.java:97)
at io.swagger.parser.OpenAPIParser.readLocation(OpenAPIParser.java:16)
at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:686)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:744)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:527)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: org.yaml.snakeyaml.scanner.ScannerException: mapping values are not allowed here

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the reported openapi-generator-cli command and trace the failure through DeserializationUtils, CodegenConfigurator, and Generate as shown in the stack trace. First establish whether the command accepts a Java POJO as input; done means either confirming the supported input format with a clear error or documenting and fixing the parsing behavior for a valid supported input.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.