Support external file $ref resolution#59
Merged
cubahno merged 5 commits intodoordash-oss:mainfrom Mar 23, 2026
Merged
Conversation
Set BasePath on libopenapi's DocumentConfiguration to enable resolution of relative file references (e.g. './common.yaml#/components/schemas/Address'). The CLI auto-detects BasePath from the spec file's directory. Library consumers can set it via the new Configuration.BasePath field. Closes doordash-oss#58
cubahno
reviewed
Mar 23, 2026
Collaborator
cubahno
left a comment
There was a problem hiding this comment.
Please update documentation and json-schema file as well.
- Make LoadDocumentFromContents backwards-compatible with variadic basePath - Validate and normalize BasePath to absolute path - Error out (not silently ignore) if filepath.Abs fails in CLI - Improve test assertions: check error message content, add OverwriteWith tests - Revert unnecessary changes to existing test call sites
- Move TestExternalFileRefResolution to codegen_test.go - Move TestBasePathOverwriteWith to configuration_test.go - Remove standalone external_ref_test.go
- Add base-path property to configuration-schema.json - Document base-path in docs/configuration.md with usage example - Mention external file $ref support in README.md features list
Contributor
Author
|
Done — latest commit adds:
|
cubahno
reviewed
Mar 23, 2026
Collaborator
you can try to checkout this repo, then run maybe integration test has to be adjusted. thats what i see: |
cubahno
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BasePathon libopenapi'sDocumentConfigurationto enable resolution of relative file$refreferences (e.g.$ref: './common.yaml#/components/schemas/Address')BasePathfrom the spec file's parent directory; library consumers can set it via the newConfiguration.BasePathfield (base-pathin YAML config)Test plan
TestExternalFileRefResolutionwith 3 subtests: fails without BasePath, succeeds with BasePath, end-to-end code generationgo test ./...)$refto external filesCloses #58