You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How do i provide examples for a schema properly here? I think i scanned all documentation i could find, and am still clueless..
I'm using a fork of a-h/rest here, but this is definitely an issue thrown by kin-openapi3, which is why i can't provide a full reproduction of the issue right now. Maybe you can help me nonetheless? Like is there a thorough example of how to use schema examples anywhere, Not having any type information here makes this really hard to grasp. Only way to suppress these warnings is disabling example validation, which is not really satisfying.
If necessary i can try to build a full example to reproduce the problem in the next days.
Thanks for your work!
The text was updated successfully, but these errors were encountered:
I was able to figure out how this works, so for those who might be interested:
Schema.Example expects either a single primitive type value s.Example = true, s.Example = "foO", s.Example = 1, ..., a slice of type any, or a map[string|any]any and is not capable of handling structs directly or any other datatype not defined in here.
For the examples above this means:
// The type that the schema's properties are based ontypeFoostruct {
Barbool`json:"bar"`
}
...ex:=map[string]any{"bar": true}
schema.Example=ex
I think it would make a lot of sense to extend the examples or docs to contain an example for this. Generally, allowing to use structs here could also be beneficial imho.
Hey folks,
I'm trying to wrap my head around how schema examples work in kin and am encountering issues no matter how i approach it..
For example, If i try to pass an instance of the underlying object:
i get
If i try to pass an instance of
openapi3.Example
:i get
How do i provide examples for a schema properly here? I think i scanned all documentation i could find, and am still clueless..
I'm using a fork of a-h/rest here, but this is definitely an issue thrown by kin-openapi3, which is why i can't provide a full reproduction of the issue right now. Maybe you can help me nonetheless? Like is there a thorough example of how to use schema examples anywhere, Not having any type information here makes this really hard to grasp. Only way to suppress these warnings is disabling example validation, which is not really satisfying.
If necessary i can try to build a full example to reproduce the problem in the next days.
Thanks for your work!
The text was updated successfully, but these errors were encountered: