From 9c0441a762a078a6f2a505270daeda475a31e958 Mon Sep 17 00:00:00 2001 From: Kanad Gupta Date: Wed, 17 Apr 2024 16:28:59 -0500 Subject: [PATCH] feat: fluff out code-samples even more --- 3.0/json/readme-extensions.json | 69 +++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/3.0/json/readme-extensions.json b/3.0/json/readme-extensions.json index 40133bd..fbe0d8e 100644 --- a/3.0/json/readme-extensions.json +++ b/3.0/json/readme-extensions.json @@ -43,6 +43,32 @@ "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", @@ -62,6 +88,21 @@ } } } + }, + "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": { @@ -76,15 +117,37 @@ { "name": "Another cURL snippet", "language": "curl", - "code": "curl -X POST https://api.example.com/v2/another-alert", - "install": "brew install 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"] + "samples-languages": ["shell", "python", "node"] } }, "get": {