Skip to content

unreachableDefinitions doesn't work without declareExternallyReferenced #652

Open
@patrickbenjamin1

Description

@patrickbenjamin1

I have many schema files, some of which contain multiple schemas through $defs

i.e.

{
  "$defs": {
    "CreateThingRequestBody": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        }
      }
    },

    "CreateThingResponseBody": {
      "properties": {
        "thing": {
          "$ref": "/schemas/entities/thing.schema.json"
        }
      },
      "additionalProperties": false
    }
  }
}

From the above file, I'd like to be able to generate a type for CreateThingRequestBody and CreateThingResponseBody without redeclaring the type for Thing

My script goes through my schemas file by file, so I want Thing to only be generated when it gets to /schemas/entities/thing.schema.json

unreachableDefinitions should achieve this, but for some reason it only works when declareExternallyReferenced is true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions