From 4449cb50e80024b3071a85e475b483d0ee4d671c Mon Sep 17 00:00:00 2001 From: b1ek Date: Sat, 8 Apr 2023 23:27:44 +1000 Subject: [PATCH] Create swagger docs boilerplate --- docs/swagger.yml | 185 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 docs/swagger.yml diff --git a/docs/swagger.yml b/docs/swagger.yml new file mode 100644 index 0000000..44637da --- /dev/null +++ b/docs/swagger.yml @@ -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