feat: add option to disable external reference resolution#1118
feat: add option to disable external reference resolution#1118AnshumohanAcharya wants to merge 1 commit intoasyncapi:masterfrom
Conversation
- Add resolveExternal option to ResolverOptions - Allow disabling external (http/https/file) reference resolution - Internal JSON pointer references still work when disabled - Defaults to true for backward compatibility Fixes: asyncapi#1098
|
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
|



Description
This PR introduces a new
resolveExternaloption to theResolverOptionsinterface that allows users to disable external reference resolution ($refpointing to http, https, or file URIs) while preserving internal JSON pointer reference resolution.Key Changes:
resolveExternal?: booleanproperty toResolverOptionsinterfacecreateResolver()function to conditionally include default resolvers (http, https, file) based on theresolveExternaloptionresolveExternalis set tofalse, external reference resolution is disabled#/components/messages/message) continue to work regardless of this settingresolveExternaldefaults totrue) for backward compatibilityUsage Examples:
Testing:
Added comprehensive test suite (
external-ref-disabled.spec.ts) that verifies:All existing tests pass (2470 tests), ensuring backward compatibility.
Related issue(s)
Fixes #1098