Skip to content

Top-level $ref in 0.44.0 #391

Closed
Closed
@joshkel

Description

@joshkel

When I upgraded from typescript-json-schema 0.43.0 to 0.44.0, I noticed that AJV started giving a new warning when compiling the generated schema:

$ref: keywords ignored in schema at path "#/properties/data/properties/pcList"

Sample TypeScript types:

interface Parent { name?: string; children: Child[]; }
interface Child { name?: string; parent?: Parent; }

The generated schema in 0.43.0 has a definitions.Parent section and also duplicates the Parent type's properties on the root schema. The generated schema in 0.44.0 has a top-level "$ref": "#/definitions/Parent" property. If I understand the discussions at ajv-validator/ajv#1121 correctly, the top-level $ref object is technically invalid.

If I've misunderstood this, please let me know. Thanks!

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