Repository navigation
[BugFix] openbb-cli: Fix Detection of Sub-Routes of a Path - #7794
Merged
Merged
Conversation
dlee-bq
force-pushed
the
bugfix/cli-route-with-path
branch
from
October 11, 2026 20:16
c7a4dce to
833860f
Compare
deeleeramone
approved these changes
Oct 12, 2026
|
Run a thorough code review of OpenBB PR #7745.
Please:
- Show the files changed and explain the actual code diff.
- Verify that all four new SEC XBRL debt-tag spellings map to the correct balance-sheet fields.
- Inspect the tests and identify any missing coverage.
- Test edge cases involving missing values, zero values, duplicate tags, and conflicting values.
- Investigate the related issue involving total_operating_income being imputed as total_revenue. Determine whether this PR introduces, fixes, or leaves that issue unresolved.
- Check the current PR status and report the actual CI results, including failed, pending, skipped, or successful checks.
- Identify potential financial-data integrity risks for downstream AI agents.
- Recommend specific tests that would prevent these errors from silently affecting financial calculations.
Do not modify files, commit changes, approve the PR, or merge anything. This is a read-only review.
Return findings classified as Critical, High, Medium, Low, or Informational, with references to the relevant files and lines.
Finish with a recommendation: Safe to consider, Needs further testing, or Do not rely on it yet.
Sent from [Proton Mail](https://proton.me/mail/home) for iOS.
…-------- Original Message --------
On Sunday, 10/11/26 at 13:14 dlee-bq ***@***.***> wrote:
This PR fixes router generation for paths that are both a command and a namespace (e.g. /alerts plus /alerts/active), and bundles several other codegen fixes for the CLI's OpenAPI→provider pipeline.
An API you can use to test: https://api.weather.gov
Main fix
Sub-route detection: A path that is simultaneously a command (/alerts) and a namespace (/alerts/active) no longer gets shadowed — it now mounts on its own router instead of the parent's (router_gen.py). Added collision/cycle guards so two routers can never overwrite each other or import themselves (package_gen.py).
Response schema / row detection
New _response_shape logic decides list vs. map vs. single-row responses purely from the schema (handles JSON-LD ***@***.***(https://github.com/context), multiple arrays, scalar-array-as-field vs. rows-as-array).
oneOf/anyOf object variants are now merged into one row type (union of fields/enums, required only if universal) instead of just taking the first variant.
unpack_response can now take schema-derived hints (rows_key, kind) so runtime unpacking matches the generated model.
Excludes 4xx/5xx and bare default error responses from being picked as the row schema; respects a configured Accept header when selecting the response media type.
Non-textual responses (binary/PDF/etc.) are base64-encoded into a value field instead of being force-decoded as text.
Query parameters
Query parameter attribute names are now consistently snake_cased with the original wire name kept as the alias (query_field_name).
List/array query params gained wire-format support (multi, csv, space, pipe) derived from OpenAPI style/explode/collectionFormat, including detecting delimited lists from free-text parameter descriptions.
Lat/lon-style path parameters are no longer coerced to integer.
Headers
Non-credential headers passed via --header are now baked into generated fetchers/post-commands as fixed headers and stripped from the command's visible parameters; credential headers are left for the existing credential mapping.
Docstrings
Refactored docstring_generator.py's type-string formatting into standalone, bracket-aware helpers, fixing a bug where only the last class in a union type had its module path stripped (e.g. list[openbb_x.A | openbb_x.B]).
Misc
URL-to-command naming now drops path segments made only of placeholders (e.g. {x},{y}).
Includes corresponding test coverage across fetcher_gen, pydantic_gen, router_gen, package_gen, openapi_schema, spec, and docstring_generator.
---------------------------------------------------------------
You can view, comment on, or merge this pull request online at:
#7794
Commit Summary
- [7b7c6d5](7b7c6d5) fix detection of sub-routes of a path
File Changes
([18 files](https://github.com/openbq-org/OpenBB/pull/7794/files))
- M [cli/openbb_cli/cli.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-884fc864969d9cc2050e6a7dc31ba6f501a7321ff25271281dd35575997a0cba) (4)
- M [cli/openbb_cli/codegen/fetcher_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-c1c3fd2f6917d06b9c3ded171ac622cf48d4c0b66e839656b88ac87b2405553d) (420)
- M [cli/openbb_cli/codegen/package_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-e32f79e98c1a3e14c966d2c4df99d4e4e2eb791eb74d73451c5517607027d766) (59)
- M [cli/openbb_cli/codegen/post_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-ce2a1b0b0e24f0ed174fa86116730f45eca1885de7ec6c7b162cd008ceb1375a) (7)
- M [cli/openbb_cli/codegen/pydantic_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-cabb9e518ce1c55a92ba4771cbdaba0b10268016f4395a91736c3fd9e92a785d) (75)
- M [cli/openbb_cli/codegen/router_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-d1b4083ad20ae25d0af9d56ddf6a758fbca2ab61f78b4c0b8b256770bfbf0864) (43)
- M [cli/openbb_cli/dispatchers/_unpack.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-6f88bb557193ec63176184d7056bf0a6d02d40e3047b3c50a11a42d78123ea1b) (44)
- M [cli/openbb_cli/dispatchers/http.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-e34b413ce40c76b657922206db5af645c44b46846eba6ee7708daaf2aeeca53b) (14)
- M [cli/openbb_cli/dispatchers/openapi_schema.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-9ec93e053cb6d21bce014815727a9368d2a9bac677e45f2d95d755574ffdd951) (57)
- M [cli/openbb_cli/dispatchers/spec.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-26615946b09ee8cd736071ea05f67e4978c91979750815262d40a21c11b849c6) (129)
- M [cli/tests/test_codegen_fetcher_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-f963a7288ab590a21df87ef74625a79c276f285bfd958b0f27a35be153139c38) (283)
- M [cli/tests/test_codegen_package_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-5878e3afc5c0d3f4a475b06f43b013780d5fb84ebba52cce8359a7a94d31c789) (226)
- M [cli/tests/test_codegen_pydantic_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-0baa323ad9505255a99ebd6c9e8678c0ece6092753666df43a9081bd772a384f) (20)
- M [cli/tests/test_codegen_router_gen.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-b071cd098aec631ba294b45a09c63298e0d141f8bcd866cf1cd9bb1dca28f79c) (42)
- M [cli/tests/test_dispatchers_openapi_schema.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-e8f5e3dc4657ba3232365eba2fd065b749f40fd076de3d7c56fba8530cb1b9c3) (34)
- M [cli/tests/test_dispatchers_spec.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-5fa79e306c947d866bc34d9b808a307f8e9ffb833c9e4774bdfb82dc8ea5c9f1) (34)
- M [openbb_platform/core/openbb_core/app/static/package_builder/docstring_generator.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-036b5d18c846f75cc30a02235b04be6d7e9a5e382772f2428858c6ec9bbef085) (236)
- M [openbb_platform/core/tests/app/static/package_builder/test_docstring_generator_helpers.py](https://github.com/openbq-org/OpenBB/pull/7794/files#diff-e7bc2bc73de98f629ba0a28d1ee631c304ff7e1e1d264d17394e2216cae44c87) (75)
Patch Links:
- https://github.com/openbq-org/OpenBB/pull/7794.patch
- https://github.com/openbq-org/OpenBB/pull/7794.diff
—
Reply to this email directly, [view it on GitHub](#7794?email_source=notifications&email_token=CAIKT3FPYX2X2LQDYUVIDFT5TO5YDA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DQMRQHA2DONZVHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/CAIKT3H3VXHZG5P3Y77XMCT5TO5YDAVCNFSNUABFKJSXA33TNF2G64TZHMZTEMZQGQ4DOMBSHNEXG43VMU5TKOBQGMZTCMRVGY22C5QC).
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for [iOS](https://github.com/notifications/mobile/ios/CAIKT3EVW3MIF62PUJWJ24D5TO5YDA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DQMRQHA2DONZVHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM) and [Android](https://github.com/notifications/mobile/android/CAIKT3DJK7AHQK537URUQ4L5TO5YDA5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DQMRQHA2DONZVHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE). Download it today!
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
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.
This PR fixes router generation for paths that are both a command and a namespace (e.g. /alerts plus /alerts/active), and bundles several other codegen fixes for the CLI's OpenAPI→provider pipeline.
An API you can use to test: https://api.weather.gov
Main fix
Sub-route detection: A path that is simultaneously a command (/alerts) and a namespace (/alerts/active) no longer gets shadowed — it now mounts on its own router instead of the parent's (router_gen.py). Added collision/cycle guards so two routers can never overwrite each other or import themselves (package_gen.py).
Response schema / row detection
New _response_shape logic decides list vs. map vs. single-row responses purely from the schema (handles JSON-LD @context, multiple arrays, scalar-array-as-field vs. rows-as-array).
oneOf/anyOf object variants are now merged into one row type (union of fields/enums, required only if universal) instead of just taking the first variant.
unpack_response can now take schema-derived hints (rows_key, kind) so runtime unpacking matches the generated model.
Excludes 4xx/5xx and bare default error responses from being picked as the row schema; respects a configured Accept header when selecting the response media type.
Non-textual responses (binary/PDF/etc.) are base64-encoded into a value field instead of being force-decoded as text.
Query parameters
Query parameter attribute names are now consistently snake_cased with the original wire name kept as the alias (query_field_name).
List/array query params gained wire-format support (multi, csv, space, pipe) derived from OpenAPI style/explode/collectionFormat, including detecting delimited lists from free-text parameter descriptions.
Lat/lon-style path parameters are no longer coerced to integer.
Headers
Non-credential headers passed via --header are now baked into generated fetchers/post-commands as fixed headers and stripped from the command's visible parameters; credential headers are left for the existing credential mapping.
Docstrings
Refactored docstring_generator.py's type-string formatting into standalone, bracket-aware helpers, fixing a bug where only the last class in a union type had its module path stripped (e.g. list[openbb_x.A | openbb_x.B]).
Misc
URL-to-command naming now drops path segments made only of placeholders (e.g. {x},{y}).
Includes corresponding test coverage across fetcher_gen, pydantic_gen, router_gen, package_gen, openapi_schema, spec, and docstring_generator.