Skip to content

fix: set nullable when it's a pointer of Struct#101

Open
chuliang wants to merge 1 commit intowI2L:masterfrom
chuliang:fix/pointer-struct-nullable
Open

fix: set nullable when it's a pointer of Struct#101
chuliang wants to merge 1 commit intowI2L:masterfrom
chuliang:fix/pointer-struct-nullable

Conversation

@chuliang
Copy link

Not sure about it. Normally the schema can be used only one time with Tonic(?)

return g.buildSchemaRecursive(t)
case reflect.Struct:
return g.newSchemaFromStruct(t)
sor := g.newSchemaFromStruct(t)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already check if the type is "nullable" above when dereferencing the pointer. We could simply check if the schema pointed by the ref is non-nil and set the Nullable property accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants