fluent-json-schema - how to make POST body required in openapi schema

Viewed 185

Using fastify and fluent-json-schema

I'm trying to figure out how to make a POST route body required in the openapi schema output

const postSomethingSchema = S.object()
  .prop("fieldA", S.string())

export const postSchema = {
  operationId: "createSomething",
  body: postSomethingSchema,
  response: { 200: somethingSchema },
};

Today, this generates the following, (without the required key I'm looking for of course)

"post": {
  "operationId": "createSomething",
    "requestBody": {
      "required": true, // I can't figure out how to get this!
      "content": {...}
0 Answers
Related