Skip to content

Instantly share code, notes, and snippets.

@bipon68
Last active July 8, 2023 08:43
Show Gist options
  • Save bipon68/6d868e00106146513f020f902a7c0c49 to your computer and use it in GitHub Desktop.
Save bipon68/6d868e00106146513f020f902a7c0c49 to your computer and use it in GitHub Desktop.
Basic-auth-open-api-specification
openapi: 3.0.0
info:
version: '1.0.0'
title: 'My Blog API'
description: 'This is the first prefessional api project. This is simple blog api application'
contact:
name: Bipon
url: https://bipon.com
email: [email protected]
servers:
# Added by API Auto Mocking Plugin
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/bipon/fs-army-my-blog-api/1.0.0
- description: Dev
url: http://localhost:4000/api/v1
tags:
- name: Auth
description: Authentication Endpoints (public)
- name: Article
description: Article Endpoints - (public + private)
- name: Comment
description: Comment Endpoints (private)
- name: User
description: User Endpoints (admin only)
paths:
'/auth/signup':
post:
description: create a new account
tags: [Auth]
requestBody:
content:
'application/json':
schema:
type: object
properties:
name:
type: string
example: Bipon Biswas
email:
type: string
format: email
example: [email protected]
password:
type: string
format: password
example: Password123
required: [name, email, password]
responses:
'201':
description: Signup successful
content:
'application/json':
schema:
type: object
properties:
code:
type: integer
format: int32
example: 201
message:
type: string
example: Signup Successful
data:
type: object
properties:
access_token:
type: string
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
links:
type: object
properties:
self:
type: string
example: 'auth/singup'
signin:
type: string
example: 'auth/signin'
'400':
$ref: '#/components/responses/400'
'/auth/signin':
post:
description: Login to your account
tags: [Auth]
requestBody:
content:
'application/json':
schema:
type: object
properties:
email:
type: string
format: email
example: [email protected]
password:
type: string
format: password
example: Password123
required: [email, password]
responses:
'200':
description: Signin successful
content:
'application/json':
schema:
type: object
properties:
code:
type: integer
format: int32
example: 200
message:
type: string
example: Signin Successful
data:
type: object
properties:
access_token:
type: string
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
links:
type: object
properties:
self:
type: string
example: 'auth/singin'
'400':
$ref: '#/components/responses/400'
components:
responses:
'400':
description: 'Bad Request'
content:
'application/json':
schema:
type: object
properties:
code:
type: integer
format: int31
example: 400
error:
type: string
example: Bad Request
data:
type: array
items:
type: object
properties:
field:
type: string
example: email
message:
type: string
example: Invalid email
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment