-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
prune oneOf field on circular references
- Loading branch information
Showing
3 changed files
with
147 additions
and
11 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
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,76 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Sample API | ||
version: 1.0.0 | ||
paths: {} | ||
|
||
components: | ||
schemas: | ||
# BaseSchema is the parent of SchemaWithWithoutOneOf | ||
# the flattened version of SchemaWithWithoutOneOf does not contain oneOf field | ||
BaseSchema: | ||
type: object | ||
oneOf: | ||
- $ref: '#/components/schemas/SchemaWithWithoutOneOf' | ||
- type: object | ||
properties: | ||
inlineProperty: | ||
type: string | ||
|
||
SchemaWithWithoutOneOf: | ||
allOf: | ||
- $ref: '#/components/schemas/BaseSchema' | ||
- type: object | ||
properties: | ||
additionalProperty: | ||
type: string | ||
|
||
# FirstSchema is not a parent of ThirdSchema | ||
# the flattened version of ThirdSchema contains oneOf | ||
FirstSchema: | ||
type: object | ||
oneOf: | ||
- $ref: '#/components/schemas/SecondSchema' | ||
- type: object | ||
properties: | ||
prop1: | ||
type: string | ||
|
||
SecondSchema: | ||
type: object | ||
allOf: | ||
- $ref: '#/components/schemas/ThirdSchema' | ||
|
||
ThirdSchema: | ||
type: object | ||
allOf: | ||
- $ref: '#/components/schemas/FirstSchema' | ||
- type: object | ||
properties: | ||
thirdProperty: | ||
type: string | ||
|
||
# Base is a parent of ComplexSchema | ||
# the flattened version of ComplexSchema contains the oneOf of NestedSchema | ||
Base: | ||
type: object | ||
allOf: | ||
- $ref: '#/components/schemas/ComplexSchema' | ||
|
||
ComplexSchema: | ||
type: object | ||
allOf: | ||
- $ref: '#/components/schemas/Base' | ||
- $ref: '#/components/schemas/NestedSchema' | ||
|
||
NestedSchema: | ||
type: object | ||
oneOf: | ||
- type: object | ||
properties: | ||
nestedProperty: | ||
type: string | ||
- type: object | ||
properties: | ||
anotherNestedProperty: | ||
type: number |