jsonschema: marshal to bools (#247)
Marshal the empty schema to true, and its negation to false. This is technically a breaking behavior change, but a properly written consumer of JSON Schema will not notice. For #244. Fixes #230.
This commit is contained in:
parent
bb9087d252
commit
c132621eb0
1 changed files with 18 additions and 7 deletions
|
|
@ -54,9 +54,9 @@ func TestJSONRoundTrip(t *testing.T) {
|
|||
for _, tt := range []struct {
|
||||
in, want string
|
||||
}{
|
||||
{`true`, `{}`}, // boolean schemas become object schemas
|
||||
{`false`, `{"not":{}}`},
|
||||
{`{"type":"", "enum":null}`, `{}`}, // empty fields are omitted
|
||||
{`true`, `true`},
|
||||
{`false`, `false`},
|
||||
{`{"type":"", "enum":null}`, `true`}, // empty fields are omitted
|
||||
{`{"minimum":1}`, `{"minimum":1}`},
|
||||
{`{"minimum":1.0}`, `{"minimum":1}`}, // floating-point integers lose their fractional part
|
||||
{`{"minLength":1.0}`, `{"minLength":1}`}, // some floats are unmarshaled into ints, but you can't tell
|
||||
|
|
|
|||
Loading…
Reference in a new issue