Skip to content

Instantly share code, notes, and snippets.

@dimensi
Created March 10, 2018 20:36
Show Gist options
  • Save dimensi/36f72c4e850aa15c360b6cf8a4949d0f to your computer and use it in GitHub Desktop.
Save dimensi/36f72c4e850aa15c360b6cf8a4949d0f to your computer and use it in GitHub Desktop.
херь какая-та
{
"components": {
"callbacks": null,
"examples": null,
"headers": {
"HalJsonContentType": {
"description": "A MIME type of response.",
"example": "A MIME type of response.",
"required": true,
"schema": {
"description": "A MIME type of response.",
"example": "application/hal+json",
"nullable": false,
"type": "string"
}
}
},
"links": null,
"parameters": {
"pollId": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"in": "path",
"name": "pollId",
"required": true,
"schema": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
}
}
},
"requestBodies": {
"CreatePoll": {
"content": {
"application/json": {
"schema": {
"description": "Poll object.",
"nullable": false,
"properties": {
"description": {
"description": "Poll description. Supports line breaks and [CommonMark 0.28](http://spec.commonmark.org/0.28).",
"example": "Why is it better to have round manhole covers than square ones?",
"maxLength": 65535,
"minLength": 1,
"nullable": true,
"type": "string"
},
"options": {
"items": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"title": "Poll option",
"type": "object"
},
"maxItems": 24,
"minItems": 2,
"nullable": false,
"type": "array",
"uniqueItems": true
},
"title": {
"description": "A title of poll.",
"example": "Beat the puzzle",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"required": [
"title",
"options"
],
"title": "Poll",
"type": "object"
}
}
},
"description": "An object that represents a poll.",
"required": true
}
},
"responses": {
"CreatedPoll": {
"content": {
"application/hal+json": {
"schema": {
"description": "Poll object.",
"nullable": false,
"properties": {
"_links": {
"nullable": false,
"properties": {
"self": {
"nullable": false,
"properties": {
"href": {
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"format": "uri",
"nullable": false,
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"createdAt": {
"description": "Date and time when poll was created.",
"example": "1937-01-01T12:00:27.87+00:00",
"format": "date-time",
"maxLength": 28,
"minLength": 28,
"nullable": false,
"type": "string"
},
"description": {
"description": "Poll description. Supports line breaks and [CommonMark 0.28](http://spec.commonmark.org/0.28).",
"example": "Why is it better to have round manhole covers than square ones?",
"maxLength": 65535,
"minLength": 1,
"nullable": true,
"type": "string"
},
"id": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"options": {
"items": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"id": {
"description": "Poll option ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
},
"votes": {
"description": "How much people are voted for this option.",
"example": 33,
"minimum": 0,
"nullable": false,
"type": "integer"
}
},
"title": "Poll option",
"type": "object"
},
"maxItems": 24,
"minItems": 2,
"nullable": false,
"type": "array",
"uniqueItems": true
},
"title": {
"description": "A title of poll.",
"example": "Beat the puzzle",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"title": "Poll",
"type": "object"
}
}
},
"description": "An object of created poll.",
"headers": {
"Location": {
"description": "A link to resource of created poll.",
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"required": true,
"schema": {
"description": "A link to resource of created poll.",
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"format": "uri",
"nullable": false,
"type": "string"
}
}
}
},
"Poll": {
"content": {
"application/hal+json": {
"schema": {
"description": "Poll object.",
"nullable": false,
"properties": {
"_links": {
"nullable": false,
"properties": {
"self": {
"nullable": false,
"properties": {
"href": {
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"format": "uri",
"nullable": false,
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"createdAt": {
"description": "Date and time when poll was created.",
"example": "1937-01-01T12:00:27.87+00:00",
"format": "date-time",
"maxLength": 28,
"minLength": 28,
"nullable": false,
"type": "string"
},
"description": {
"description": "Poll description. Supports line breaks and [CommonMark 0.28](http://spec.commonmark.org/0.28).",
"example": "Why is it better to have round manhole covers than square ones?",
"maxLength": 65535,
"minLength": 1,
"nullable": true,
"type": "string"
},
"id": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"options": {
"items": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"id": {
"description": "Poll option ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
},
"votes": {
"description": "How much people are voted for this option.",
"example": 33,
"minimum": 0,
"nullable": false,
"type": "integer"
}
},
"title": "Poll option",
"type": "object"
},
"maxItems": 24,
"minItems": 2,
"nullable": false,
"type": "array",
"uniqueItems": true
},
"title": {
"description": "A title of poll.",
"example": "Beat the puzzle",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"title": "Poll",
"type": "object"
}
}
},
"description": "An object of poll."
}
},
"schemas": {
"Poll": {
"description": "Poll object.",
"nullable": false,
"properties": {
"_links": {
"nullable": false,
"properties": {
"self": {
"nullable": false,
"properties": {
"href": {
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"format": "uri",
"nullable": false,
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"createdAt": {
"description": "Date and time when poll was created.",
"example": "1937-01-01T12:00:27.87+00:00",
"format": "date-time",
"maxLength": 28,
"minLength": 28,
"nullable": false,
"type": "string"
},
"description": {
"description": "Poll description. Supports line breaks and [CommonMark 0.28](http://spec.commonmark.org/0.28).",
"example": "Why is it better to have round manhole covers than square ones?",
"maxLength": 65535,
"minLength": 1,
"nullable": true,
"type": "string"
},
"id": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"options": {
"items": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"id": {
"description": "Poll option ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
},
"votes": {
"description": "How much people are voted for this option.",
"example": 33,
"minimum": 0,
"nullable": false,
"type": "integer"
}
},
"title": "Poll option",
"type": "object"
},
"maxItems": 24,
"minItems": 2,
"nullable": false,
"type": "array",
"uniqueItems": true
},
"title": {
"description": "A title of poll.",
"example": "Beat the puzzle",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"title": "Poll",
"type": "object"
},
"PollOption": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"id": {
"description": "Poll option ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
},
"votes": {
"description": "How much people are voted for this option.",
"example": 33,
"minimum": 0,
"nullable": false,
"type": "integer"
}
},
"title": "Poll option",
"type": "object"
}
},
"securitySchemes": null
},
"externalDocs": {
"description": "Source code",
"url": "https://github.com/ssimplix/swiftpoll"
},
"info": {
"contact": {
"email": "support@swiftpoll.net",
"name": "Support",
"url": "https://github.com/ssimplix/swiftpoll/issues"
},
"description": "A long API documentation...",
"license": {
"name": "MIT",
"url": "https://github.com/ssimplix/swiftpoll/blob/master/LICENSE"
},
"termsOfService": "https://swiftpoll.net/terms-of-service",
"title": "SwiftPoll API",
"version": "1.0.0"
},
"openapi": "3.0.1",
"paths": {
"/polls": {
"post": {
"description": "",
"operationId": "api_v1_create_poll",
"requestBody": {
"content": {
"application/json": {
"schema": {
"description": "Poll object.",
"nullable": false,
"properties": {
"description": {
"description": "Poll description. Supports line breaks and [CommonMark 0.28](http://spec.commonmark.org/0.28).",
"example": "Why is it better to have round manhole covers than square ones?",
"maxLength": 65535,
"minLength": 1,
"nullable": true,
"type": "string"
},
"options": {
"items": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"title": "Poll option",
"type": "object"
},
"maxItems": 24,
"minItems": 2,
"nullable": false,
"type": "array",
"uniqueItems": true
},
"title": {
"description": "A title of poll.",
"example": "Beat the puzzle",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"required": [
"title",
"options"
],
"title": "Poll",
"type": "object"
}
}
},
"description": "An object that represents a poll.",
"required": true
},
"responses": {
"201": {
"content": {
"application/hal+json": {
"schema": {
"description": "Poll object.",
"nullable": false,
"properties": {
"_links": {
"nullable": false,
"properties": {
"self": {
"nullable": false,
"properties": {
"href": {
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"format": "uri",
"nullable": false,
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"createdAt": {
"description": "Date and time when poll was created.",
"example": "1937-01-01T12:00:27.87+00:00",
"format": "date-time",
"maxLength": 28,
"minLength": 28,
"nullable": false,
"type": "string"
},
"description": {
"description": "Poll description. Supports line breaks and [CommonMark 0.28](http://spec.commonmark.org/0.28).",
"example": "Why is it better to have round manhole covers than square ones?",
"maxLength": 65535,
"minLength": 1,
"nullable": true,
"type": "string"
},
"id": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"options": {
"items": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"id": {
"description": "Poll option ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
},
"votes": {
"description": "How much people are voted for this option.",
"example": 33,
"minimum": 0,
"nullable": false,
"type": "integer"
}
},
"title": "Poll option",
"type": "object"
},
"maxItems": 24,
"minItems": 2,
"nullable": false,
"type": "array",
"uniqueItems": true
},
"title": {
"description": "A title of poll.",
"example": "Beat the puzzle",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"title": "Poll",
"type": "object"
}
}
},
"description": "An object of created poll.",
"headers": {
"Location": {
"description": "A link to resource of created poll.",
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"required": true,
"schema": {
"description": "A link to resource of created poll.",
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"format": "uri",
"nullable": false,
"type": "string"
}
}
}
}
},
"summary": "Create a poll",
"tags": [
"Polls"
]
}
},
"/polls/{pollId}": {
"get": {
"description": "",
"operationId": "api_v1_view_poll",
"responses": {
"200": {
"content": {
"application/hal+json": {
"schema": {
"description": "Poll object.",
"nullable": false,
"properties": {
"_links": {
"nullable": false,
"properties": {
"self": {
"nullable": false,
"properties": {
"href": {
"example": "/v1/polls/b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"format": "uri",
"nullable": false,
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
},
"createdAt": {
"description": "Date and time when poll was created.",
"example": "1937-01-01T12:00:27.87+00:00",
"format": "date-time",
"maxLength": 28,
"minLength": 28,
"nullable": false,
"type": "string"
},
"description": {
"description": "Poll description. Supports line breaks and [CommonMark 0.28](http://spec.commonmark.org/0.28).",
"example": "Why is it better to have round manhole covers than square ones?",
"maxLength": 65535,
"minLength": 1,
"nullable": true,
"type": "string"
},
"id": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"options": {
"items": {
"description": "Poll option object.",
"nullable": false,
"properties": {
"id": {
"description": "Poll option ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
},
"position": {
"description": "Position of a poll option. Options are ordered by their position. Poll options of same poll SHOULD have unique position identifiers. Positioning with gaps (e.g. [1, 2, 5, 6]) is allowed, but there are no guarantees it will work as expected in the future.",
"example": 1,
"maximum": 24,
"minimum": 1,
"nullable": false,
"type": "integer"
},
"title": {
"description": "A title of poll option.",
"example": "It is an elephant!",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
},
"votes": {
"description": "How much people are voted for this option.",
"example": 33,
"minimum": 0,
"nullable": false,
"type": "integer"
}
},
"title": "Poll option",
"type": "object"
},
"maxItems": 24,
"minItems": 2,
"nullable": false,
"type": "array",
"uniqueItems": true
},
"title": {
"description": "A title of poll.",
"example": "Beat the puzzle",
"maxLength": 255,
"minLength": 1,
"nullable": false,
"type": "string"
}
},
"title": "Poll",
"type": "object"
}
}
},
"description": "An object of poll."
}
},
"summary": "View certain poll",
"tags": [
"Polls"
]
},
"parameters": [
{
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"in": "path",
"name": "pollId",
"required": true,
"schema": {
"description": "Poll ID.",
"example": "b6e8e597-10c8-436c-a3dd-9e538613cdb8",
"maxLength": 36,
"minLength": 36,
"nullable": false,
"type": "string"
}
}
]
}
},
"security": {
"$ref": "SecurityRequirement/SecurityRequirement.yaml"
},
"servers": [
{
"description": "Production API",
"url": "https://api.swiftpoll.net/v1"
},
{
"description": "Development API",
"url": "http://localhost:8000/api/v1"
}
],
"tags": [
{
"$ref": "Tag/Poll.yaml"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment