-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(editor): retrieve default value from dereferenced spec
closes #212
- Loading branch information
Showing
5 changed files
with
168 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
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
63 changes: 63 additions & 0 deletions
63
packages/editor/tests/fixtures/oas2-default-param-value.result.json
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,63 @@ | ||
{ | ||
"children": [ | ||
{ | ||
"children": [ | ||
{ | ||
"jsonPointer": "/paths/~1pet/post", | ||
"method": "POST", | ||
"parameters": [ | ||
{ | ||
"bodyType": "application/json", | ||
"paramType": "requestBody", | ||
"value": { | ||
"name": "doggie" | ||
}, | ||
"valueJsonPointer": "/paths/~1pet/post/parameters/0/schema/default" | ||
} | ||
], | ||
"path": "/pet" | ||
} | ||
], | ||
"jsonPointer": "/paths/~1pet", | ||
"path": "/pet" | ||
}, | ||
{ | ||
"children": [ | ||
{ | ||
"jsonPointer": "/paths/~1pet~1{petId}/put", | ||
"method": "PUT", | ||
"parameters": [ | ||
{ | ||
"location": "path", | ||
"name": "petId", | ||
"paramType": "location", | ||
"valueJsonPointer": "/paths/~1pet~1{petId}/put/parameters/0/default" | ||
}, | ||
{ | ||
"bodyType": "application/xml", | ||
"paramType": "requestBody", | ||
"value": { | ||
"name": "doggie" | ||
}, | ||
"valueJsonPointer": "/paths/~1pet~1{petId}/put/parameters/1/schema/default" | ||
} | ||
], | ||
"path": "/pet/{petId}" | ||
} | ||
], | ||
"jsonPointer": "/paths/~1pet~1{petId}", | ||
"path": "/pet/{petId}" | ||
} | ||
], | ||
"jsonPointer": "/", | ||
"name": "Swagger Petstore", | ||
"parameters": [ | ||
{ | ||
"name": "host", | ||
"paramType": "variable", | ||
"value": "petstore.swagger.io", | ||
"valueJsonPointer": "/host" | ||
} | ||
], | ||
"path": "/" | ||
} |
52 changes: 52 additions & 0 deletions
52
packages/editor/tests/fixtures/oas2-default-param-value.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,52 @@ | ||
swagger: '2.0' | ||
info: | ||
title: Swagger Petstore | ||
version: 1.0.0 | ||
host: petstore.swagger.io | ||
basePath: /v2 | ||
schemes: | ||
- https | ||
paths: | ||
/pet: | ||
post: | ||
parameters: | ||
- $ref: '#/parameters/ReferencedPostBodyParam' | ||
responses: | ||
200: | ||
description: successful operation | ||
/pet/{petId}: | ||
put: | ||
consumes: | ||
- application/xml | ||
parameters: | ||
- description: Pet id to patch | ||
format: int64 | ||
in: path | ||
name: petId | ||
required: true | ||
type: integer | ||
- $ref: '#/parameters/ReferencedPostBodyParam' | ||
responses: | ||
200: | ||
description: successful operation | ||
parameters: | ||
ReferencedPostBodyParam: | ||
description: A JSON object containing pet information | ||
in: body | ||
name: body | ||
required: true | ||
schema: | ||
$ref: '#/definitions/Pet' | ||
definitions: | ||
Pet: | ||
properties: | ||
name: | ||
example: doggie | ||
type: string | ||
required: | ||
- name | ||
type: object | ||
xml: | ||
name: Pet | ||
default: | ||
name: doggie |
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