Skip to content

Writing $ref values that have a $Id as a value are incorrectly prepending #/components/schema/ #1850

Closed

Description

@darrelmiller

Given an input of this

openapi: 3.1.0
info:
  title: Simple API
  version: 1.0.0
paths:
  /box:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: https://foo.bar/Box
  /circle:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: https://foo.bar/Circle
components:
  schemas:
    Box:
      $id: https://foo.bar/Box
      type: object
      properties:
        width:
          type: number
        height:
          type: number
    Circle:
      $id: https://foo.bar/Circle
      type: object
      properties:
        radius:
          type: number

is written out as

openapi: '3.1.0'
info:
  title: Simple API
  version: 1.0.0
paths:
  /box:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/https://foo.bar/Box'
  /circle:
    get:
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/https://foo.bar/Circle'
components:
  schemas:
    Box:
      $id: https://foo.bar/Box
      type: object
      properties:
        width:
          type: number
        height:
          type: number
    Circle:
      $id: https://foo.bar/Circle
      type: object
      properties:
        radius:
          type: number

The $ref values should just be the uri

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions