Fine-grained nullish inference
- Dominant language
- Go
- Stars
- 478
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I want to control whether a slice field is nullable or not. `JSONSCHEMAGODEBUG` environment variable might help but I still feel inconvenient:
- Not build-time configuration
- It can cause mismatch between dev and prod
- Less configurable
- It is all or nothing. Can't control for each schema.
**Describe the solution you'd like**
```go
// Approach 1: tag
type A struct {
Things []int `jsonschemanull:"false"`
}
// Approach 2: option
For[MyType](&ForOption{
Null: true, // we should consider more understandable name
})
```
**Describe alternatives you've considered**
N/A
**Additional context**
I want to utilze it to generate schema and pass it to a library. But the library we use doesn't support `["null", "array"]` as of now.
Contributor guide
Assessment
This issue has not been assessed yet.