Skip to content

Allow object-aware external dereference component keys - #490

Closed
ayushshrivastv wants to merge 6 commits into
mattpolzin:mainfrom
ayushshrivastv:ExternalLoader.swift
Closed

ayushshrivastv wants to merge 6 commits into
mattpolzin:mainfrom
ayushshrivastv:ExternalLoader.swift

Conversation

@ayushshrivastv

Copy link
Copy Markdown
Contributor

Closes #438

Summary

  • add an object-aware ExternalLoader.componentKey overload in both OpenAPIKit variants
  • keep the URL-only key path as the compatibility fallback so loaders can implement either form
  • compute external reference component keys after loading so the decoded value can inform the key
  • add regression tests covering the object-aware override path and the default compatibility path

Testing

  • swift test --filter JSONReferenceTests
  • swift test --filter ExternalDereferencingDocumentTests

@mattpolzin

Copy link
Copy Markdown
Owner

Heads up, I had assigned the issue you are closing with this PR to myself to indicate that I was going to explore the issue (and had not decided what I think a solution should look like yet). I may look over this PR eventually and see if it happens to look just right, but there's a good chance I won't merge this branch. Sorry if the issue assignment was not a clear enough indicator that the issue was spoken for.

@ayushshrivastv

ayushshrivastv commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

@mattpolzin Thanks for letting me know.

@mattpolzin

Copy link
Copy Markdown
Owner

This was similar to the change I ultimately made, but I made the change against v7 and just went with a breaking change that swapped the type of object out for the object itself. I also didn't create any default fallbacks for component keys -- while I think that the strategy used in the unit tests is informative, I don't think it is useful enough to offer as a default.

@mattpolzin mattpolzin closed this Sep 8, 2026
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.

More informed external dereference component key function

2 participants