Skip to content

[Bug]: External $ref fragments are not rewritten to request variant schemas #63

Description

@horaceewang-TT

Describe the bug

The schema preprocessing pipeline does not correctly rewrite external $ref values containing JSON Pointer fragments.

A reference without a fragment, such as child.json, is correctly rewritten to child_create_request.json.

However, a reference containing a fragment, such as child.json#/$defs/item, is skipped and continues to reference the base schema.

To Reproduce

  1. Define a parent schema containing an external reference
    { "properties": { "child": { "$ref": "child.json#/$defs/item" } } }
  2. Configure child.json to generate a create request variant.
  3. Run the schema preprocessing pipeline.
  4. Inspect the resulting $ref value.

The reference remains unchanged:
child.json#/$defs/item
The generated request schema therefore references the base child schema instead of its request variant.

Expected behavior

The external file component should be rewritten to the generated request variant while preserving the original fragment:

child_create_request.json#/$defs/item
Purely local references must remain unchanged:

#/$defs/local

Screenshots

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions