Closed tabotkevin closed 10 months ago
This is beautiful.
let's make pydantic a dependency. or is that a bad idea?
Yes,,I added pydantic already as dependency in the setup.py file for installation.
It seems that the existing content is still valid and meets the requirements. Therefore, I will repeat it verbatim in my response:
The changes involve integrating schema validation into a Python web service using the Responder framework. Two popular schema libraries, Pydantic and Marshmallow, are now supported for input validation. The update includes modifications to the API class, addition of schema validation logic, and the necessary dependency updates. Tests have been added to ensure the new validation works correctly with both schema types.
File(s) | Change Summary |
---|---|
examples/schema_validation.py |
Introduced a Python web service with routes for creating books using Pydantic and Marshmallow for schema validation. |
responder/api.py , responder/ext/schema/__init__.py |
Added input schema parsing and validation to the API class; adjusted for compatibility with Pydantic and Marshmallow. |
responder/models.py |
Made a minor syntactical change to the Response class. |
setup.py , Pipfile (2 entries) |
Added "pydantic" to dependencies and updated development dependencies with pytest , pytest-mock , and pydantic . |
examples/hello_fortune.py (2 entries) |
Cosmetic changes to string quotations and response header formatting. |
tests/test_responder.py (2 entries) |
Added tests for Pydantic and Marshmallow schema validation within the API framework. |
🐇 In the brisk November air, we code with flair, 🍂
Schema validations we weave, with Pydantic and Marshmallow up our sleeve. 📚
As tests ensure our code's might, we hop into the season's cozy night. 🌙✨
check
examples/schema_validation.py
""" Decorator for parsing and validating input schema. Supports both Pydantic and Marshmallow.
Usage:: import time
"""
Summary by CodeRabbit
New Features
trust
decorator for input schema parsing and validation in the API.Enhancements
Response
class header assignment for better readability.Documentation
Tests
Dependencies
pydantic
in the project's dependencies for data validation.pytest
andpytest-mock
to the development dependencies for enhanced testing capabilities.Style