OpenAPITools / OpenAPITools/openapi-generator
[BUG] [JAVA] OAS3 incorrect data type when providing a default value
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?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When providing a default value, UI is saying the value is a string when it's an integer. Example JSON shows the variable as the correct data type though.
openapi-generator version
5.3.1
OpenAPI declaration file content or url
- name: page
in: query
description: Zero-based page index of results to return
required: false
schema:
type: integer
format: int32
default: 100
Generation Details
Using OAS3 = true
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/pull/9775
Suggest a fix/enhancement
My guess is that the OAS3 changes for Java just aren't setting the type correctly in the mustache templates.
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 supplied OAS3 YAML with the Java generator and compare the UI's type for the default value with the generated JSON example. Then inspect the Java OAS3 Mustache templates suggested in the report and review related PR 9775; done means the UI identifies the integer default as an integer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100