-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: wrong discriminator mapping when bundling with derefernce
- Loading branch information
Showing
8 changed files
with
139 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type: object | ||
properties: | ||
discriminatedProp: | ||
type: string | ||
bar: | ||
type: boolean |
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,6 @@ | ||
type: object | ||
properties: | ||
discriminatedProp: | ||
type: string | ||
foo: | ||
type: string |
19 changes: 19 additions & 0 deletions
19
__tests__/bundle/dereferenced-discriminator-mapping/main.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,19 @@ | ||
openapi: 3.1.0 | ||
info: {} | ||
paths: | ||
/test: | ||
get: | ||
responses: | ||
default: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
discriminator: | ||
propertyName: discriminatedProp | ||
mapping: | ||
Foo: ./foo.yaml | ||
Bar: ./bar.yaml | ||
oneOf: | ||
- $ref: ./foo.yaml | ||
- $ref: ./bar.yaml |
3 changes: 3 additions & 0 deletions
3
__tests__/bundle/dereferenced-discriminator-mapping/redocly.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,3 @@ | ||
apis: | ||
main: | ||
root: ./main.yaml |
87 changes: 87 additions & 0 deletions
87
__tests__/bundle/dereferenced-discriminator-mapping/snapshot.js
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,87 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`E2E bundle dereferenced-discriminator-mapping 1`] = ` | ||
openapi: 3.1.0 | ||
info: {} | ||
paths: | ||
/test: | ||
get: | ||
responses: | ||
default: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
discriminator: | ||
propertyName: discriminatedProp | ||
mapping: | ||
Foo: '#/components/schemas/foo' | ||
Bar: '#/components/schemas/bar' | ||
oneOf: | ||
- $ref: '#/components/schemas/foo' | ||
- $ref: '#/components/schemas/bar' | ||
components: | ||
schemas: | ||
foo: | ||
type: object | ||
properties: | ||
discriminatedProp: | ||
type: string | ||
foo: | ||
type: string | ||
bar: | ||
type: object | ||
properties: | ||
discriminatedProp: | ||
type: string | ||
bar: | ||
type: boolean | ||
bundling ./main.yaml... | ||
📦 Created a bundle for ./main.yaml at stdout <test>ms. | ||
`; | ||
|
||
exports[`E2E bundle with option: dereferenced discriminator mapping should be replaced with correct references to components 1`] = ` | ||
openapi: 3.1.0 | ||
info: {} | ||
paths: | ||
/test: | ||
get: | ||
responses: | ||
default: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
discriminator: | ||
propertyName: discriminatedProp | ||
mapping: | ||
Foo: '#/components/schemas/foo' | ||
Bar: '#/components/schemas/bar' | ||
oneOf: | ||
- type: object | ||
properties: &ref_0 | ||
discriminatedProp: | ||
type: string | ||
foo: | ||
type: string | ||
- type: object | ||
properties: &ref_1 | ||
discriminatedProp: | ||
type: string | ||
bar: | ||
type: boolean | ||
components: | ||
schemas: | ||
foo: | ||
type: object | ||
properties: *ref_0 | ||
bar: | ||
type: object | ||
properties: *ref_1 | ||
bundling main.yaml... | ||
📦 Created a bundle for main.yaml at stdout <test>ms. | ||
`; |
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