Repository navigation
fix: describe reads the configured API endpoint - #24
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Without endpoint overrides, an explicit BRAINPOD_OPENAPI_URL now unnecessarily triggers config loading, causing describe resource … to fail when configuration is unreadable or malformed.
1 open issue
What changed in this PR
This PR makes resource descriptions use the configured API endpoint, aligning schema discovery with other CLI commands while keeping it token-free.
Changes:
- Shares endpoint resolution with precedence: flag → environment → config → default.
- Adds unit coverage for precedence and skipping config loading when an environment override is supplied.
- Documents endpoint selection and the OpenAPI URL override.
| File | Description |
|---|---|
src/main.rs |
Adds shared endpoint resolution, uses it for resource descriptions, and tests precedence. |
README.md |
Documents schema URL resolution and token-free access. |
Review effort: Balanced
Comment on lines
+108
to
+113
| let endpoint = api_endpoint( | ||
| opts.endpoint.clone(), | ||
| environment("BRAINPOD_API_ENDPOINT"), | ||
| || Ok(Config::load(&Config::path()?)?.endpoint), | ||
| )?; | ||
| let resource_description = openapi::describe(&args.command, Some(&endpoint)).await?; |
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.

brainpod describe resource …only passed--endpointto the OpenAPI fetch. It ignoredBRAINPOD_API_ENDPOINTand the configured endpoint, so agent runners pointed at a local or test installation were described with production's schema (OpenAPI: https://api.brainpod.io/v1/openapi.json).api_endpoint(flag →BRAINPOD_API_ENDPOINT→ config endpoint → default), shared by describe and the other commands. Describe loads the config only when neither the flag nor the env var is set, and it still needs no token.BRAINPOD_OPENAPI_URLstill takes precedence.