OpenAPI Specification Schemas

From NovaOrdis Knowledge Base
Revision as of 01:36, 26 January 2024 by Ovidiu (talk | contribs) (→‎Example)
Jump to navigation Jump to search

External

Internal

Overview

The /components/schemas section of the OpenAPI specification defines reusable objects a client or server code generator creates programming language types for. This article is annotated with details related to how oapi-codegen generates Go code.

Example

components:
  schemas:
    Pet:
      allOf:
        - $ref: '#/components/schemas/NewPet'
        - type: object
          required:
            - id
          properties:
            id:
              type: integer
              format: int64
    NewPet:
      type: object
      required:
        - name
      properties:
        name:
          type: string
        tag:
          type: string
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string

Schema Name