Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: data type check unsupported Ptr and Interface #112

Closed
wants to merge 1 commit into from

Conversation

Cluas
Copy link
Contributor

@Cluas Cluas commented Nov 11, 2021

We currently have some scenarios where we construct map[string]interface{} directly and then call jsonschema.Validate , which avoids a json.Marshal operation, but I found that the DataType detection, when encountering a Pointer or Interface of nil, has Here it returns "unknown", when I would expect it to return "null".

@Cluas
Copy link
Contributor Author

Cluas commented Nov 12, 2021

@b5 can you help review the code?

@Arqu
Copy link
Contributor

Arqu commented Nov 18, 2021

A pointer is not a structure that should be evaluated or validated against as it's not really representable in JSON (it's either an array or object that needs to be serialized and validated on itself and it's children), and type null/nil is not it's data type here.

Whatever those map[string]interface{} contain should either not be part of the validation process or you should wrap it up in a struct or at least type alias it and implement it as a keyword with it's validation and registration mechanics.

@Arqu Arqu closed this Nov 18, 2021
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.

2 participants