Create swagger docs boilerplate

This commit is contained in:
b1ek 2023-04-08 23:27:44 +10:00
parent debae76e1e
commit 4449cb50e8
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 185 additions and 0 deletions

185
docs/swagger.yml Normal file
View File

@ -0,0 +1,185 @@
openapi: 3.0.3
info:
title: Pairent main backend
description: |-
This is basic Pairent API specs
termsOfService: http://pairent.io/tos
contact:
email: devs@pairent.io
license:
name: PSCL # Pairent Source Code License
url: https://pairent.io/license
version: INDEV
servers:
- url: https://pairent.io/api/v3
- url: https://pairent-api-dev-unstable.blek.codes/api/v3
tags:
- name: Offers
description: Offers interaction
- name: Users
description: User profile interaction
- name: Account
description: Personal account interaction
- name: Auth
description: Authentication API
paths:
/offer/fetch_offer_data:
post:
tags:
- Offers
summary: Get offer data according to access permissions
description: Get offer data according to access permissions
operationId: fetchOffer
requestBody:
description: Update an existent pet in the store
content:
application/json:
schema:
$ref: '#/components/schemas/FetchRequest'
application/xml:
schema:
$ref: '#/components/schemas/FetchRequest'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/FetchRequest'
required: true
parameters:
- name: id
in: query
description: ID of offer to get data
required: true
schema:
type: integer
format: int64
default: 1
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Offer'
application/xml:
schema:
$ref: '#/components/schemas/Offer'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation exception
security:
- user_auth:
- read:offer
components:
schemas:
FetchRequest:
type: object
properties:
api_auth_token:
type: string
format: string
example: Z29ubmEgZ28ga2lsbCBteXNlbGYgVXdV
csrf:
type: string
format: string
example: DVMXSNWQmijGiExuOFYQsViJOwpBDnPodLWqGGJCnjTQHGRpxolPDKdtwiGjXDrt
meta:
type: object
format: object
example:
sent_at: 1680925159
Offer:
type: object
properties:
id:
type: integer
format: int64
example: 42
title:
type: string
format: string
example: "Уютная гостинка близко к ВВГУ"
description:
type: object
format: object
example:
allow_pets: false
allow_kids: false
furniture:
- Кровать
- Учебный стол
- Кухонный гарнитур
- Холодильник
- Духовка с плитой
- Шкаф
- Стиральная машина
is_furnished: true
is_renovated: false
price:
type: object
format: object
example:
per_month: 20000
communal: 2000
agency_comission: 12000
deposit: 15000
currency: 'RUB'
has_water:
type: boolean
format: boolean
example: true
has_electricity:
type: boolean
format: boolean
example: true
has_internet:
type: boolean
format: boolean
example: true
ceil_height:
type: number
format: number
example: 2.5
beds_count:
type: integer
format: int32
example: 1
creator: # User who created the offer
type: integer
format: int32
example: 6
house:
type: integer
format: int32
example: 32
meta:
type: object
format: object
example: {}
requestBodies:
FetchRequest:
description: Request to fetch some data
content:
application/json:
schema:
$ref: '#/components/schemas/FetchRequest'
application/xml:
schema:
$ref: '#/components/schemas/FetchRequest'
application/x-urlencoded:
schema:
$ref: '#/components/schemas/FetchRequest'
securitySchemes:
user_auth:
type: oauth2
flows:
implicit:
authorizationUrl: https://lk.vvsu.ru/oauth/authorize
scopes:
read:offer: Read offer data
api_key:
type: apiKey
name: api_key
in: header