Skip to content

Add defaut mapping to RequstBody #44

Description

@rafalkrupinski

The typical usage of RequestBody annotation is:

body: Annotated(RequestBodyType, RequestBody({'application/json': RequestBodyType}))

with a single key-value pair, where

  • RequestBodyType is a concrete, non-Union, possibly Optional, model type
  • the key is typically 'application/json'

These alternative shortcut forms could be allowed, to better support human authors:

body: Annotated(RequestBodyType, RequestBody())  # only accept 'application/json' and map the body to ResultType

body: Annotated(RequestBodyType, RequestBody('application/json'))  # only accept the given media type, and map to ResultType

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions