nodejs-restful-jsonapi-seed
Version:
Everything you need to start building a scalable web application.
412 lines (411 loc) • 9.31 kB
JSON
{
"swagger": "2.0",
"info": {
"title": "nodejs-restful-jsonapi-seed",
"description": "Everything you need to start building a scalable web application.",
"version": "2.0.1"
},
"host": "localhost:3000",
"basePath": "/",
"consumes": [
"application/vnd.api+json"
],
"produces": [
"application/vnd.api+json"
],
"definitions": {
"ValidationError": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string",
"example": "Invalid parameter"
},
"details": {
"type": "string",
"example": "Allowed values: Numeric characters"
},
"source": {
"type": "object",
"properties": {
"param": {
"type": "string",
"example": "age"
}
}
}
}
}
}
}
},
"UserGetAll": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "string"
},
"gender": {
"type": "string"
}
}
}
}
}
}
}
},
"UserGetOne": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "string"
},
"gender": {
"type": "string"
}
}
}
}
}
}
},
"UserPatch": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "foo bar"
},
"age": {
"type": "number",
"example": 45
},
"gender": {
"type": "string",
"example": "Binary"
}
}
},
"UserPut": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "biz baz"
}
}
},
"UserPost": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "foo bar"
},
"age": {
"type": "number",
"example": 45
},
"gender": {
"type": "string",
"example": "Binary"
}
}
}
},
"paths": {
"/login": {
"post": {
"description": "Create a new session.",
"parameters": [
{
"name": "json",
"in": "body",
"schema": {
"type": "object",
"properties": {
"username": {
"type": "string",
"example": "foo"
},
"password": {
"type": "string",
"example": "bar"
}
}
}
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"session": {
"type": "object",
"properties": {
"role": {
"type": "string"
}
}
}
}
}
}
}
},
"403": {
"description": "Forbidden"
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"tags": [
"Login"
]
}
},
"/user": {
"get": {
"description": "List all users.",
"responses": {
"200": {
"description": "Returns JSON response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/definitions/UserGetAll"
}
}
}
}
},
"security": [
{
"cookieAuth": []
}
],
"tags": [
"User"
]
},
"post": {
"description": "Create new user.",
"parameters": [
{
"name": "json",
"in": "body",
"schema": {
"$ref": "#/definitions/UserPost"
}
}
],
"responses": {
"201": {
"description": "Returns JSON response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/definitions/UserGetOne"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"security": [
{
"cookieAuth": []
}
],
"tags": [
"User"
]
}
},
"/user/00000000-0000-0000-0000-000000000001": {
"get": {
"description": "List one user.",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/definitions/UserGetOne"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"security": [
{
"cookieAuth": []
}
],
"tags": [
"User"
]
},
"put": {
"description": "Update a given user (resource).",
"parameters": [
{
"name": "json",
"in": "body",
"schema": {
"$ref": "#/definitions/UserPut"
}
}
],
"responses": {
"204": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"security": [
{
"cookieAuth": []
}
],
"tags": [
"User"
]
},
"patch": {
"description": "Modify a given user (property).",
"parameters": [
{
"name": "json",
"in": "body",
"schema": {
"$ref": "#/definitions/UserPatch"
}
}
],
"responses": {
"204": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"security": [
{
"cookieAuth": []
}
],
"tags": [
"User"
]
},
"delete": {
"description": "Delete a given user.",
"responses": {
"204": {
"description": "Success"
},
"401": {
"description": "Unauthorized"
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"security": [
{
"cookieAuth": []
}
],
"tags": [
"User"
]
}
}
},
"responses": {},
"parameters": {},
"securityDefinitions": {},
"tags": []
}