Skip to content

$ref at root level is not omitted #174

@dibericky

Description

@dibericky

Steps to reproduce

With a jsonSchema like:

{
  components: {
    schemas: {
      Pet: {
        type: "string"
      }
    }
  },
  $ref: "#/components/schemas/Pet"
};

the $ref is correctly resolved, but is kept a "$ref: "#" in the result.
Example

+ expected - actual ... Lines skipped

  {
-   '$ref': '#',
    components: {
...
    type: 'string'
  }

What is expected?
I expect that the $ref is omitted from the result:

{
      components: {
        schemas: {
          Pet: {
            type: "string"
          }
        }
      },
      type: "string"
    }

Other info

  • node version: v10.20.1
  • json-schema-ref-parser version: 9.0.1

Metadata

Metadata

Assignees

No one assigned

    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