-
Beta Was this translation helpful? Give feedback.
Answered by
vearutop
Mar 9, 2023
Replies: 1 comment 1 reply
-
Not sure if I understand the problem, but this is how you can read this value var s openapi3.ParameterOrRef
// .....
if s.Parameter != nil && s.Parameter.Example != nil {
ex := *s.Parameter.Example
// If you expect an integer value in example, you'd need to unbox it from
// float64 which is used in JSON for all numbers.
if n, ok := ex.(float64); ok {
i := int(n)
fmt.Printf("I'm an example value: %d!\n", i)
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mcred
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure if I understand the problem, but this is how you can read this value