Where do you set a struct's field value to its JSON Schema defined default? #461
Unanswered
lazharichir
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Say I have a struct defined as follows:
I want to use the
humaJSON Schema parsing to take an incomingmap[string]anyand convert it to an instance ofWordCounterV1Configwith the relevant default values as per the struct tags (if they aren't defined).This is used outside the API declaration and more for internal/domain stuff.
I'm trying to see how to do it via
humaashuma.Validate()doesn't mutate the input to add default values.Beta Was this translation helpful? Give feedback.
All reactions