OpenAPITools / OpenAPITools/openapi-generator
[JAVA] yaml api java code generation fails
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
When trying to generate classes/compile OpenApi spec file with version 5.x (tested 5.0.0, 5.1.1) i got error, however with version
4.3.1 compillation runs fine.
[ERROR] failed to read resource listing
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: (StringReader); line: 1, column: 8]
at com.fasterxml.jackson.core.JsonParser._constructError (JsonParser.java:1840)
openapi-generator version
5.1.1
OpenAPI declaration file content or url
Command line used for generation
it was generated using maven plugin not using cli
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
<generatorName>java</generatorName>
<generateApis>false</generateApis>
<generateSupportingFiles>false</generateSupportingFiles>
<generateModelTests>false</generateModelTests>
<output>${project.build.directory}/generated-sources</output>
<modelPackage>${project.groupId}.arrangement.v2</modelPackage>
<configOptions>
<additionalModelTypeAnnotations>
@lombok.Builder
@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)
</additionalModelTypeAnnotations>
<dateLibrary>java8</dateLibrary>
<library>native</library>
<serializationLibrary>jackson</serializationLibrary>
<useBeanValidation>false</useBeanValidation>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Maven plugin configuration against src/main/resources/openapi.yaml with versions 5.1.1 and 4.3.1, using the Java generator settings shown in the issue. Trace the reported resource-listing parse failure and identify a focused regression test or reproduction; done means the YAML specification generates successfully with the affected 5.x version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100