Sora-reader / backend

https://backend.sora-reader.app
GNU General Public License v3.0
4 stars 4 forks source link

API mock up #56

Closed dhvcc closed 3 years ago

dhvcc commented 3 years ago

Нужно накидать OpenApi 3.0 схема для АПИ, что бы разработка была проще

Желательно использовать SwaggerHub

dhvcc commented 3 years ago

Накидал базу. При создании нужно будет уже добавлять существующую схему

openapi: 3.0.0
info:
  description: Sora-reader backend API
  version: "1.0.0"
  title: Sora
  contact:
    email: 1337kwiz@gmail.com
  license:
    name: GPLv3
    url: 'https://www.gnu.org/licenses/gpl-3.0.en.html'
servers:
  # Added by API Auto Mocking Plugin
  - description: SwaggerHub API Auto Mocking
    url: https://virtserver.swaggerhub.com/sora-reader/Sora-backend/1.0.0
  - description: Dummy sora API url
    url: 'https://sora-backend.com/api'
tags:
  - name: manga
    description: Endpoints for fetching manga data
  - name: search
    description: Search
paths:
  '/manga/{mangaId}':
    get:
      tags:
        - manga
      summary: Get manga detail by ID
      description: Returns detailed info about manga
      operationId: mangaDetail
      parameters:
        - name: mangaId
          in: path
          description: ID of manga to return
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Manga'
        '404':
          description: Manga not found
      security:
        - bearerAuth: []
  '/manga/{mangaId}/chapters':
    get:
      tags:
        - manga
      summary: Get manga chapters by ID
      description: Returns chapters for manga
      operationId: mangaChapters
      parameters:
        - name: mangaId
          in: path
          description: ID of manga to get chapters for
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MangaChapterList'
        '404':
          description: Manga not found
      security:
        - bearerAuth: []
  '/manga/{mangaId}/chapter/{chapterId}/images':
    get:
      tags:
        - manga
      summary: Get chapter images by ID
      description: Returns images for manga chapter
      operationId: mangaChapterImages
      parameters:
        - name: mangaId
          in: path
          description: ID of manga to get chapters for
          required: true
          schema:
            type: integer
            format: int64
        - name: chapterId
          in: path
          description: ID of chapter to get images for
          required: true
          schema:
            type: integer
            format: int64
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChapterImageList'
        '404':
          description: Manga or chapter not found
      security:
        - bearerAuth: []
  /search:
    get:
      tags:
        - search
      parameters:
        - name: title
          in: query
          description: Manga title
          required: true
          schema:
            type: string
      summary: Search manga by title
      description: Returns a list of manga items
      operationId: search
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: array
                items: 
                  type: object
      security:
        - bearerAuth: []
components:
  schemas:
    Manga:
      type: object
      properties:
        id:
         type: integer
         format: int64
    MangaChapter:
      type: object
      properties:
        link:
          type: string
    MangaChapterList:
      type: array
      items:
        $ref: '#/components/schemas/MangaChapter'
    ChapterImageList:
      type: array
      items:
        type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT # optional, arbitrary value for documentation purposes