OpenAPITools / OpenAPITools/openapi-diff

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

Open
#810 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.1k
Forks
190
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with org.openapitools.openapidiff.core.utils.RefPointer.java at getRefName, then follow resolveRef and the SchemaDiff.computeDiffForReal call shown in the stack trace. Reproduce the comparison using an external reference such as ../../common/restapi-sdk-data-schemas.yaml#/components/schemas/ApiError and establish the expected handling for that reference without raising Invalid ref.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.