OpenAPITools / OpenAPITools/openapi-generator
[BUG] [Java] [Spring] Property "on" regression in 6.x
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
With any generator settings and model (yaml format) contains property "on" (any type) generated model contains property name "true" instead of "on".
Problem caused by wrong DeserializationUtils.CustomResolver.addImplicitResolvers() in swagger-parser-v3.
This implicit converter
addImplicitResolver(Tag.BOOL, BOOL, "yYnNtTfFoO");
converts "on" into "true".
openapi-generator can't change this behavior :(
openapi-generator version
It's a regression introduced with openapi-generator 6.x.
With the 5.x version the generated code behaves as expected.
swagger-parser-v3: 2.0.31
OpenAPI declaration file content or url
openapi: 3.0.3
info:
version: "1.0.0"
title: Test on-property
paths: {}
components:
schemas:
SchemaWithOn:
properties:
on:
type: string
Generation Details
Actual output
@JsonProperty("true")
private String true;
Expected output
@JsonProperty("on")
private String on;
Suggest a fix
New parser version with fixed https://github.com/swagger-api/swagger-parser/issues/1798
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 YAML declaration with the on property and inspect swagger-parser-v3's DeserializationUtils.CustomResolver.addImplicitResolvers() behavior. Check the parser version and the referenced fixed parser issue, then verify generated Java models retain on rather than converting it to true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100