-
-
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.
Fix 3.1 generation for composed schema's with type object (#18002)
- Loading branch information
Showing
3 changed files
with
113 additions
and
1 deletion.
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
83 changes: 83 additions & 0 deletions
83
modules/openapi-generator/src/test/resources/3_1/composed-schemas-with-and-without-type.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,83 @@ | ||
openapi: 3.1.0 | ||
info: | ||
version: 1.0.0 | ||
title: Example | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://api.example.xyz/v1 | ||
paths: | ||
/pets: | ||
patch: | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
oneOf: | ||
- $ref: '#/components/schemas/Cat' | ||
- $ref: '#/components/schemas/Dog' | ||
- description: Any kind of pet | ||
discriminator: | ||
propertyName: pet_type | ||
responses: | ||
'200': | ||
description: Updated | ||
/pets-filtered: | ||
patch: | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
anyOf: | ||
- $ref: '#/components/schemas/PetByAge' | ||
- $ref: '#/components/schemas/PetByType' | ||
- description: Any kind of filter | ||
responses: | ||
'200': | ||
description: Updated | ||
components: | ||
schemas: | ||
Pet: | ||
type: object | ||
required: | ||
- pet_type | ||
Dog: | ||
allOf: | ||
- description: Dog information | ||
- $ref: '#/components/schemas/Pet' | ||
- type: object | ||
properties: | ||
bark: | ||
type: boolean | ||
breed: | ||
type: string | ||
enum: [Dingo, Husky, Retriever, Shepherd] | ||
Cat: | ||
allOf: | ||
- $ref: '#/components/schemas/Pet' | ||
- type: object | ||
properties: | ||
hunts: | ||
type: boolean | ||
age: | ||
type: integer | ||
PetByAge: | ||
type: object | ||
properties: | ||
age: | ||
type: integer | ||
nickname: | ||
type: string | ||
required: | ||
- age | ||
PetByType: | ||
type: object | ||
properties: | ||
pet_type: | ||
type: string | ||
enum: [Cat, Dog] | ||
hunts: | ||
type: boolean | ||
required: | ||
- pet_type |