google / google/jsonschema-go

validating structs directly doesn't work

Open
#23 8 comments 0 reactions 1 assignee Claimed by @jba View on GitHub
P1 Small
Dominant language
Go
Stars
478
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Validation attempts to work on Go structs directly. But I think this is doomed:
- We would need to interpret some `json` struct tags (see #22)
- Worse, we need to somehow understand custom marshalers (types that implement `json.Marshaler`).

I believe the only general solution is to marshal the struct to JSON before validating.

I think we can still validate non-structs directly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.