invopop / invopop/jsonschema

support "type": ["object", "null"]

Open
#115 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
952
Forks
136
PR merge metrics
No merged PRs in 30d

Description

I need to set "type": ["object", "null"] in my json schema, but haven't found a way to do this. Is there a way?

For now I use Reflect and then set .Type = "[object, null]" and then when the schema is done I do a replace all.. it works, but is a little hacky

Contributor guide

No contributing guide indexed for this repository

Research direction

No file or test is named. Start by tracing how the Go generator represents and emits the JSON Schema type from reflected fields, then compare that path with the reported Reflect workaround. Done means a schema can express "type": ["object", "null"] without a post-generation replacement, with coverage for the generated output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.