forked from go-swagger/go-swagger
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert json files to yaml and run the same tests against them
- Loading branch information
Showing
70 changed files
with
649 additions
and
16 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 @@ | ||
#!/bin/sh | ||
|
||
json2yaml fixtures/json -s -r | ||
cp -a fixtures/json/* fixtures/yaml | ||
find fixtures/yaml -name '*.json' -exec rm -rf {} \; | ||
find fixtures/json -name '*.yaml' -exec rm -rf {} \; |
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,5 @@ | ||
required: | ||
- id | ||
properties: | ||
id: {type: integer, format: int64} | ||
children: {type: array, items: {$ref: Person}} |
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,5 @@ | ||
definitions: | ||
Cat: {description: 'A representation of a cat', allOf: [{$ref: '#/models/Pet'}, {properties: {huntingSkill: {type: string, description: 'The measured skill for hunting', default: lazy, enum: [clueless, lazy, adventerous, aggressive]}}, required: [huntingSkill]}]} | ||
Dog: {description: 'A representation of a dog', allOf: [{$ref: '#/models/Pet'}, {properties: {packSize: {type: integer, format: int32, description: 'the size of the pack the dog is from', default: 0}}, required: [name, packSize]}]} | ||
Fish: {description: 'A representation of a fish', allOf: [{$ref: '#/models/Pet'}, {properties: {fins: {type: integer, format: int32, description: 'count of fins'}}, required: [fins]}]} | ||
Pet: {discriminator: petType, properties: {name: {type: string}, petType: {type: string}}, required: [name, petType]} |
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,4 @@ | ||
description: 'true' | ||
additionalProperties: | ||
type: string | ||
format: date-time |
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 @@ | ||
definitions: | ||
Pet: {properties: {name: {type: string}}, required: [name]} | ||
Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} |
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,4 @@ | ||
description: 'This is a Map[String, Integer]' | ||
additionalProperties: | ||
type: integer | ||
format: int32 |
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,4 @@ | ||
description: 'true' | ||
additionalProperties: | ||
type: integer | ||
format: int64 |
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,14 @@ | ||
description: 'true' | ||
properties: | ||
booleanValue: {type: boolean} | ||
byteValue: {type: string, format: byte} | ||
dateTimeValue: {type: string, format: date-time} | ||
int32Value: {type: integer, format: int32} | ||
int64Value: {type: integer, format: int64} | ||
stringValue: {type: string} | ||
booleanArrayValue: {type: array, items: {type: boolean}} | ||
byteArrayValue: {type: array, items: {type: string, format: byte}} | ||
dateTimeArrayValue: {type: array, items: {type: string, format: date-time}} | ||
int32ArrayValue: {type: array, items: {type: integer, format: int32}} | ||
int64ArrayValue: {type: array, items: {type: integer, format: int64}} | ||
stringArrayValue: {type: array, items: {type: string}} |
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,5 @@ | ||
required: | ||
- id | ||
properties: | ||
id: {type: integer, format: int64} | ||
childrensAges: {type: array, items: {type: integer, format: int32}} |
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 @@ | ||
description: 'true' | ||
properties: | ||
name: {type: string} |
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 @@ | ||
description: 'this model serves xml and json structures' | ||
xml: | ||
name: XMLModel | ||
properties: | ||
id: {type: integer, format: int64, xml: {attribute: true, namespace: ns1, prefix: urn1}} | ||
items: {type: array, items: {type: string}, xml: {wrapped: true}} |
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,2 @@ | ||
definitions: | ||
Pet: {properties: {name: {type: string}}, required: [name]} |
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 @@ | ||
definitions: | ||
Pet: {properties: {name: {type: string}}, required: [name]} | ||
Dog: {properties: {id: {type: integer, format: int64}, name: {type: string}}, required: [name]} |
3 changes: 3 additions & 0 deletions
3
fixtures/yaml/models/properties/propertyWithBooleanArray.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 @@ | ||
type: array | ||
items: | ||
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,4 @@ | ||
type: array | ||
items: | ||
type: string | ||
format: byte |
3 changes: 3 additions & 0 deletions
3
fixtures/yaml/models/properties/propertyWithComplexArray.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 @@ | ||
type: array | ||
items: | ||
$ref: ComplexType |
4 changes: 4 additions & 0 deletions
4
fixtures/yaml/models/properties/propertyWithDateTimeArray.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,4 @@ | ||
type: array | ||
items: | ||
type: string | ||
format: date-time |
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,4 @@ | ||
type: array | ||
items: | ||
type: integer | ||
format: int32 |
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,4 @@ | ||
type: array | ||
items: | ||
type: integer | ||
format: int64 |
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 @@ | ||
$ref: Foo | ||
description: 'a boolean' | ||
readOnly: true |
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 @@ | ||
type: array | ||
items: | ||
type: string |
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 @@ | ||
type: boolean | ||
description: 'a boolean' | ||
readOnly: true |
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,2 @@ | ||
type: string | ||
format: byte |
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,2 @@ | ||
type: string | ||
format: date-time |
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,2 @@ | ||
type: integer | ||
format: int32 |
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,2 @@ | ||
type: integer | ||
format: int64 |
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 @@ | ||
type: string |
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,23 @@ | ||
swagger: '2.0' | ||
info: | ||
version: 1.0.9-abcd | ||
title: 'Swagger Sample API' | ||
description: 'A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification' | ||
termsOfService: 'http://helloreverb.com/terms/' | ||
contact: {name: 'wordnik api team', url: 'http://developer.wordnik.com'} | ||
license: {name: 'Creative Commons 4.0 International', url: 'http://creativecommons.org/licenses/by/4.0/'} | ||
host: my.api.com | ||
basePath: /v1 | ||
schemes: | ||
- http | ||
- https | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
- application/xml | ||
paths: | ||
'/pets/{petId}': {get: {description: 'Returns a pet based on ID', summary: 'Find pet by ID', operationId: getPetsById, produces: [application/json, text/html], parameters: [{name: petId, in: path, description: 'ID of pet that needs to be fetched', required: true, type: array, items: {type: string}, collectionFormat: csv}], responses: {'200': {description: 'pet response', schema: {$ref: Pet}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}, schemes: [https]}} | ||
definitions: | ||
Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} | ||
ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} |
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,23 @@ | ||
swagger: '2.0' | ||
info: | ||
version: 1.0.9-abcd | ||
title: 'Swagger Sample API' | ||
description: 'A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification' | ||
termsOfService: 'http://helloreverb.com/terms/' | ||
contact: {name: 'wordnik api team', url: 'http://developer.wordnik.com'} | ||
license: {name: 'Creative Commons 4.0 International', url: 'http://creativecommons.org/licenses/by/4.0/'} | ||
host: my.api.com | ||
basePath: /v1 | ||
schemes: | ||
- http | ||
- https | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
- application/xml | ||
paths: | ||
'/pets/{id}': {parameters: [{name: id, in: path, description: 'ID of pet to use', required: true, type: array, items: {type: string}, collectionFormat: csv}], get: {description: 'Returns pets based on ID', summary: 'Find pets by ID', operationId: getPetsById, produces: [application/json, text/html], responses: {'200': {description: 'pet response', schema: {type: array, items: {$ref: Pet}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} | ||
definitions: | ||
Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} | ||
ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} |
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,32 @@ | ||
swagger: '2.0' | ||
info: | ||
version: 1.0.9-abcd | ||
title: 'Swagger Sample API' | ||
description: 'A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification' | ||
termsOfService: 'http://helloreverb.com/terms/' | ||
contact: {name: 'wordnik api team', url: 'http://developer.wordnik.com'} | ||
license: {name: 'Creative Commons 4.0 International', url: 'http://creativecommons.org/licenses/by/4.0/'} | ||
host: my.api.com | ||
basePath: /v1 | ||
schemes: | ||
- http | ||
- https | ||
consumes: | ||
- 'text/plain; charset=utf-8' | ||
- application/json | ||
- application/vnd.github+json | ||
- application/vnd.github.v3+json | ||
- application/vnd.github.v3.raw+json | ||
- application/vnd.github.v3.text+json | ||
- application/vnd.github.v3.html+json | ||
- application/vnd.github.v3.full+json | ||
- application/vnd.github.v3.diff | ||
- application/vnd.github.v3.patch | ||
produces: | ||
- application/json | ||
- application/xml | ||
paths: | ||
'/pets/{id}': {parameters: [{name: id, in: path, description: 'ID of pet to use', required: true, type: array, items: {type: string}, collectionFormat: csv}], get: {description: 'Returns pets based on ID', summary: 'Find pets by ID', operationId: getPetsById, produces: [application/json, text/html], responses: {'200': {description: 'pet response', schema: {type: array, items: {$ref: Pet}}}, default: {description: 'error payload', schema: {$ref: ErrorModel}}}}} | ||
definitions: | ||
Pet: {required: [name], properties: {name: {type: string}, tag: {type: string}}} | ||
ErrorModel: {required: [code, message], properties: {code: {type: integer, format: int32}, message: {type: string}}} |
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,14 @@ | ||
description: 'Returns a pet based on ID' | ||
summary: 'Find pet by ID' | ||
operationId: getPetsById | ||
tags: | ||
- foo | ||
- bar | ||
produces: | ||
- application/json | ||
- text/html | ||
parameters: | ||
- {name: petId, in: path, description: 'ID of pet that needs to be fetched', required: true, type: integer, format: int64} | ||
responses: | ||
'200': {description: 'a pet to be returned', schema: {$ref: Pet}} | ||
default: {description: 'Unexpected error', schema: {$ref: ErrorModel}} |
12 changes: 12 additions & 0 deletions
12
fixtures/yaml/resources/operations/stringPathAndBoolQueryParamResource.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,12 @@ | ||
description: 'Returns a pet based on ID' | ||
summary: 'Find pet by ID' | ||
operationId: getPetsById | ||
produces: | ||
- application/json | ||
- text/html | ||
parameters: | ||
- {name: petId, in: path, description: 'ID of pet that needs to be fetched', required: true, type: integer, format: int64} | ||
- {name: includeDetails, in: query, description: 'include details in response', required: true, type: boolean} | ||
responses: | ||
'200': {description: 'a pet to be returned', schema: {$ref: Pet}} | ||
default: {description: 'Unexpected error', schema: {$ref: ErrorModel}} |
12 changes: 12 additions & 0 deletions
12
fixtures/yaml/resources/operations/stringPathParamResource.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,12 @@ | ||
description: 'Returns a pet based on ID' | ||
summary: 'Find pet by ID' | ||
operationId: getPetsById | ||
produces: | ||
- application/json | ||
- text/html | ||
parameters: | ||
- {name: petId, in: path, description: 'ID of pet that needs to be fetched', required: true, type: integer, format: int64} | ||
responses: | ||
'200': {description: fun, schema: {$ref: Pet}} | ||
'400': {description: 'Invalid ID supplied <= this is purely for documentation', schema: {$ref: ErrorModel}} | ||
default: {description: 'Unexpected error', schema: {$ref: ErrorModel}} |
Oops, something went wrong.