Repository navigation
fix: describe skips endpoint resolution when BRAINPOD_OPENAPI_URL is set - #25
Open
jeroenrinzema wants to merge 1 commit into
Open
jeroenrinzema wants to merge 1 commit into
jeroenrinzema wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the OpenAPI URL override and deferred endpoint-resolution changes.
No open issues 🎉
What changed in this PR
This follow-up to #24 lets resource schema discovery bypass endpoint resolution and configuration loading when BRAINPOD_OPENAPI_URL is set, preventing unrelated configuration errors from blocking describe.
Changes:
- Defers endpoint resolution until the OpenAPI URL override is checked.
- Removes the redundant production URL fallback while preserving the default endpoint behavior.
- Adds a regression test for resolver bypass and endpoint-derived URLs, and documents the bypass.
| File | Description |
|---|---|
| src/openapi.rs | Resolves endpoints lazily, removes the redundant fallback, and adds URL-resolution coverage. |
| src/main.rs | Passes endpoint and configuration lookup as a deferred resolver. |
| README.md | Clarifies that the document URL override bypasses endpoint and configuration lookup. |
Review effort: Balanced
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.
Follow-up to #24, addressing #24 (review).
#24 resolved the API endpoint (including loading the config file) before
openapi_urlcheckedBRAINPOD_OPENAPI_URL. With the override set and no--endpoint/BRAINPOD_API_ENDPOINT, a malformed or unreadable config — or no locatable config directory — madebrainpod describe resource …fail even though it needs no endpoint.openapi::describetakes an endpoint resolver that is only called whenBRAINPOD_OPENAPI_URLis unset, so the override is independent of config loading again.Noneendpoint branch andPRODUCTION_OPENAPI_URL;api_endpointalready defaults tohttps://api.brainpod.io, which yields the same URL.<endpoint>/v1/openapi.json.Verified:
cargo clippy --all-targets,cargo test openapi; withBRAINPOD_CONFIGpointing at invalid TOML,BRAINPOD_OPENAPI_URL=… brainpod describe resource app --jsonnow succeeds, while without the override it still reports the config parse error.