Skip to content
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: more examples for request/response pairs #102

Merged
merged 5 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 90 additions & 3 deletions 3.0/json/readme-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,66 @@
"summary": "Custom code samples with the \"x-readme.code-samples\" extension",
"description": "This is a demonstration of our handling of our `x-readme.code-samples` extension.\n\nhttps://docs.readme.com/docs/openapi-extensions#custom-code-samples",
"tags": ["Custom code samples"],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Tag"
},
"examples": {
"userRegistration": {
"value": {
"id": 1234,
"email": "test@example.com",
"name": "Test user name"
}
},
"userRegistration alt": {
"value": {
"id": 5678,
"email": "test@example.com",
"name": "Test user name"
}
}
}
}
}
},
"responses": {
"200": {
"description": "OK"
"description": "OK",
"content": {
"application/json": {
"examples": {
"TestExample": {
"summary": "An example of a cat",
"value": {
"name": "Fluffy",
"petType": "Cat",
"color": "White",
"gender": "male",
"breed": "Persian"
}
}
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"examples": {
"curlExample": {
"summary": "An example of a cat",
"value": {
"missing": "can't find your stuff dawg"
}
}
}
}
}
}
},
"x-readme": {
Expand All @@ -54,13 +111,43 @@
"name": "Custom cURL snippet",
"language": "curl",
"code": "curl -X POST https://api.example.com/v2/alert",
"install": "brew install curl"
"install": "brew install curl",
"correspondingExample": "TestExample"
},
{
"name": "Another cURL snippet",
"language": "curl",
"code": "http POST https://api.example.com/v2/another-alert",
"install": "brew install httpie",
"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"
},
{
"name": "Yet another custom snippet",
"language": "curl",
"code": "curl -X POST https://api.example.com/v2/alert",
"install": "brew install curl",
"correspondingExample": "TestExample"
},
{
"name": "Yet another custom snippet",
"language": "python",
"code": "import requests\n\nprint(\"do something idk\")",
"install": "pip install requests",
"correspondingExample": "TestExample"
},
{
"name": "Yet another custom snippet",
"language": "node",
"code": "import something from 'requestidk';\n\nconsole.log('do something idk');",
"install": "npm install requestidk",
"correspondingExample": "curlExample"
}
]
],
"samples-languages": ["shell", "python", "node"]
}
},
"get": {
Expand Down
Loading
Loading