Skip to content

validator does not produce requestBody.required: true #201

@ycmjason

Description

@ycmjason

👋

Thanks for the amazing library! It's really handy!

One thing I noticed is that requestBody.required is never set when using validator:

E.g.

validator('json', z.object({...}))

The above will generate a schema like the following:

{
  "requestBody": {
    "required": true, // <--- missing!!!!
    "content": {
      "application/json": // ...
    }
  }
}

I feel like required should only be omitted when the validator defines:

validator('json', z.object({...}).optional())

Big thank you again!

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions