Prerequisites
Fastify version
5.2.1
Plugin version
9.4.0
Node.js version
22.9.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Unknown
Description
This was previously reported in #190 but was marked as stale and closed. I'd like to reopen it.
Basically, the issue is if you make a field that has multiple types, e.g.:
"collectionName": {
"type": ["null", "string"]
}
You get "Unknown Type: null,string"

I think this has something to do with the underlying swagger implementation using OpenAPI 3.0+ which introduced nullable: true for defining nullable types.
In my case, I'm actually using zod-to-json-schema which outputs the schema (by default) in jsonSchema7 format.
Link to code that reproduces the bug
#190
Expected Behavior
json schema types with multiple values, including nulls, should generate the correct swagger docs.
Prerequisites
Fastify version
5.2.1
Plugin version
9.4.0
Node.js version
22.9.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
Unknown
Description
This was previously reported in #190 but was marked as stale and closed. I'd like to reopen it.
Basically, the issue is if you make a field that has multiple types, e.g.:
You get "Unknown Type: null,string"
I think this has something to do with the underlying swagger implementation using OpenAPI 3.0+ which introduced
nullable: truefor defining nullable types.In my case, I'm actually using zod-to-json-schema which outputs the schema (by default) in
jsonSchema7format.Link to code that reproduces the bug
#190
Expected Behavior
json schema types with multiple values, including nulls, should generate the correct swagger docs.