Repository navigation
Report path, webhook, callback, method and AsyncAPI names that are not strings as schema errors - #5250
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3a465c9bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
Merging this PR will degrade performance by 20.14%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…t strings as schema errors A YAML key such as `1` loads as a number. Such a key crashed with a TypeError or AttributeError as a path (the `paths` and `api` scopes), as a webhook name (the `webhooks` scope, and the `api` scope when a model is named from it), as a callback name or callback expression and as an `additionalOperations` method (the `api` scope), and in AsyncAPI as any name on the way to a schema (component, channel, operation, message, parameter or binding names) or in an AsyncAPI message that names the location below such a key. These runs now stop with "Error at schema path '<doc>#/paths/1': path 1 is not a string" (webhook name, callback name, callback expression or method; in AsyncAPI "name" at the schema the key leads to), like a numeric component name, or with the AsyncAPI message. Runs that never build a name or path from such a key, such as an `api` scope webhook without operations or named by --use-operation-id-as-name, keep their output. Fixes: #5222
f3a465c to
6e34f6f
Compare
Breaking Change AnalysisResult: No breaking changes detected Reasoning: The PR makes the OpenAPI and AsyncAPI parsers raise clear SchemaParseError messages when a YAML key that should be a string loads as some other value, such as an integer key 1. This covers path keys, webhook names, callback names, callback expressions, additionalOperations method keys, AsyncAPI channel names and AsyncAPI component schema names. It also fixes AsyncAPI path-to-string conversion so that error messages can be built when a path part is not a string. These inputs break the specs, which require string keys. Before this PR they most likely crashed with an unhandled exception, for example calling startswith on an int or redacting or joining a path that holds an int. The new check for webhook-name and method keys is skipped when use_operation_id_as_name is set, so cases where an integer key does not affect model naming keep working. The private helper _component_name was renamed to _key_name and split out into _key_error; these are internal methods, not public API. No CLI options, defaults, templates, generated output for valid inputs, or Python version support changed. Most of the diff is new malformed test fixtures and error-message tests. Overall this improves error handling for bad input and does not break existing users. This analysis was produced by the release draft workflow |
Fixes: #5222
Summary by CodeRabbit