You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Since upgrading to 7.10.0 from 7.9.0 previously working spec which uses allOf and $ref to extend a schema with another is now missing a property in the generated Java class.
In my application this is breaking request body validation because the request body class is missing a field which should be there, hence a valid request object throws an error:
Unrecognized field "key" (class testsdk_v7100.models.RequestBodyType), not marked as ignorable (one known property: "type"])
After some time tracking it down it seems the presence of a description field on the schema is impacting the generation somehow, and removing the description fixes the issue. I'm unsure of how this ends up impacting the generation, but my expectation would be that a description shouldn't have an impact on the generated code functionality.
openapi-generator version
7.10.0
This is a regression from 7.9.0
OpenAPI declaration file content or url
openapi: 3.0.0info:
title: Testversion: v1paths:
/test:
post:
operationId: testrequestBody:
required: truedescription: Lorem ipsumcontent:
application/json:
schema:
$ref: '#/components/schemas/RequestBody'responses:
201:
description: foocontent:
application/json:
schema:
type: objectproperties:
foo:
type: stringresponses:
201:
description: foocontent:
application/json:
schema:
type: objectproperties:
foo:
type: stringcomponents:
schemas:
RequestBody:
required:
- detailsproperties:
operation:
type: stringdetails:
$ref: '#/components/schemas/Details'Details:
allOf:
- $ref: '#/components/schemas/RequestBodyType'description: Lorem ipsum # !!!! HERE !!!! - removing this description line fixes the issuediscriminator:
propertyName: typemapping:
A: '#/components/schemas/RequestBodyTypeA'B: '#/components/schemas/RequestBodyTypeB'RequestBodyTypeA:
allOf:
- $ref: '#/components/schemas/Details'required:
- keyproperties:
key:
type: string # actually an enum of values that differ to request type B, simplified hereRequestBodyTypeB:
allOf:
- $ref: '#/components/schemas/Details'required:
- keyproperties:
key:
type: string # actually an enum of values that differ to request type A, simplified hereRequestBodyType:
type: objectrequired:
- typeproperties:
type:
type: stringenum:
- A
- B
Here's a skeleton application with a reproduction:
Bug Report Checklist
Description
Since upgrading to 7.10.0 from 7.9.0 previously working spec which uses
allOf
and$ref
to extend a schema with another is now missing a property in the generated Java class.In my application this is breaking request body validation because the request body class is missing a field which should be there, hence a valid request object throws an error:
After some time tracking it down it seems the presence of a
description
field on the schema is impacting the generation somehow, and removing the description fixes the issue. I'm unsure of how this ends up impacting the generation, but my expectation would be that a description shouldn't have an impact on the generated code functionality.openapi-generator version
7.10.0
This is a regression from 7.9.0
OpenAPI declaration file content or url
Here's a skeleton application with a reproduction:
open-api-generator-sandbox.zip
open-api-generator-sandbox
directoryRelated issues/PRs
It could be related to this recent fix: #19986 which relates to #17534, #19900
The text was updated successfully, but these errors were encountered: