Skip to content

Instantly share code, notes, and snippets.

@jmlweb
Last active August 29, 2015 14:10
Show Gist options
  • Save jmlweb/160df8bf24eabb94e6ec to your computer and use it in GitHub Desktop.
Save jmlweb/160df8bf24eabb94e6ec to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"version": "0.0.1",
"title": "Blendhub Tool",
"contact": {
"name": "josemanuel@jmlweb.es"
}
},
"host": "localhost:9000",
"schemes": ["http"],
"paths": {
"/login": {
"post": {
"tags": ["login"],
"description": "Hace una llamada para intentar loguearse\n",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "email",
"in": "formData",
"description": "Email del usuario",
"required": true,
"type": "string"
},
{
"name": "password",
"in": "formData",
"description": "Contraseña del usuario",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Respuesta correcta",
"schema": {
"$ref": "#/definitions/user"
}
},
"405": {
"description": "Datos inválidos",
"schema": {
"$ref": "#/definitions/invalid"
}
}
}
}
},
"/config": {
"get": {
"tags": ["config"],
"description": "Obtiene los datos globales de configuración (tipos de moneda, materiales predefinidos...)",
"produces": ["application/json"],
"responses": {
"200": {
"description": "Respuesta correcta",
"schema": {
"$ref": "#/definitions/config"
}
}
}
}
},
"/wizard": {
"post": {
"tags": ["wizard"],
"description": "Añade los datos de un nuevo asistente",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "blends",
"in": "formData",
"description": "Mezcla(s) con sus datos respectivos",
"required": true,
"schema": {
"type": "array",
"items": {
"schema": {
"$ref": "#/definitions/blend"
}
}
}
}
],
"responses": {
"200": {
"description": "Respuesta correcta",
"schema": {
"$ref": "#/definitions/valid"
}
}
}
}
}
},
"definitions": {
"invalid": {
"required": [
"msg"
],
"properties": {
"msg": {
"type": "string"
}
}
},
"valid": {
"required": [
"msg"
],
"properties": {
"msg": {
"type": "string"
}
}
},
"user": {
"required": [
"name",
"email",
"role"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"role": {
"type": "string"
}
}
},
"config": {
"properties": {
"currencies": {
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/currency"
}
}
},
"materials": {
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/material"
}
}
}
}
},
"currency": {
"required": [
"name",
"symbol",
"rate"
],
"properties": {
"name": {
"type": "string"
},
"symbol": {
"type": "string"
},
"rate": {
"type": "number",
"format": "float",
"description": "Tasa de cambio con respecto al dólar"
}
}
},
"location": {
"type": "object",
"required": ["id", "name", "code"],
"properties": {
"id": {
"type": "number",
"format": "int64"
},
"name": {
"type": "string"
},
"code": {
"type": "string"
}
}
},
"material": {
"required": [
"id",
"name",
"code"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"image": {
"type": "string",
"description": "Ruta a la imagen (sin incluir path al directorio)"
},
"code": {
"type": "string",
"description": "Código arancelario"
}
}
},
"combination": {
"type": "object",
"required": ["currency", "location", "price"],
"properties": {
"currency": {
"$ref": "#/definitions/currency"
},
"location": {
"$ref": "#/definitions/location"
},
"price": {
"type": "number",
"format": "float"
}
}
},
"selectedMaterial": {
"type": "object",
"required": ["material", "combinations"],
"properties": {
"material": {
"$ref": "#/definitions/material"
},
"combinations": {
"type": "array",
"items": {
"$ref": "#/definitions/combination"
}
}
}
},
"customer": {
"type": "object",
"required": ["location", "volume"],
"properties": {
"location": {
"$ref": "#/definitions/location"
},
"volume": {
"type": "number",
"format": "int64"
}
}
},
"blend": {
"type": "object",
"required": ["materials", "customers"],
"properties": {
"materials": {
"type": "array",
"items": {
"$ref": "#/definitions/selectedMaterial"
}
},
"customers": {
"type": "array",
"items": {
"$ref": "#/definitions/customer"
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment