Skip to content

Add input validation with Pydantic models #3

@sweetlife999

Description

@sweetlife999

Improve your FastAPI app by creating a new POST endpoint /echo that accepts a JSON object with a message field, and returns the same message back. Use a Pydantic model for input validation. Return an error if the message is missing or not a string.

Steps:

  • Create a Pydantic model for input data.
  • Add POST /echo endpoint using that model.
  • Return input as JSON or an error message for invalid input.

Label this issue as 'good first issue'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions