Question: how to make property non-required in GraphQl schema #5139
Replies: 8 comments
-
I know I can change method name to |
Beta Was this translation helpful? Give feedback.
-
You can use serialization groups to "hide" methods or properties: |
Beta Was this translation helpful? Give feedback.
-
@alanpoulain thanks for an answer. |
Beta Was this translation helpful? Give feedback.
-
I think you have to make the parameter of the method nullable then. Either: |
Beta Was this translation helpful? Give feedback.
-
@alanpoulain, I tried both - doesn't work. Field is still mandatory. Yes, if I will not use one of special words "get", "add", "has", "is" , the method will not be recognized like a virtual property and schema builder just skip it. But I think you answered my question - I have a few ways how to avoid this problem and I know that I didnt miss something. Hope this will be enough for me. Thanks! |
Beta Was this translation helpful? Give feedback.
-
But anyway may be this will be good if schema builder will respect method's annotations and parameters. |
Beta Was this translation helpful? Give feedback.
-
I don't think it's an issue with the schema builder. Maybe with the property metadata factory. |
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Beta Was this translation helpful? Give feedback.
-
Hello!
I have an entity with method like
addToLogs(LogEntity $logEntity)
.Schema builder recognizes it like a property
toLogs
and makes it mandatory. How to solve this issue properly?Thanks.
Beta Was this translation helpful? Give feedback.
All reactions