Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
candiduslynx committed Oct 6, 2023
1 parent 3689abc commit 21c0e4c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,19 @@ The resulting schema generated for this struct would look like:
}
}
```

### Nullability

Nullability in JSON schema is expressed via
[`oneOf`](https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.1.3) choice
between original schema & `{"type":"null"}`.

By default, only the struct fields that are explicitly annotated with `jsonschema:"nullable"` tag are marked nullable.
However, when setting `NullableFromType` to `true`, `jsonschema:"nullable"` is ignored &
the following Go reflect types are marked as nullable instead:

- `reflect.Pointer`
- `reflect.UnsafePointer`
- `reflect.Map`
- `reflect.Slice`
- `reflect.Interface`

0 comments on commit 21c0e4c

Please sign in to comment.