Skip to content

Conversation

@ctreatma
Copy link
Contributor

This updates the RefPointer class to return the full $ref value for references that are not under #/components/ instead of throwing an IllegalArgumentException. This change enables openapi-diff to run successfully against specs that use any valid $ref format rather than prescribing one specific approach to defining references.

Fixes #810

@ctreatma ctreatma force-pushed the remove-ref-validation branch from 5025731 to 996db4e Compare December 17, 2025 16:47
@ctreatma ctreatma force-pushed the remove-ref-validation branch from 996db4e to c4e1108 Compare December 18, 2025 18:32
@DrSatyr DrSatyr self-requested a review December 31, 2025 17:29
final String baseRef = getBaseRefForType(refType.getName());
if (!ref.startsWith(baseRef)) {
throw new IllegalArgumentException("Invalid ref: " + ref);
// If the ref doesn't point to something in #/components,
Copy link
Collaborator

@DrSatyr DrSatyr Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, looks like just removing this validation would not work well. getRefName method is used by resolveRef method. Under the hood it searches referenced objects only in components section and does not consider remote files. So we need to think here about full support of the remote refs, instead of just removing the validation.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants