Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Recipe-Api-v2/openapi.json
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
246 lines (246 sloc)
6.95 KB
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
openapi: 3.0.0 | |
info: | |
title: Recipe API | |
version: 1.0.0 | |
description: A RESTful API for managing recipes. Users can register, login, and perform CRUD operations on recipes. | |
servers: | |
- url: http://localhost:5000 | |
description: Local server | |
paths: | |
/register: | |
post: | |
summary: Register a new user | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
username: | |
type: string | |
example: testuser | |
password: | |
type: string | |
example: testpassword | |
responses: | |
'200': | |
description: User registered successfully | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
message: | |
type: string | |
example: User registered successfully | |
/login: | |
post: | |
summary: Login a user | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
username: | |
type: string | |
example: testuser | |
password: | |
type: string | |
example: testpassword | |
responses: | |
'200': | |
description: User logged in successfully | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
token: | |
type: string | |
example: your.jwt.token | |
/: | |
post: | |
summary: Create a new recipe | |
security: | |
- bearerAuth: [] | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
title: | |
type: string | |
example: Pancakes | |
ingredients: | |
type: string | |
example: Flour, Eggs, Milk, Sugar | |
instructions: | |
type: string | |
example: Mix all ingredients and cook on a griddle. | |
responses: | |
'200': | |
description: Recipe created successfully | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
id: | |
type: integer | |
example: 1 | |
title: | |
type: string | |
example: Pancakes | |
ingredients: | |
type: string | |
example: Flour, Eggs, Milk, Sugar | |
instructions: | |
type: string | |
example: Mix all ingredients and cook on a griddle. | |
userId: | |
type: integer | |
example: 1 | |
/: | |
get: | |
summary: Get all recipes | |
responses: | |
'200': | |
description: A list of all recipes | |
content: | |
application/json: | |
schema: | |
type: array | |
items: | |
type: object | |
properties: | |
id: | |
type: integer | |
example: 1 | |
title: | |
type: string | |
example: Pancakes | |
ingredients: | |
type: string | |
example: Flour, Eggs, Milk, Sugar | |
instructions: | |
type: string | |
example: Mix all ingredients and cook on a griddle. | |
userId: | |
type: integer | |
example: 1 | |
/{id}: | |
get: | |
summary: Get a recipe by ID | |
parameters: | |
- in: path | |
name: id | |
schema: | |
type: integer | |
required: true | |
description: Numeric ID of the recipe to get | |
responses: | |
'200': | |
description: A recipe object | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
id: | |
type: integer | |
example: 1 | |
title: | |
type: string | |
example: Pancakes | |
ingredients: | |
type: string | |
example: Flour, Eggs, Milk, Sugar | |
instructions: | |
type: string | |
example: Mix all ingredients and cook on a griddle. | |
userId: | |
type: integer | |
example: 1 | |
put: | |
summary: Update a recipe | |
security: | |
- bearerAuth: [] | |
parameters: | |
- in: path | |
name: id | |
schema: | |
type: integer | |
required: true | |
description: Numeric ID of the recipe to update | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
title: | |
type: string | |
example: Updated Pancakes | |
ingredients: | |
type: string | |
example: Flour, Eggs, Milk, Sugar, Vanilla | |
instructions: | |
type: string | |
example: Mix all ingredients and cook on a griddle. Add vanilla for flavor. | |
responses: | |
'200': | |
description: Recipe updated successfully | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
id: | |
type: integer | |
example: 1 | |
title: | |
type: string | |
example: Updated Pancakes | |
ingredients: | |
type: string | |
example: Flour, Eggs, Milk, Sugar, Vanilla | |
instructions: | |
type: string | |
example: Mix all ingredients and cook on a griddle. Add vanilla for flavor. | |
userId: | |
type: integer | |
example: 1 | |
delete: | |
summary: Delete a recipe | |
security: | |
- bearerAuth: [] | |
parameters: | |
- in: path | |
name: id | |
schema: | |
type: integer | |
required: true | |
description: Numeric ID of the recipe to delete | |
responses: | |
'200': | |
description: Recipe deleted successfully | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
message: | |
type: string | |
example: Recipe deleted | |
components: | |
securitySchemes: | |
bearerAuth: | |
type: http | |
scheme: bearer | |
bearerFormat: JWT |