Mateusz
Explore posts from serversAarktype
•Created by Mateusz on 4/7/2025 in #questions
Why ArkType when providing JSON Schema returns nulls as "{"const": null}"?
Hi,
I want to generate OpenApi 3.0 from Arktype schema, in order to do so, first step in the pipeline is to convert to json schema using built-in
toJSONSchema
. Problem being that mentioned built-in function returns nulls
from schema in a bit weird format with "const: null" and for example further when I'm using tools to generate openapi it just doesn't work correctly. That wouldn't be that big of a deal if not for types generation from openapi, where all those nulls
are treaded as unknowns
. I've tested both @hey-api/openapi-ts
and openapi-typescript
to generate types and both don't recognize it as null
. For converting from json-schema to openapi I'm using openapi-json-schema
. I would be very thanful if you could help me resolve that.4 replies