Skip to content

Instantly share code, notes, and snippets.

@hotmeteor
Last active November 2, 2020 23:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hotmeteor/ed4b8ec25cee2f0535cd577d82670346 to your computer and use it in GitHub Desktop.
Save hotmeteor/ed4b8ec25cee2f0535cd577d82670346 to your computer and use it in GitHub Desktop.
Spectator example
{
"openapi": "3.0.0",
"info": {
"title": "Users.v1",
"version": "1.0"
},
"servers": [
{
"url": "http://localhost:3000"
}
],
"paths": {
"/users": {
"get": {
"summary": "Get users",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "User ID",
"example": 1
},
"name": {
"type": "string",
"description": "User name",
"example": "Adam Campbell"
},
"email": {
"type": "string",
"description": "User email address",
"format": "email",
"example": "test@test.com"
}
}
}
},
"examples": {
"example-1": {
"value": [
{
"id": 1,
"name": "Adam Campbell",
"email": "test@test.com"
}
]
}
}
}
}
}
},
"operationId": "get-users",
"parameters": [
{
"schema": {
"type": "string",
"enum": [
"name",
"email"
]
},
"in": "query",
"name": "order",
"allowEmptyValue": true
}
]
},
"post": {
"summary": "Create user",
"tags": [],
"responses": {
"201": {
"description": "Created"
}
},
"operationId": "post-users",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "Adam Campbell"
},
"email": {
"type": "string",
"format": "email",
"example": "test@test.com"
}
},
"required": [
"name",
"email"
]
}
}
}
}
}
}
},
"components": {
"schemas": {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment