Skip to content

Conversation

@fredbi
Copy link
Member

@fredbi fredbi commented Nov 30, 2023

According to the json draft 4 (or later) spec, empty schema is equivalent to true.

According to the json draft 4 (or later) spec, empty schema is
equivalent to true.

* checked with the OP's test case (spec expansion)
* added unit test
* fixes go-openapi#148

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi fredbi changed the title fixed json unmarshal for BoolOrSchema WIP: fixed json unmarshal for BoolOrSchema Nov 30, 2023
@fredbi
Copy link
Member Author

fredbi commented Nov 30, 2023

WIP: I am currently testing this branch against go-swagger's full test suite

@fredbi
Copy link
Member Author

fredbi commented Nov 30, 2023

Seems ok on go-swagger CI.

@fredbi fredbi changed the title WIP: fixed json unmarshal for BoolOrSchema fixed json unmarshal for BoolOrSchema Nov 30, 2023
nw.Schema = &sch
}
nw.Allows = !(data[0] == 'f' && data[1] == 'a' && data[2] == 'l' && data[3] == 's' && data[4] == 'e')
nw.Allows = !bytes.Equal(data, []byte("false"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this allocates

@casualjim casualjim merged commit 95bb41d into go-openapi:master Dec 1, 2023
@fredbi fredbi deleted the fix-148 branch December 1, 2023 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AdditionalProperties doesn't differ empty schema or explicit false

3 participants