-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add example-groups file to preview site #108
Closed
+285
−0
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,151 @@ | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "Example Groups Demo", | ||
"description": "https://docs.readme.com/docs/openapi-extensions", | ||
"version": "1.0.0" | ||
}, | ||
"servers": [{ "url": "https://httpbin.org/anything" }], | ||
"tags": [ | ||
{ | ||
"name": "Example Groups", | ||
"description": "https://docs.readme.com/main/docs/openapi-extensions#corresponding-response-examples" | ||
} | ||
], | ||
"paths": { | ||
"/x-code-samples": { | ||
"post": { | ||
"operationId": "x-readme_code-samples_example-groups", | ||
"summary": "Custom Code Sample with `correspondingExample` ", | ||
"description": "This is a demonstration of our example group pairing with our `x-readme.code-samples` extension via the `correspondingExample` key.\n\nhttps://docs.readme.com/main/docs/openapi-extensions#corresponding-response-examples", | ||
"tags": ["Example Groups"], | ||
"requestBody": { | ||
"required": true, | ||
"content": { | ||
"application/json": { | ||
"schema": { "$ref": "#/components/schemas/Tag" }, | ||
"examples": { | ||
"userRegistration": { | ||
"value": { | ||
"id": 1234, | ||
"email": "[email protected]", | ||
"name": "Test user name" | ||
} | ||
}, | ||
"userRegistration alt": { | ||
"value": { | ||
"id": 5678, | ||
"email": "[email protected]", | ||
"name": "Test user name" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"content": { | ||
"application/json": { | ||
"examples": { | ||
"TestExample1": { | ||
"summary": "An example of a cat", | ||
"value": { | ||
"name": "Fluffy", | ||
"petType": "Cat", | ||
"color": "White", | ||
"gender": "male", | ||
"breed": "Persian" | ||
} | ||
}, | ||
"curlExample": { | ||
"summary": "An example of a dog", | ||
"value": { | ||
"name": "Fluffy", | ||
"petType": "Dog", | ||
"color": "White", | ||
"gender": "male", | ||
"breed": "Husky" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"x-readme": { | ||
"code-samples": [ | ||
{ | ||
"correspondingExample": "TestExample1", | ||
"name": "Custom cURL snippet", | ||
"language": "curl", | ||
"code": "curl -X POST https://api.example.com/v2/alert", | ||
"install": "brew install curl" | ||
}, | ||
{ | ||
"name": "Another cURL snippet", | ||
"language": "curl", | ||
"code": "curl -X POST https://api.example.com/v2/another-alert", | ||
"install": "brew install curl", | ||
"correspondingExample": "curlExample" | ||
}, | ||
{ | ||
"language": "curl", | ||
"code": "# This custom cURL snippet does not have a custom name so it has the name of \"Default #2\".\n\ncurl -X POST https://api.example.com/v2/alert" | ||
} | ||
], | ||
"samples-languages": ["shell"] | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"securitySchemes": { | ||
"petstore_auth": { | ||
"type": "oauth2", | ||
"flows": { | ||
"implicit": { | ||
"authorizationUrl": "http://petstore.swagger.io/oauth/dialog", | ||
"scopes": { | ||
"write:pets": "modify pets in your account", | ||
"read:pets": "read your pets" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"schemas": { | ||
"Tag": { | ||
"type": "object", | ||
"properties": { | ||
"id": { "type": "integer", "format": "int64" }, | ||
"name": { "type": "string" } | ||
} | ||
}, | ||
"Pet": { | ||
"type": "object", | ||
"required": ["name", "photoUrls"], | ||
"properties": { | ||
"id": { "type": "integer", "format": "int64" }, | ||
"name": { "type": "string", "example": "doggie" }, | ||
"photoUrls": { "type": "array", "items": { "type": "string" } }, | ||
"tags": { | ||
"type": "array", | ||
"items": { "$ref": "#/components/schemas/Tag" } | ||
}, | ||
"status": { | ||
"type": "string", | ||
"description": "pet status in the store", | ||
"enum": ["available", "pending", "sold"] | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"x-readme": { | ||
"explorer-enabled": true, | ||
"proxy-enabled": true, | ||
"samples-enabled": 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,134 @@ | ||
openapi: 3.0.3 | ||
info: | ||
title: Example Groups Demo | ||
description: 'https://docs.readme.com/docs/openapi-extensions' | ||
version: 1.0.0 | ||
servers: | ||
- url: 'https://httpbin.org/anything' | ||
tags: | ||
- name: Example Groups | ||
description: >- | ||
https://docs.readme.com/main/docs/openapi-extensions#corresponding-response-examples | ||
paths: | ||
/x-code-samples: | ||
post: | ||
operationId: x-readme_code-samples_example-groups | ||
summary: 'Custom Code Sample with `correspondingExample` ' | ||
description: >- | ||
This is a demonstration of our example group pairing with our | ||
`x-readme.code-samples` extension via the `correspondingExample` key. | ||
|
||
|
||
https://docs.readme.com/main/docs/openapi-extensions#corresponding-response-examples | ||
tags: | ||
- Example Groups | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Tag' | ||
examples: | ||
userRegistration: | ||
value: | ||
id: 1234 | ||
email: [email protected] | ||
name: Test user name | ||
userRegistration alt: | ||
value: | ||
id: 5678 | ||
email: [email protected] | ||
name: Test user name | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
examples: | ||
TestExample1: | ||
summary: An example of a cat | ||
value: | ||
name: Fluffy | ||
petType: Cat | ||
color: White | ||
gender: male | ||
breed: Persian | ||
curlExample: | ||
summary: An example of a dog | ||
value: | ||
name: Fluffy | ||
petType: Dog | ||
color: White | ||
gender: male | ||
breed: Husky | ||
x-readme: | ||
code-samples: | ||
- correspondingExample: TestExample1 | ||
name: Custom cURL snippet | ||
language: curl | ||
code: 'curl -X POST https://api.example.com/v2/alert' | ||
install: brew install curl | ||
- name: Another cURL snippet | ||
language: curl | ||
code: 'curl -X POST https://api.example.com/v2/another-alert' | ||
install: brew install curl | ||
correspondingExample: curlExample | ||
- language: curl | ||
code: >- | ||
# This custom cURL snippet does not have a custom name so it has | ||
the name of "Default #2". | ||
|
||
|
||
curl -X POST https://api.example.com/v2/alert | ||
samples-languages: | ||
- shell | ||
components: | ||
securitySchemes: | ||
petstore_auth: | ||
type: oauth2 | ||
flows: | ||
implicit: | ||
authorizationUrl: 'http://petstore.swagger.io/oauth/dialog' | ||
scopes: | ||
'write:pets': modify pets in your account | ||
'read:pets': read your pets | ||
schemas: | ||
Tag: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
name: | ||
type: string | ||
Pet: | ||
type: object | ||
required: | ||
- name | ||
- photoUrls | ||
properties: | ||
id: | ||
type: integer | ||
format: int64 | ||
name: | ||
type: string | ||
example: doggie | ||
photoUrls: | ||
type: array | ||
items: | ||
type: string | ||
tags: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Tag' | ||
status: | ||
type: string | ||
description: pet status in the store | ||
enum: | ||
- available | ||
- pending | ||
- sold | ||
x-readme: | ||
explorer-enabled: true | ||
proxy-enabled: true | ||
samples-enabled: true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to rename this to
readme-extensions-example-groups
, or something similar, so it's clearer it's for our custom extension?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually going to close this out cause saw Kanad already added it in #102! beat me to it 😅