-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
nullable reference: hard to properly identify it #283
Comments
The problem here is that currently the library will swap out everything in the node if there is a |
I'm getting the reference yaml node with Here is my current workaround // https://github.com/pb33f/libopenapi/issues/283
func isNullableReference(node *yaml.Node) bool {
if node == nil || node.Content == nil {
return false
}
for i, c := range node.Content {
if c.Value == "nullable" {
if i+1 < len(node.Content) && node.Content[i+1].Value == "true" {
return true
}
}
}
return false
} call |
Just an FYI, you can use https://github.com/pb33f/libopenapi/blob/main/utils/utils.go#L260 |
Thanks for the help :) |
First, Thanks for your great project!
It's hard to handle properly
nullable
on reference definition in a schemahere is a schema example snippet with
labels
nullable property reference:For me, at the moment, I can only identify
nullable
through*base.SchemaProxy
withGetReferenceNode()
, and extract it from the native YAML.From
*base.Schema
get from labels property*base.SchemaProxy
withSchema()
, the variable nullable is nil since it's pointing to the original reference schema.Do you have a better solution to my issue, did I miss something? Or maybe it's something missing in the library?
Thank you
The text was updated successfully, but these errors were encountered: