Skip to content

Commit 27032aa

Browse files
Add tests for custom type nillability
1 parent 1825b0e commit 27032aa

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed

tests/data/schemaExtensions/nillable/nillability.go

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"type": "object",
4+
"properties": {
5+
"name": {
6+
"type": "string",
7+
"goJSONSchema": {
8+
"nillable": true,
9+
"type": "map[bool]string"
10+
}
11+
}
12+
}
13+
}

tests/data/schemaExtensions/nonNillable/nillability.go

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"type": "object",
4+
"properties": {
5+
"name": {
6+
"type": "string",
7+
"goJSONSchema": {
8+
"nillable": false,
9+
"type": "map[bool]string"
10+
}
11+
}
12+
}
13+
}

tests/generation_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ func TestRegressions(t *testing.T) {
185185
testExamples(t, basicConfig, "./data/regressions")
186186
}
187187

188+
func TestSchemaExtensions(t *testing.T) {
189+
t.Parallel()
190+
191+
testExamples(t, basicConfig, "./data/schemaExtensions")
192+
}
193+
188194
func testExampleFile(t *testing.T, cfg generator.Config, fileName string) {
189195
t.Helper()
190196

0 commit comments

Comments
 (0)