Browse Source

v0.9

master
Nicolas Massé 5 years ago
parent
commit
744cc70df5
  1. 149
      openapi.json

149
openapi.json

@ -2,15 +2,10 @@
"openapi": "3.0.2", "openapi": "3.0.2",
"info": { "info": {
"title": "Library API", "title": "Library API",
"version": "1.1.0", "version": "0.9.0",
"description": "A simple API for managing authors and books.",
"contact": { "contact": {
"name": "Eric Wittmann", "name": "Nicolas Massé",
"email": "eric.wittmann@redhat.com" "email": "nmasse@redhat.com"
},
"license": {
"name": "Mozilla 2.0",
"url": "https://www.mozilla.org/en-US/MPL/2.0/"
} }
}, },
"paths": { "paths": {
@ -29,17 +24,12 @@
} }
}, },
"examples": { "examples": {
"authors": { "all-authors": {
"value": [ "value": [
{ {
"id": "mpagnol", "id": "vhugo",
"name": "Marcel Pagnol", "name": "Victor Hugo",
"dob": "1895-02-28" "dob": "26-02-1885"
},
{
"id": "ezola",
"name": "Émile Zola",
"dob": "1840-04-02"
} }
] ]
} }
@ -79,7 +69,21 @@
"summary": "Path used to manage a single Author.", "summary": "Path used to manage a single Author.",
"description": "The REST endpoint/path used to get, update, and delete single instances of an `Author`. This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and delete tasks, respectively.", "description": "The REST endpoint/path used to get, update, and delete single instances of an `Author`. This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and delete tasks, respectively.",
"get": { "get": {
"tags": [ "parameters": [
{
"examples": {
"vhugo": {
"value": "vhugo"
}
},
"name": "authorId",
"description": "A unique identifier for a `Author`.",
"schema": {
"type": "string"
},
"in": "path",
"required": true
}
], ],
"responses": { "responses": {
"200": { "200": {
@ -87,13 +91,19 @@
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/Author" "$ref": "#/components/schemas/Author"
},
"examples": {
"vhugo": {
"value": {
"id": "vhugo",
"name": "Victor Hugo",
"dob": "26-02-1885"
}
}
} }
} }
}, },
"description": "Successful response - returns a single `Author`." "description": "Successful response - returns a single `Author`."
},
"404": {
"$ref": "#/components/responses/NotFound"
} }
}, },
"operationId": "getAuthor", "operationId": "getAuthor",
@ -115,9 +125,6 @@
"responses": { "responses": {
"202": { "202": {
"description": "Successful response." "description": "Successful response."
},
"404": {
"$ref": "#/components/responses/NotFound"
} }
}, },
"operationId": "updateAuthor", "operationId": "updateAuthor",
@ -128,9 +135,6 @@
"responses": { "responses": {
"204": { "204": {
"description": "Successful response." "description": "Successful response."
},
"404": {
"$ref": "#/components/responses/NotFound"
} }
}, },
"operationId": "deleteAuthor", "operationId": "deleteAuthor",
@ -162,6 +166,16 @@
"items": { "items": {
"$ref": "#/components/schemas/Book" "$ref": "#/components/schemas/Book"
} }
},
"examples": {
"all-books": {
"value": [
{
"title": "Les Misérables",
"publish-date": "01-01-1862"
}
]
}
} }
} }
}, },
@ -198,12 +212,36 @@
"summary": "Path used to manage a single Book.", "summary": "Path used to manage a single Book.",
"description": "The REST endpoint/path used to get, update, and delete single instances of an `Book`. This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and delete tasks, respectively.", "description": "The REST endpoint/path used to get, update, and delete single instances of an `Book`. This path contains `GET`, `PUT`, and `DELETE` operations used to perform the get, update, and delete tasks, respectively.",
"get": { "get": {
"parameters": [
{
"examples": {
"les-miserables": {
"value": "les-miserables"
}
},
"name": "bookId",
"description": "A unique identifier for a `Book`.",
"schema": {
"type": "string"
},
"in": "path",
"required": true
}
],
"responses": { "responses": {
"200": { "200": {
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"$ref": "#/components/schemas/Book" "$ref": "#/components/schemas/Book"
},
"examples": {
"les-miserables": {
"value": {
"title": "Les Misérables",
"publish-date": "01-01-1862"
}
}
} }
} }
}, },
@ -262,7 +300,7 @@
"schemas": { "schemas": {
"Author": { "Author": {
"title": "Root Type for Author", "title": "Root Type for Author",
"description": "The author of a book.", "description": "",
"type": "object", "type": "object",
"properties": { "properties": {
"id": { "id": {
@ -272,66 +310,41 @@
"type": "string" "type": "string"
}, },
"dob": { "dob": {
"format": "date",
"type": "string" "type": "string"
} }
}, },
"example": { "example": {
"id": "jk-rowling", "id": "vhugo",
"name": "JK Rowling", "name": "Victor Hugo",
"dob": "1968-01-01" "dob": "26-02-1885"
} }
}, },
"Book": { "Book": {
"title": "Root Type for Book", "title": "Root Type for Book",
"description": "Information about a book.", "description": "",
"type": "object", "type": "object",
"properties": { "properties": {
"ddsn": {
"type": "string"
},
"title": { "title": {
"type": "string" "type": "string"
}, },
"author": {
"$ref": "#/components/schemas/Author"
},
"publish-date": { "publish-date": {
"format": "date", "format": "date",
"type": "string" "type": "string"
},
"ddsn": {
"description": "",
"type": "string"
},
"author": {
"$ref": "#/components/schemas/Author",
"description": ""
} }
}, },
"example": { "example": {
"ddsn": "632.4", "title": "Les Misérables",
"title": "SQL For Dummies", "publish-date": "01-01-1862"
"publish-date": "2001-05-13"
} }
} }
},
"responses": {
"NotFound": {
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
},
"description": "Generic response when not found."
}
},
"securitySchemes": {
"api-key": {
"type": "apiKey",
"name": "api-key",
"in": "header"
}
}
},
"security": [
{
"api-key": [
]
} }
] }
} }
Loading…
Cancel
Save