OpenAPITools / OpenAPITools/openapi-generator
[BUG] [JAVA] serializationLibrary option not working and AbstractOpenApiSchema missing when generating only models
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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?
Expected output:
- OpenAPI Generator should generate a code that can successfully be compiled. i.e. it should generate all classes and interfaces required to successfully build the project, even if generator is generating only model classes.
- OpenAPI Generator should respect the config options mentioned on the website i.e. it should use Jackson as serialiser library if the option is provided.
Actual output:
- The code generated has
AbstractOpenApiSchemaclass missing when generating only models. Code can be found here - The code uses Gson as serialization library inspire of providing
serializationLibrary=jacksonas configOptions. Code can be found here
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am trying to generate only models using openapi-codegen. I am using Java generator using Gradle plugin and generated source has following issues:
- The code generated has
AbstractOpenApiSchemaclass missing when generating only models. Code can be found here - The code uses Gson as serialization library inspire of providing
serializationLibrary=jacksonas configOptions. Code can be found here
openapi-generator version
Gradle plugin -> id("org.openapi.generator") version "7.6.0"
CLI Version -> openapi-generator-cli 7.6.0
OpenAPI declaration file content or url
Steps to reproduce
- Clone https://github.com/usrivastava92/openapi-codegen
- Run
cd java && gradle openApiGeneratecommand inside the repo to replicated the issue
Related issues/PRs
N/A
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
Reproduce the models-only generation from the referenced openapi.json using the Gradle openApiGenerate entry point in java/build.gradle.kts. Inspect the generated AssistantObjectToolsInner.java and build.gradle.kts output, then trace the Java generator's model-only and serializationLibrary handling. Done means the generated models compile with AbstractOpenApiSchema available and serializationLibrary=jackson produces Jackson rather than Gson.
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
- Mostly clear
- Newbie friendliness
- 35/100