-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Never create inline model for allOf with single $ref (#18945)
Fixes #15077 The previous fix for this in #16096 is incomplete because it still generates unnecessary inline models when readOnly or nullable is used in conjunction with other properties like description. This commit fixes the logic error and adds testcases.
- Loading branch information
1 parent
da57701
commit 5bc7aa3
Showing
7 changed files
with
169 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
modules/openapi-generator/src/test/resources/3_0/issue_15077.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
openapi: 3.0.0 | ||
info: | ||
version: 1.0.0 | ||
title: Property refs using allOf | ||
paths: | ||
/limits: | ||
get: | ||
operationId: getLimits | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Limits' | ||
components: | ||
schemas: | ||
NumberRange: | ||
type: object | ||
properties: | ||
min: | ||
type: number | ||
max: | ||
type: number | ||
required: | ||
- min | ||
- max | ||
Limits: | ||
type: object | ||
properties: | ||
allOfRef: | ||
allOf: | ||
- $ref: '#/components/schemas/NumberRange' | ||
allOfRefWithDescription: | ||
description: | | ||
Description for this property | ||
allOf: | ||
- $ref: '#/components/schemas/NumberRange' | ||
allOfRefWithReadonly: | ||
readOnly: true | ||
allOf: | ||
- $ref: '#/components/schemas/NumberRange' | ||
allOfRefWithDescriptionAndReadonly: | ||
description: | | ||
Description for this readonly property | ||
readOnly: true | ||
allOf: | ||
- $ref: '#/components/schemas/NumberRange' | ||
required: | ||
- allOfRef | ||
- allOfRefWithDescription | ||
- allOfRefWithReadonly | ||
- allOfRefWithDescriptionAndReadonly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters