resourcejs
Version:
A simple Express library to reflect Mongoose models to a REST interface.
216 lines (215 loc) • 6.95 kB
JSON
{
"definitions": {
"nested1": {
"title": "nested1",
"properties": {
"resource1": { "type": "string", "description": "ObjectId" },
"title": { "type": "string" },
"age": { "type": "integer", "format": "int64" },
"description": { "type": "string" },
"_id": { "type": "string", "description": "ObjectId" }
}
}
},
"paths": {
"/test/resource1/{resource1Id}/nested1": {
"get": {
"tags": ["nested1"],
"summary": "List multiple nested1 resources.",
"description": "This operation allows you to list and search for nested1 resources provided query arguments.",
"operationId": "getnested1s",
"responses": {
"200": {
"description": "Resource(s) found. Returned as array.",
"schema": {
"type": "array",
"items": { "$ref": "#/definitions/nested1" }
}
},
"401": { "description": "Unauthorized." }
},
"parameters": [
{
"name": "skip",
"in": "query",
"description": "How many records to skip when listing. Used for pagination.",
"required": false,
"type": "integer",
"default": 0
},
{
"name": "limit",
"in": "query",
"description": "How many records to limit the output.",
"required": false,
"type": "integer",
"default": 10
},
{
"name": "sort",
"in": "query",
"description": "Which fields to sort the records on.",
"type": "string",
"required": false,
"default": ""
},
{
"name": "select",
"in": "query",
"description": "Select which fields will be returned by the query.",
"type": "string",
"required": false,
"default": ""
},
{
"name": "populate",
"in": "query",
"description": "Select which fields will be fully populated with the reference.",
"type": "string",
"required": false,
"default": ""
},
{
"in": "path",
"name": "resource1Id",
"description": "The parent model of nested1: test/resource1",
"required": true,
"type": "string"
}
]
},
"post": {
"tags": ["nested1"],
"summary": "Create a new nested1",
"description": "Create a new nested1",
"operationId": "createnested1",
"responses": {
"201": { "description": "The resource has been created." },
"400": {
"description": "An error has occured trying to create the resource."
},
"401": {
"description": "Unauthorized. Note that anonymous submissions are *enabled* by default."
}
},
"parameters": [
{
"in": "body",
"name": "body",
"description": "Data used to create a new nested1",
"required": true,
"schema": { "$ref": "#/definitions/nested1" }
},
{
"in": "path",
"name": "resource1Id",
"description": "The parent model of nested1: test/resource1",
"required": true,
"type": "string"
}
]
}
},
"/test/resource1/{resource1Id}/nested1/{nested1Id}": {
"get": {
"tags": ["nested1"],
"summary": "Return a specific nested1 instance.",
"description": "Return a specific nested1 instance.",
"operationId": "getnested1",
"responses": {
"200": {
"description": "Resource found",
"schema": { "$ref": "#/definitions/nested1" }
},
"401": { "description": "Unauthorized." },
"404": { "description": "Resource not found" },
"500": { "description": "An error has occurred." }
},
"parameters": [
{
"name": "nested1Id",
"in": "path",
"description": "The ID of the nested1 that will be retrieved.",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "resource1Id",
"description": "The parent model of nested1: test/resource1",
"required": true,
"type": "string"
}
]
},
"put": {
"tags": ["nested1"],
"summary": "Update a specific nested1 instance.",
"description": "Update a specific nested1 instance.",
"operationId": "updatenested1",
"responses": {
"200": {
"description": "Resource updated",
"schema": { "$ref": "#/definitions/nested1" }
},
"400": { "description": "Resource could not be updated." },
"401": { "description": "Unauthorized." },
"404": { "description": "Resource not found" },
"500": { "description": "An error has occurred." }
},
"parameters": [
{
"name": "nested1Id",
"in": "path",
"description": "The ID of the nested1 that will be updated.",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"description": "Data used to update nested1",
"required": true,
"schema": { "$ref": "#/definitions/nested1" }
},
{
"in": "path",
"name": "resource1Id",
"description": "The parent model of nested1: test/resource1",
"required": true,
"type": "string"
}
]
},
"delete": {
"tags": ["nested1"],
"summary": "Delete a specific nested1",
"description": "Delete a specific nested1",
"operationId": "deletenested1",
"responses": {
"204": { "description": "Resource was deleted" },
"400": { "description": "Resource could not be deleted." },
"401": { "description": "Unauthorized." },
"404": { "description": "Resource not found" },
"500": { "description": "An error has occurred." }
},
"parameters": [
{
"name": "nested1Id",
"in": "path",
"description": "The ID of the nested1 that will be deleted.",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "resource1Id",
"description": "The parent model of nested1: test/resource1",
"required": true,
"type": "string"
}
]
}
}
}
}