-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
OpenAPI Generator: 7.0.0 beta, template "spring"
OpenAPI Specification: 3.0.3
Given test file reproduces the issue.
openapi: 3.0.3
info:
title: Test API specification
version: 0.0.1
paths:
/tests/{testId}:
parameters:
- name: testId
in: path
required: true
schema:
type: string
patch:
operationId: modifyTest
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ModifyTestRequest'
responses:
'200':
description: Modifies a test
content:
application/json:
schema:
$ref: '#/components/schemas/ModifyTestResponse'
components:
schemas:
ModifyTestRequest:
type: object
additionalProperties: false
discriminator:
propertyName: objectType
required:
- oneRequired
properties:
oneRequired:
type: string
nullable: false
twoOptional:
type: string
nullable: true
threeOptionalBinaryContent:
type: string
format: byte
nullable: true
ModifyNamedTestRequest:
allOf:
- $ref: '#/components/schemas/ModifyTestRequest'
- type: object
additionalProperties: false
properties:
name:
type: string
nullable: true
ModifyOrderedTestRequest:
allOf:
- $ref: '#/components/schemas/ModifyTestRequest'
- type: object
additionalProperties: false
properties:
ordinal:
type: integer
nullable: true
ModifyTestResponse:
type: object
additionalProperties: false
required:
- oneRequired
properties:
oneRequired:
type: string
nullable: false
twoOptional:
type: string
nullable: true
threeOptionalBinaryContent:
type: string
format: byte
nullable: trueThe parent ModifyTestObject has following setter generated
public void setTwoOptional(JsonNullable<String> twoOptional) {
this.twoOptional = twoOptional;
}but the child object takes List instead and passes it to the super method.
public ModifyNamedTestRequest twoOptional(String twoOptional) {
super.setTwoOptional(twoOptional);
return this;
}Expected solutions
Either ModifyNamedTestRequest::twoOptional should not be generated at all, or twoOptional should take JsonNullable<String> as its parameter.
Related Issues
Originally posted by @jspetrak in #4128 (comment)
#14765 [BUG][Java][Spring] openapiNullable - JsonNullable usage is based on nullable property instead of required property
#14766 is potential fix
Bounty
This is a blocker for OSDM code generation into Java Spring Boot. Bileto is willing to sponsor the resolution of the issue by €500 bounty, other currency equivalent, or extra donation to Open API Collective.