fastify / fastify-swagger-ui

Serve Swagger-UI for Fastify
MIT License
137 stars 40 forks source link

Makes all properties/params required, `required: []` option is ignored #159

Closed waveiron closed 2 weeks ago

waveiron commented 3 months ago

Prerequisites

Fastify version

^4.26.2

Plugin version

^4.0.0

Node.js version

20.14.0

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

14.5

Description

For example, in this schema, only "name" is required:

export const args = {
  required: ['name'],
  type: 'object',
  properties: {
    paths: {
      type: ['string', 'null'],
    },
    name: { type: 'string' },
    age: { type: 'number' },
  },
};

but ui requires all properties:

CleanShot 2024-07-04 at 15 35 50@2x

Link to code that reproduces the bug

No response

Expected Behavior

No response

mcollina commented 3 months ago

Thanks for reporting!

Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.

sceccotti89 commented 2 weeks ago

I don't think this is an issue, because those are path parameters and they are required by definition

Uzlopak commented 2 weeks ago

Closing it as there was no mvce provider.