kin-openapi
kin-openapi copied to clipboard
Please add validation for `nullable:false`
Current validator respect required, but not nullable.
They are different. A field that is not nullable is not necessarily required. See https://swagger.io/docs/specification/data-models/data-types/#null
Here is an example:
Mount:
type: object
properties:
id:
type: integer
readOnly: true
mount_point:
type: string
nullable: false
example: "/DATA"
fstype:
type: string
nullable: false
example: "fuse.mergerfs"
source:
type: string
nullable: false
example: "/mnt/a:/mnt/b"
options:
type: string
example: "defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M"
persist:
type: boolean
description: |-
`true` if the mount should be persisted in `/etc/fstab`, `false` otherwise
default: false
extended:
type: object
description: |-
Extended properties of the mount
additionalProperties:
type: string
example:
"mergerfs.srcmounts": "/mnt/a:/mnt/b"
With this OpenAPI spec, validator would still be OK with it even I pass something like
{
"mount_point": null
}