Skip to content

IllegalArgumentException: "Invalid ref..." when uses an external link like "../demo#/components" #810

Open

Description

@lovesickness-pika

Hello, thinks for the nice tools, but i faced a problem where when i uses an external link, an exception was thrown
Exception in thread "main" java.lang.IllegalArgumentException: Invalid ref: ../../common/restapi-sdk-data-schemas.yaml#/components/schemas/ApiError at org.openapitools.openapidiff.core.utils.RefPointer.getRefName(RefPointer.java:60) at org.openapitools.openapidiff.core.utils.RefPointer.resolveRef(RefPointer.java:16) at org.openapitools.openapidiff.core.compare.SchemaDiff.computeDiffForReal(SchemaDiff.java:340) at org.openapitools.openapidiff.core.model.deferred.DeferredSchemaCache.processSchemaQueue(DeferredSchemaCache.java:86) at org.openapitools.openapidiff.core.model.deferred.DeferredSchemaCache.process(DeferredSchemaCache.java:64) at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:113) at org.openapitools.openapidiff.core.compare.OpenApiDiff.compare(OpenApiDiff.java:72) at org.openapitools.openapidiff.core.OpenApiCompare.fromSpecifications(OpenApiCompare.java:166) at org.openapitools.openapidiff.core.OpenApiCompare.fromSpecifications(OpenApiCompare.java:153)

After read sourcecode, i think i have no any way to trun off the checks on ref

Activity

  1. DrSatyr commented on Aug 21, 2025

    @DrSatyr
    Collaborator

    @lovesickness-pika could you please clarify what you mean by external link like "../demo#/components"

  2. ctreatma commented on Dec 11, 2025

    @ctreatma
    Contributor

    I'm running into this issue as well. The RefPointer class has strict validation on the format of a $ref, requiring all $ref pointers to be in the form #/components/<kind>/<ref name>.

    While that is one possible format for internal references, it is not the only valid way to specify a reference. There are other possible formats for internal references, such as the #/definitions/myElement mentioned in the linked docs. There can also be remote references or URL references, and it is possible for remote or URL references to either reference an entire file (../../my-file.yaml) or reference a specific element in that file (../../my-file.yaml#/path/to/ref).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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