Дерево страниц

Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Блок кода
languageyml
titleОписание API
collapsetrue
openapi: "3.0.1"
info:
  title: OSS Interaction Service API
  version: "1.0"
 
components:
  securitySchemes:
    JwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
 
  schemas:
    username:
      type: integer
      description: 'Имя пользователя (номер телефона). Может иметь длину от 7 до 15 символов'
      example: '79123456789'
      maxLength: 15
      minLength: 7
 
    domain:
      type: string
      description: 'Домен (область видимости), в котором создан пользователь. Каждый блок может иметь длину от 1 до 63 символов и состоять из латинских букв и/или цифр, также допустимы символы: _ и -. Общая длина не более 235 символов.'
      example: "root.hello.world"
      maxLength: 235
      minLength: 1
      pattern: '(?=^.{1,235}$)(^((?!-|_|.*(__|--).*)[a-zA-Z0-9_-]{1,63}.)*((?!-|_|.*(__|--).*)[a-zA-Z0-9_-]{1,63})$)'
 
    User:
      type: object
      properties:
        username:
          $ref: '#/components/schemas/username'
 
        domain:
          $ref: '#/components/schemas/domain'
 
    User_attrs:
      type: object
      properties:
        tariff_code:
          type: string
          description: 'Код тарифа пользователя. Соответствующий тариф должен присутствовать в системе. Может состоять из латинских букв и/или цифр до 64-х символов.'
          maxLength: 64
          minLength: 1
          pattern: '[a-zA-Z0-9]\{1,64}'
        locked:
          type: boolean
          description: 'Флаг блокировки пользователя. true — заблокирован, false — разблокирован.'
 
    User_full:
      type: object
      allOf:
        - $ref: '#/components/schemas/User'
        - $ref: '#/components/schemas/User_attrs'
        - type: object
 
    Error:
      type: object
      properties:
        description:
          type: string
          description: Описание ошибки.
 
  requestBodies:
    # user without attrs (only username and domain)
    User:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/User'
      description: Объект пользователя без атрибутов.
 
    # full user information, including username, domain, lock and tariff code
    User_full:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/User_full'
      description: Полный объект пользователя.
      required: true
 
    # user attributes only (tariff code and lock value)
    User_attrs:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/User_attrs'
      description: Объект атрибутов пользователя.
      required: true
 
  responses:
    200:
      description: Успешная операция. ВовзращаетВозвращает только имя пользователя и его домен.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/User_full'
 
    200_full:
      description: Успешная операция. ВовзращаетВозвращает полный объект пользователя.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/User_full'
 
    400:
      description: Неправильное имя пользователя или домен.
      content:
        'application/json':
          schema:
            $ref: '#/components/schemas/Error'
 
    403:
      description: Доступ запрещён
      content:
        'application/json':
          schema:
            $ref: '#/components/schemas/Error'
 
    404:
      description: Пользователь с таким именем и/или доменом не существует или URL неверный.
 
    500:
      description: Внутренняя ошибка.
      content:
        'application/json':
          schema:
            $ref: '#/components/schemas/Error'
 
 
 
security:
  - JwtAuth: []
 
tags:
  - name: users
    description: API управления пользователями.
 
 
paths:
  /api/users/new:
    post:
      tags:
        - users
      summary: Создать нового пользователя
      requestBody:
        $ref: '#/components/requestBodies/User_full'
 
      responses:
        200:
          $ref: "#/components/responses/200_full"
        400:
          $ref: "#/components/responses/400"
        403:
          $ref: "#/components/responses/403"
        404:
          $ref: "#/components/responses/404"
 
 
  /api/users/{username}@{domain}:
    parameters:
      - name: username
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/username'
 
      - name: domain
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/domain'
 
 
    put:
      tags:
        - users
      summary: Изменить параметры пользователя.
      requestBody:
        $ref: '#/components/requestBodies/User_attrs'
 
      responses:
        200:
          $ref: "#/components/responses/200_full"
        400:
          $ref: "#/components/responses/400"
        403:
          $ref: "#/components/responses/403"
        404:
          $ref: "#/components/responses/404"
 
    delete:
      tags:
        - users
      summary: Удалить пользователя. В URL запроса указывается username и домен.
      responses:
        200:
          $ref: "#/components/responses/200"
        400:
          $ref: "#/components/responses/400"
        403:
          $ref: "#/components/responses/403"
        404:
          $ref: "#/components/responses/404"

...

Блок кода
languageyml
titleОписание API
collapsetrue
openapi: "3.0.1"
info:
  title: OSS Interaction Service API
  version: "1.0"
 
components:
  securitySchemes:
    JwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
   
  schemas:
    account_id:
      type: integer
      description: Номер лицевого счёта клиента (НЛС).
      maxLength: 12
      minLength: 12
 
    locked:
      type: boolean
      description: Флаг блокировки счёта клиента (НЛС).
     
    account_properties:
      type: object
      properties:
        locked:
          $ref: '#/components/schemas/locked'
     
    Response:
      type: object
      properties:
        locked:
          $ref: '#/components/schemas/locked'
 
        account_id:
          $ref: '#/components/schemas/account_id'
         
    Error:
      type: object
      properties:
        description:
          type: string
          description: Описание ошибки.
     
  requestBodies:
    # user without attrs (only username and domain)
    account_properties:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/account_properties'
      description: Параметры клиента.
              
 
  responses:
 
    200:
      description: Успешная операция. ВовзращаетВозвращает параметры клиента.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Response'
 
    400:
      description: Формат НЛС неверный.
      content:
        'application/json':
          schema:
            $ref: '#/components/schemas/Error'
 
    403:
      description: Доступ запрещён.
      content:
        'application/json':
          schema:
            $ref: '#/components/schemas/Error'
 
    404:
      description: Такой НЛС не существует.
 
    500:
      description: Внутренняя ошибка.
      content:
        'application/json':
          schema:
            $ref: '#/components/schemas/Error'
 
       
 
security:
  - JwtAuth: []
 
tags:
  - name: clients
    description: API для управления клиентами.
   
paths:
  /api/clients/{account_id}:
    put:
      tags:
        - clients
      summary: Изменить параметры клиента с данным НЛС.
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            $ref: '#/components/schemas/account_id'
       
      requestBody:
        $ref: '#/components/requestBodies/account_properties'
       
      responses:
        200:
          $ref: "#/components/responses/200"
        400:
          $ref: "#/components/responses/400"
        403:
          $ref: "#/components/responses/403"
        404:
          $ref: "#/components/responses/404"

...