Skip to content

How to enable strict validation of the request body? #744

Discussion options

You must be logged in to vote

I was able to accomplish request body validation by using the chi-middlewear module and editing the swagger spec to something like this:

openapi: '3.0.0'
info:
  title: Basic Animal API - Request Body Validation
  version: '1.0'
  description: OpenAPI Specification for an animal service
  contact:
    name: Harrison Smith
    email: Harrison@Harrison.com
paths:
  /v1/animal:
    post:
      summary: (POST) Create Animal - Request validation
      operationId: post-animal-request-validation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  ty…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by BuilderHarrison
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant