-
Notifications
You must be signed in to change notification settings - Fork 60
LCORE-390: nits #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LCORE-390: nits #396
Conversation
WalkthroughAdds Pydantic Field metadata to AuthorizedResponse fields for schema/docs and updates unit tests to include TLS configuration in configuration serialization and validation. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tests/unit/models/test_config.py (1)
487-490: Optionally assert serialized types for robustnessYou already assert exact values; add lightweight type checks to guard against future regressions that might change serialization behavior (e.g., to dicts/objects).
Example snippet to add near the other assertions:
assert isinstance(content["service"]["tls_config"]["tls_certificate_path"], str) assert isinstance(content["service"]["tls_config"]["tls_key_path"], str) assert isinstance(content["service"]["tls_config"]["tls_key_password"], str)src/models/responses.py (1)
255-264: Field metadata added — consider minor schema refinementsLooks good and non-breaking. Two optional improvements:
- Prefer json_schema_extra for examples to avoid ambiguity and make intent explicit in Pydantic v2.
- Add basic constraints to username (e.g., min/max length). Optionally, enforce UUID format for user_id.
Apply this diff within the selected lines to switch to json_schema_extra and add username length constraints:
- user_id: str = Field( - ..., - description="User ID, for example UUID", - examples=["c5260aec-4d82-4370-9fdf-05cf908b3f16"], - ) - username: str = Field( - ..., - description="User name", - examples=["John Doe", "Adam Smith"], - ) + user_id: str = Field( + ..., + description="User ID, for example UUID", + json_schema_extra={"examples": ["c5260aec-4d82-4370-9fdf-05cf908b3f16"]}, + ) + username: str = Field( + ..., + description="User name", + min_length=1, + max_length=256, + json_schema_extra={"examples": ["John Doe", "Adam Smith"]}, + )If you want stronger typing for user_id, consider UUID (this also serializes to a string in JSON):
# at the top of the file from uuid import UUID # then change the field type user_id: UUID = Field( ..., description="User ID, for example UUID", json_schema_extra={"examples": ["c5260aec-4d82-4370-9fdf-05cf908b3f16"]}, )Also note there’s duplication between field-level examples and model_config examples; keeping only one source can avoid future drift.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/models/responses.py(2 hunks)tests/unit/models/test_config.py(3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/unit/models/test_config.py (1)
src/models/config.py (2)
ServiceConfiguration(99-119)TLSConfiguration(14-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: e2e_tests
🔇 Additional comments (3)
tests/unit/models/test_config.py (2)
230-244: TLS config propagation through ServiceConfiguration — LGTMGood addition. It validates that TLSConfiguration is embedded and preserved inside ServiceConfiguration as expected.
435-441: Include TLS in Configuration.dump fixture setup — LGTMThis ensures the dump path covers TLS serialization. Matches model types (FilePath -> string in JSON) and keeps the test realistic.
src/models/responses.py (1)
5-5: Import of Field for schema metadata — LGTMNecessary for field-level descriptions/examples.
Description
LCORE-390: nits
Type of change
Related Tickets & Documents
Summary by CodeRabbit