openapi: 3.0.0
tags:
  - name: Sentences
  - name: Books
info:
  title: Random Lovecraft
  version: '1.0'
  description: Random sentences from the complete works of H.P. Lovecraft. CORS-enabled.
servers:
  - url: 'https://randomlovecraft.com/api'
paths:
  /sentences:
    summary: ''
    parameters:
      - schema:
          type: integer
          default: 1
          maximum: 100
        in: query
        name: limit
    get:
      summary: 'A random sentence'
      description: ''
      operationId: get-sentences
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/sentence'
      tags:
        - Sentences
  /sentences/{id}:
    summary: ''
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: Sentence ID
    get:
      summary: 'A specific sentence'
      description: ''
      operationId: get-specific-sentence
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/sentence'
      tags:
        - Sentences
  /books/{id}/sentences:
    summary: ''
    parameters:
      - schema:
          type: string
        name: id
        in: path
        required: true
        description: 'Book ID'
      - schema:
          type: integer
          default: 1
          maximum: 100
        in: query
        name: limit
    get:
      summary: 'Random sentences from a specific book'
      description: ''
      operationId: get-sentences-from-book
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/sentence'
      tags:
        - Sentences
  /books:
    summary: ''
    get:
      summary: 'List all books'
      description: ''
      operationId: get-books
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/book'
      tags:
        - Books
components:
  schemas:
    sentence:
      type: object
      properties:
        id:
          type: string
          example: d75b3350
        sentence:
          type: string
          example: 'Around the first week in July I developed an unaccountable set of mixed emotions about that general northeasterly region.'
        book:
          $ref: '#/components/schemas/book'
    book:
      type: object
      properties:
        id:
          type: string
          example: afd6
        name:
          type: string
          example: The Shadow Out of Time
        year:
          type: string
          example: '1934'
