feat: Add --update-schema-for CLI option for single resource updates#2642
feat: Add --update-schema-for CLI option for single resource updates#2642
Conversation
Add new CLI option to update schema for individual resources without reprocessing all schema data. Includes: - README documentation for --update-schema-for option with examples - Refactored duplicate code into helper functions: - _fetch_openapi_v3_index: Fetches OpenAPI v3 paths index - _build_schema_data: Constructs schema data structure from API spec - _merge_schema_into_mapping: Merges schema into resource mapping - Improved code maintainability and reduced duplication
WalkthroughAdds a single-resource schema update flow via a new --update-schema-for CLI option; implements update_single_resource_schema and supporting helpers, centralizes ResourceNotFoundError, updates README, and adds tests validating the new behaviors. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
/verified |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@class_generator/tests/test_cli.py`:
- Around line 258-299: The test sets mock_update.side_effect to
ResourceNotFoundError but passes the message as the first positional arg (making
it the kind); change the instantiation to pass the kind keyword so the error is
constructed correctly, e.g. use ResourceNotFoundError(kind="FakeResource") in
test_update_schema_for_resource_not_found where mock_update and
update_single_resource_schema are patched.
In `@class_generator/tests/test_schema_new_functions.py`:
- Around line 1401-1419: The test function
test_update_single_resource_schema_new_resource currently accepts a mocked
SchemaValidator parameter named mock_schema_validator which is unused and
causing lint errors; rename that parameter to _mock_schema_validator to keep the
patch while silencing Ruff. Apply the same change to the other test function(s)
in this file that patch SchemaValidator (the block referenced around the later
test), renaming any unused mock_schema_validator parameters to
_mock_schema_validator so the patches remain but the names signal they are
intentionally unused.
- Fix ResourceNotFoundError instantiation to use kind keyword argument - Rename unused mock parameters to follow Python conventions (_mock_*)
|
/verified |
…nto LlamaStackDistribution-new
|
/verified |
This PR introduces the
--update-schema-forCLI option, which allows updating the schema for a specific resource kind without affecting other resources in the mapping. This is particularly useful when:LlamaStackDistribution)Short description:
More details:
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for reviewer:
Bug:
Summary by CodeRabbit
New Features
Documentation
Bug Fixes
Tests