openapi: 3.0.0
info:
  title: Widgets With Refs API
  version: "1.0.0"
paths:
  /widgets:
    post:
      operationId: createWidget
      summary: Create a widget
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: "#/components/schemas/BaseWidget"
                - type: object
                  properties:
                    tags:
                      type: array
                      items:
                        type: string
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Widget"
  /widgets/{id}:
    get:
      operationId: getWidget
      summary: Get a widget
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Widget"
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    BaseWidget:
      type: object
      properties:
        name:
          type: string
      required:
        - name
    Widget:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        parent:
          $ref: "#/components/schemas/Widget"
