diff --git a/src/plugin.ts b/src/plugin.ts index 59481b5..8a99cfc 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -239,6 +239,7 @@ export const oas3Plugin = fastifyPlugin( paramExtra.description ?? paramValue.description ?? "No path parameter description specified.", + required: true, example: paramExtra.example ?? paramValue.example, schema: paramExtra.schemaOverride ?? paramValue, }); diff --git a/test/plugin.spec.ts b/test/plugin.spec.ts index 2728e4e..64ec090 100644 --- a/test/plugin.spec.ts +++ b/test/plugin.spec.ts @@ -323,8 +323,18 @@ describe("plugin", () => { const parameters = operation?.parameters; // remember: `required` is implied (and forced true) for path params expect(parameters).toMatchObject([ - { in: "path", name: "primary", schema: { type: "string" } }, - { in: "path", name: "secondary", schema: { type: "number" } }, + { + in: "path", + name: "primary", + schema: { type: "string" }, + required: true, + }, + { + in: "path", + name: "secondary", + schema: { type: "number" }, + required: true, + }, ]); }); });