Skip to content

Warn when import-mapping keys are JSON pointers instead of document paths #2459

Description

@mromaszewicz

In #2078 a user wrote:

import-mapping:
  "#/components/schemas": mymodule/internal/dto

expecting internal component refs to be remapped to another Go package. import-mapping keys are external document paths (files or URLs), not JSON pointers, so an entry like this silently never matches anything — the user just sees unresolved types with no hint about why.

Two small improvements:

  • Configuration validation should reject (or warn on) import-mapping keys starting with #, with a message along the lines of "import-mapping keys are document paths; internal refs cannot be remapped — see the import-mapping examples".
  • The README section on import-mapping should state explicitly that keys are document paths, that internal $refs always resolve to the current package, and point at examples/import-mapping/ for the two supported layouts (separate packages via spec split, same package via the "-" mapping).

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