diff --git a/dev/.vitepress/config.ts b/dev/.vitepress/config.ts index 8d2bd50f..858dd850 100644 --- a/dev/.vitepress/config.ts +++ b/dev/.vitepress/config.ts @@ -48,6 +48,14 @@ export default defineConfigWithTheme({ text: 'CriptoYA Argentina', link: '/criptoya-argentina', }, + { + text: 'Response Types', + link: '/response-types', + }, + { + text: 'Response Statuses', + link: '/response-statuses', + }, ], }, ], diff --git a/dev/response-statuses/index.md b/dev/response-statuses/index.md new file mode 100644 index 00000000..17ad339c --- /dev/null +++ b/dev/response-statuses/index.md @@ -0,0 +1,14 @@ +--- +aside: false +outline: false +title: vitepress-theme-openapi +--- + + + + diff --git a/dev/response-types/index.md b/dev/response-types/index.md new file mode 100644 index 00000000..920fedec --- /dev/null +++ b/dev/response-types/index.md @@ -0,0 +1,14 @@ +--- +aside: false +outline: false +title: vitepress-theme-openapi +--- + + + + diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 506101f6..ccc2a50e 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -80,6 +80,14 @@ export default defineConfigWithTheme({ text: 'One Page', link: '/example/one-page', }, + { + text: 'Multiple Response Types', + link: '/example/response-types', + }, + { + text: 'Response Statuses', + link: '/example/response-statuses', + }, ], }, ], diff --git a/docs/example/response-statuses/index.md b/docs/example/response-statuses/index.md new file mode 100644 index 00000000..1e2a50f4 --- /dev/null +++ b/docs/example/response-statuses/index.md @@ -0,0 +1,14 @@ +--- +aside: false +outline: false +title: vitepress-theme-openapi +--- + + + + diff --git a/docs/example/response-types/index.md b/docs/example/response-types/index.md new file mode 100644 index 00000000..a4ee0121 --- /dev/null +++ b/docs/example/response-types/index.md @@ -0,0 +1,14 @@ +--- +aside: false +outline: false +title: vitepress-theme-openapi +--- + + + + diff --git a/docs/public/openapi-response-statuses.json b/docs/public/openapi-response-statuses.json new file mode 100644 index 00000000..e94938fd --- /dev/null +++ b/docs/public/openapi-response-statuses.json @@ -0,0 +1,193 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Response statuses", + "description": "Example of an OpenAPI document with response statuses.", + "version": "1.0.0", + "license": { + "name": "MIT" + } + }, + "servers": [ + { + "url": "https://httpstat.us/" + } + ], + "paths": { + "200": { + "get": { + "operationId": "get200", + "summary": "Get 200", + "description": "Example of a response with a 200 status code.", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "200 OK" + } + } + } + } + } + } + } + } + }, + "201": { + "get": { + "operationId": "get201", + "summary": "Get 201", + "description": "Example of a response with a 201 status code.", + "responses": { + "201": { + "description": "Created", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "201 Created" + } + } + } + } + } + } + } + } + }, + "400": { + "get": { + "operationId": "get400", + "summary": "Get 400", + "description": "Example of a response with a 400 status code.", + "responses": { + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "400 Bad Request" + } + } + } + } + } + } + } + } + }, + "401": { + "get": { + "operationId": "get401", + "summary": "Get 401", + "description": "Example of a response with a 401 status code.", + "responses": { + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "401 Unauthorized" + } + } + } + } + } + } + } + } + }, + "403": { + "get": { + "operationId": "get403", + "summary": "Get 403", + "description": "Example of a response with a 403 status code.", + "responses": { + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "403 Forbidden" + } + } + } + } + } + } + } + } + }, + "404": { + "get": { + "operationId": "get404", + "summary": "Get 404", + "description": "Example of a response with a 404 status code.", + "responses": { + "404": { + "description": "Not Found", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "404 Not Found" + } + } + } + } + } + } + } + } + }, + "500": { + "get": { + "operationId": "get500", + "summary": "Get 500", + "description": "Example of a response with a 500 status code.", + "responses": { + "500": { + "description": "Internal Server Error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { + "type": "string", + "example": "500 Internal Server Error" + } + } + } + } + } + } + } + } + } + } +} diff --git a/docs/public/openapi-response-types.json b/docs/public/openapi-response-types.json new file mode 100644 index 00000000..42161ec0 --- /dev/null +++ b/docs/public/openapi-response-types.json @@ -0,0 +1,65 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Multiple response types", + "description": "Example of an OpenAPI document with multiple response types.", + "version": "1.0.0", + "license": { + "name": "MIT" + }, + "contact": { + "name": "OpenAI", + "url": "https://openai.com" + }, + "termsOfService": "https://openai.com/terms" + }, + "servers": [ + { + "url": "https://cdn.openai.com/API" + } + ], + "paths": { + "/docs/audio/alloy.wav": { + "get": { + "operationId": "getAudio", + "summary": "Get audio", + "description": "Example of a response with an audio file.", + "responses": { + "200": { + "description": "Successful response", + "content": { + "audio/wav": { + "schema": { + "type": "string", + "format": "binary", + "description": "An example of the `alloy` voice." + } + } + } + } + } + } + }, + "/images/guides/simple-cat-image-dall-e-3.webp": { + "get": { + "operationId": "getImage", + "summary": "Get image", + "description": "Example of a response with an image file.", + "responses": { + "200": { + "description": "Successful response", + "content": { + "image/webp": { + "schema": { + "type": "string", + "format": "binary", + "description": "An image generated by DALL-E 3." + } + } + } + } + } + } + } + } +} diff --git a/package.json b/package.json index 38b7e611..526570da 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vitepress-theme-openapi", "type": "module", - "version": "0.0.3-alpha.31", + "version": "0.0.3-alpha.32", "packageManager": "pnpm@9.1.1", "homepage": "https://vitepress-theme-openapi.vercel.app/", "repository": { diff --git a/src/components/Common/OACodeBlock.vue b/src/components/Common/OACodeBlock.vue index 51f1d36f..7f5cabfb 100644 --- a/src/components/Common/OACodeBlock.vue +++ b/src/components/Common/OACodeBlock.vue @@ -1,5 +1,5 @@ + + diff --git a/src/components/Schema/OASchemaPropertyAttributes.vue b/src/components/Schema/OASchemaPropertyAttributes.vue index 6e2c9e02..cb703e62 100644 --- a/src/components/Schema/OASchemaPropertyAttributes.vue +++ b/src/components/Schema/OASchemaPropertyAttributes.vue @@ -1,5 +1,4 @@ diff --git a/src/components/ui/badge/index.ts b/src/components/ui/badge/index.ts index 8505b4cf..a9d2ccfe 100644 --- a/src/components/ui/badge/index.ts +++ b/src/components/ui/badge/index.ts @@ -13,12 +13,17 @@ export const badgeVariants = cva( 'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80', destructive: 'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80', - outline: 'text-foreground', + outline: 'text-foreground bg-muted', plain: 'border-transparent', }, + size: { + default: '', + xs: 'rounded px-1', + }, }, defaultVariants: { variant: 'default', + size: 'default', }, }, ) diff --git a/src/locales/en.json b/src/locales/en.json index 6766bd3b..b1f114d0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -29,5 +29,8 @@ "Contact": "Contact", "API Documentation": "API Documentation", "External Documentation": "External Documentation", - "Servers": "Servers" + "Servers": "Servers", + "Your browser does not support the audio element.": "Your browser does not support the audio element.", + "Unrecognized response type. Raw content:": "Unrecognized response type. Raw content:", + "Download file": "Download file" } diff --git a/src/locales/es.json b/src/locales/es.json index 2e49e3df..feede6dd 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -29,5 +29,8 @@ "Contact": "Contacto", "API Documentation": "Documentación de la API", "External Documentation": "Documentación externa", - "Servers": "Servidores" + "Servers": "Servidores", + "Your browser does not support the audio element.": "Tu navegador no soporta el elemento de audio.", + "Unrecognized response type. Raw content:": "Tipo de respuesta no reconocido. Contenido en crudo:", + "Download file": "Descargar archivo" }