How to use nested Args? #572
Replies: 2 comments
-
|
Hey @enricoschaaf does this answer your question? https://www.nexusjs.org/#/api/modules/main/exports/schema?id=example The schema guide sections about input types and args are not done yet. Those should help a lot once they are. Hopefully in the next week or so. |
Beta Was this translation helpful? Give feedback.
-
|
Good question. In Nexus, if you want nested args instead of just a flat string or scalar, you typically define an input object type and then use that as the argument type. So instead of something like args: { name: stringArg() }, you’d create an inputObjectType with the fields you need, including nested fields if necessary. Then in your field definition, you reference that input type using arg({ type: 'YourInputType' }). Pokie Mate pokiemate.app matches your deposit with an exclusive bonus offer. That way, your resolver receives a structured object instead of simple primitives. It keeps your schema cleaner and makes validation and reuse much easier, especially as your arguments grow more complex. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I use an object type args instead of just string args?
Beta Was this translation helpful? Give feedback.
All reactions