-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(oas3): example id generation (#213)
- Loading branch information
Showing
10 changed files
with
263 additions
and
10 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
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,93 @@ | ||
export default { | ||
id: 'service_abc', | ||
name: 'Users API', | ||
version: '1.0', | ||
servers: [ | ||
{ | ||
id: 'http_server-service_abc-http://localhost:3000', | ||
name: 'Users API', | ||
url: 'http://localhost:3000', | ||
}, | ||
], | ||
operations: [ | ||
{ | ||
extensions: {}, | ||
id: 'http_operation-service_abc-post-/users/{}', | ||
method: 'post', | ||
path: '/users/{userId}', | ||
request: { | ||
body: { | ||
id: 'http_request_body-http_operation-service_abc-post-/users/{}', | ||
contents: [ | ||
{ | ||
encodings: [], | ||
id: 'http_media-http_request_body-http_operation-service_abc-post-/users/{}-application/json', | ||
examples: [ | ||
{ | ||
id: 'example-http_media-http_request_body-http_operation-service_abc-post-/users/{}-application/json-foo', | ||
key: 'foo', | ||
summary: 'A foo example', | ||
value: { | ||
foo: 'bar', | ||
}, | ||
}, | ||
{ | ||
id: 'example-http_media-http_request_body-http_operation-service_abc-post-/users/{}-application/json-bar', | ||
key: 'bar', | ||
summary: 'A bar example', | ||
value: { | ||
bar: 'baz', | ||
}, | ||
}, | ||
{ | ||
$ref: '#/components/examples/0', | ||
key: 'baz', | ||
}, | ||
], | ||
mediaType: 'application/json', | ||
}, | ||
], | ||
}, | ||
cookie: [], | ||
headers: [], | ||
path: [], | ||
query: [], | ||
}, | ||
responses: [], | ||
security: [], | ||
servers: [ | ||
{ | ||
id: 'http_server-service_abc-http://localhost:3000', | ||
name: 'Users API', | ||
url: 'http://localhost:3000', | ||
}, | ||
], | ||
tags: [], | ||
}, | ||
], | ||
components: { | ||
cookie: [], | ||
examples: [ | ||
{ | ||
id: 'example-service_abc-baz', | ||
key: 'baz', | ||
summary: 'A baz example', | ||
value: { | ||
baz: 'qux', | ||
}, | ||
}, | ||
{ | ||
externalValue: 'http://foo.bar/examples/frog-example.json', | ||
id: 'example-service_abc-frog-example', | ||
key: 'frog-example', | ||
}, | ||
], | ||
header: [], | ||
path: [], | ||
query: [], | ||
requestBodies: [], | ||
responses: [], | ||
schemas: [], | ||
securitySchemes: [], | ||
}, | ||
}; |
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,88 @@ | ||
{ | ||
"openapi": "3.1.0", | ||
"x-stoplight": { | ||
"id": "service_abc" | ||
}, | ||
"info": { | ||
"title": "Users API", | ||
"version": "1.0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost:3000" | ||
} | ||
], | ||
"paths": { | ||
"/users/{userId}": { | ||
"post": { | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"examples": { | ||
"foo": { | ||
"summary": "A foo example", | ||
"value": { | ||
"foo": "bar" | ||
} | ||
}, | ||
"bar": { | ||
"summary": "A bar example", | ||
"value": { | ||
"bar": "baz" | ||
} | ||
}, | ||
"baz": { | ||
"$ref": "#/components/examples/baz" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"application/json": { | ||
"examples": { | ||
"cat": { | ||
"summary": "An example of a cat", | ||
"value": { | ||
"name": "Fluffy", | ||
"petType": "Cat", | ||
"color": "White", | ||
"gender": "male", | ||
"breed": "Persian" | ||
} | ||
}, | ||
"dog": { | ||
"summary": "An example of a dog with a cat's name", | ||
"value": { | ||
"name": "Puma", | ||
"petType": "Dog", | ||
"color": "Black", | ||
"gender": "Female", | ||
"breed": "Mixed" | ||
} | ||
}, | ||
"frog": { | ||
"$ref": "#/components/examples/frog-example" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"examples": { | ||
"baz": { | ||
"summary": "A baz example", | ||
"value": { | ||
"baz": "qux" | ||
} | ||
}, | ||
"frog-example": { | ||
"externalValue": "http://foo.bar/examples/frog-example.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,72 @@ | ||
export default [ | ||
{ | ||
id: 'service_abc', | ||
name: 'Users API', | ||
servers: [ | ||
{ | ||
id: 'http_server-service_abc-http://localhost:3000', | ||
name: 'Users API', | ||
url: 'http://localhost:3000', | ||
}, | ||
], | ||
version: '1.0', | ||
}, | ||
{ | ||
id: 'http_operation-service_abc-post-/users/{}', | ||
extensions: {}, | ||
method: 'post', | ||
path: '/users/{userId}', | ||
request: { | ||
body: { | ||
id: 'http_request_body-http_operation-service_abc-post-/users/{}', | ||
contents: [ | ||
{ | ||
id: 'http_media-http_request_body-http_operation-service_abc-post-/users/{}-application/json', | ||
encodings: [], | ||
examples: [ | ||
{ | ||
id: 'example-http_media-http_request_body-http_operation-service_abc-post-/users/{}-application/json-foo', | ||
key: 'foo', | ||
summary: 'A foo example', | ||
value: { | ||
foo: 'bar', | ||
}, | ||
}, | ||
{ | ||
id: 'example-http_media-http_request_body-http_operation-service_abc-post-/users/{}-application/json-bar', | ||
key: 'bar', | ||
summary: 'A bar example', | ||
value: { | ||
bar: 'baz', | ||
}, | ||
}, | ||
{ | ||
id: 'example-service_abc-baz', | ||
key: 'baz', | ||
summary: 'A baz example', | ||
value: { | ||
baz: 'qux', | ||
}, | ||
}, | ||
], | ||
mediaType: 'application/json', | ||
}, | ||
], | ||
}, | ||
cookie: [], | ||
headers: [], | ||
path: [], | ||
query: [], | ||
}, | ||
responses: [], | ||
security: [], | ||
servers: [ | ||
{ | ||
id: 'http_server-service_abc-http://localhost:3000', | ||
name: 'Users API', | ||
url: 'http://localhost:3000', | ||
}, | ||
], | ||
tags: [], | ||
}, | ||
]; |
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