Skip to content

Instantly share code, notes, and snippets.

@hieunhums
Created March 21, 2020 13:09
Show Gist options
  • Select an option

  • Save hieunhums/e38c910458a6b25a6bdeeb39b52faa94 to your computer and use it in GitHub Desktop.

Select an option

Save hieunhums/e38c910458a6b25a6bdeeb39b52faa94 to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.1",
"info": {
"title": "Todo API",
"version": "v1"
},
"paths": {
"/api/TodoItems": {
"get": {
"tags": [
"TodoItems"
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TodoItem"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TodoItem"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TodoItem"
}
}
}
}
}
}
},
"post": {
"tags": [
"TodoItems"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
}
}
}
}
}
},
"/api/TodoItems/{id}": {
"get": {
"tags": [
"TodoItems"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
}
}
}
}
},
"put": {
"tags": [
"TodoItems"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
}
}
},
"responses": {
"200": {
"description": "Success"
}
}
},
"delete": {
"tags": [
"TodoItems"
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/TodoItem"
}
}
}
}
}
}
},
"/WeatherForecast": {
"get": {
"tags": [
"WeatherForecast"
],
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/WeatherForecast"
}
}
},
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/WeatherForecast"
}
}
},
"text/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/WeatherForecast"
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"TodoItem": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string",
"nullable": true
},
"isComplete": {
"type": "boolean"
}
},
"additionalProperties": false
},
"WeatherForecast": {
"type": "object",
"properties": {
"date": {
"type": "string",
"format": "date-time"
},
"temperatureC": {
"type": "integer",
"format": "int32"
},
"temperatureF": {
"type": "integer",
"format": "int32",
"readOnly": true
},
"summary": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment