laravel-openapi icon indicating copy to clipboard operation
laravel-openapi copied to clipboard

`null` as an example of nullable field

Open zlodes opened this issue 3 years ago • 0 comments

If I try to set null as an example of some field, it will be ignored.

Example:

Schema::string('foo')
    ->nullable()
    ->example(null),

It will look like this:

"foo": {
    "type": "string",
    "nullable": true
},

But expected:

"foo": {
    "type": "string",
    "nullable": true,
    "example": null
},

It will be correctly rendered using SwaggerUI or Redoc.

image

zlodes avatar Feb 08 '22 14:02 zlodes