📝 Test and document that default values for components are supported (#1494)
Currently we don't ever test or document that a code like this:
from dmr import Body, Controller
from dmr.plugins.pydantic import PydanticSerializer
class MyController(Controller[PydanticSerializer]):
def post(
self,
parsed_body: Body[dict[str, str] | None] = None,
) -> str:
print(parsed_body)
return 'done'
is even supported.
What is important here?
1. We must call the endpoint function as-is, without any work from our part. Defaults must be real python defaults. And work the same way
2. But, if there are default for
Body, we must issue required: false schema for the whole bodySnapshot test is required for this change.
#good_first_issue #help_wanted #opensource_september #django_modern_rest
sent via relator