-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
240 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: Bookstore API | ||
description: API for managing a bookstore | ||
version: 1.0.0 | ||
servers: | ||
- url: https://api.example.com/v1 | ||
description: Main (production) server | ||
- url: https://staging-api.example.com/v1 | ||
description: Staging server | ||
paths: | ||
/books: | ||
get: | ||
summary: List all books | ||
tags: | ||
- Books | ||
responses: | ||
'200': | ||
description: A list of books | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Book' | ||
post: | ||
summary: Create a new book | ||
tags: | ||
- Books | ||
requestBody: | ||
description: Book to add | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/BookInput' | ||
responses: | ||
'201': | ||
description: Book created | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Book' | ||
/books/{bookId}: | ||
get: | ||
summary: Get a book by ID | ||
tags: | ||
- Books | ||
parameters: | ||
- name: bookId | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
responses: | ||
'200': | ||
description: A single book | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Book' | ||
'404': | ||
description: Book not found | ||
put: | ||
summary: Update a book by ID | ||
tags: | ||
- Books | ||
parameters: | ||
- name: bookId | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
requestBody: | ||
description: Updated book | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/BookInput' | ||
responses: | ||
'200': | ||
description: Book updated | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Book' | ||
'404': | ||
description: Book not found | ||
delete: | ||
summary: Delete a book by ID | ||
tags: | ||
- Books | ||
parameters: | ||
- name: bookId | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
responses: | ||
'204': | ||
description: Book deleted | ||
'404': | ||
description: Book not found | ||
/authors: | ||
get: | ||
summary: List all authors | ||
tags: | ||
- Authors | ||
responses: | ||
'200': | ||
description: A list of authors | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Author' | ||
post: | ||
summary: Create a new author | ||
tags: | ||
- Authors | ||
requestBody: | ||
description: Author to add | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/AuthorInput' | ||
responses: | ||
'201': | ||
description: Author created | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Author' | ||
/authors/{authorId}: | ||
get: | ||
summary: Get an author by ID | ||
tags: | ||
- Authors | ||
parameters: | ||
- name: authorId | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
responses: | ||
'200': | ||
description: A single author | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Author' | ||
'404': | ||
description: Author not found | ||
put: | ||
summary: Update an author by ID | ||
tags: | ||
- Authors | ||
parameters: | ||
- name: authorId | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
requestBody: | ||
description: Updated author | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/AuthorInput' | ||
responses: | ||
'200': | ||
description: Author updated | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Author' | ||
'404': | ||
description: Author not found | ||
delete: | ||
summary: Delete an author by ID | ||
tags: | ||
- Authors | ||
parameters: | ||
- name: authorId | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
responses: | ||
'204': | ||
description: Author deleted | ||
'404': | ||
description: Author not found | ||
components: | ||
schemas: | ||
Book: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
title: | ||
type: string | ||
authorId: | ||
type: string | ||
publishedDate: | ||
type: string | ||
format: date | ||
BookInput: | ||
type: object | ||
properties: | ||
title: | ||
type: string | ||
authorId: | ||
type: string | ||
publishedDate: | ||
type: string | ||
format: date | ||
Author: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
name: | ||
type: string | ||
birthDate: | ||
type: string | ||
format: date | ||
AuthorInput: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
birthDate: | ||
type: string | ||
format: date | ||
|