OpenAPITools / OpenAPITools/openapi-generator
Spring generator does not pick up examples from the specs
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)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Spring generator does not pick up examples given in the OAS specs. It returns null instead
openapi-generator version
4.0.0
OpenAPI declaration file content or url
https://gist.github.com/RitwikChatterjee/0790b7611fcb1d723e0ebae18903ddbf
Command line used for generation
openapi-generator generate -i user.oas3.yaml -o ./source -g spring
Steps to reproduce
Calling the API results in null string being returned. I noticed in the generated code that it ignored the example mentioned in the specification file
Related issues/PRs
None
Suggest a fix
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 with the OpenAPI declaration in the linked gist and run the reported openapi-generator command with the Spring generator. Compare the generated output with the examples declared in the specification; the work is done when those examples are reflected instead of producing null values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, backend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100