complex object types which are both output and input
See original GitHub issuecurrently I have this in my app:
@ObjectType()
export class OrganisationFeatures extends ConstructorAssigner {
@Field() campaigns: boolean
@Field() custom_email_sender_address: boolean
@Field() OKTA_SAML: boolean
@Field() search_analytics: boolean
@Field() SCORM: boolean
@Field() custom_font: boolean
}
@InputObjectType()
export class OrganisationFeaturesInput extends ConstructorAssigner {
@InputField() campaigns: boolean
@InputField() custom_email_sender_address: boolean
@InputField() OKTA_SAML: boolean
@InputField() search_analytics: boolean
@InputField() SCORM: boolean
@InputField() custom_font: boolean
}
I’d love to be able to define both at once doing:
@DuplexObjectType() // using a special type I can register both at once
export class OrganisationFeatures extends ConstructorAssigner {
@Field() campaigns: boolean
@Field() custom_email_sender_address: boolean
@Field() OKTA_SAML: boolean
@Field() search_analytics: boolean
@Field() SCORM: boolean
@Field() custom_font: boolean
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Complex Input/Output Data - Micro Focus
Java Explorer supports complex data types such as arrays and objects as both input data and output data. The Output Value Wizard assists...
Read more >Can you make a graphql type both an input and output type?
For this reason, input objects have a separate type in the system. An Input Object defines a set of input fields; the input...
Read more >Mutations and Input Types - GraphQL
Input types can't have fields that are other objects, only basic scalar types, list types, and other input types. Naming input types with...
Read more >How Computers Work: Input and Output
Input and output may sometimes be separated by time or distance or both. Here are some examples: Factory workers input data by punching...
Read more >Input and Output - Computer Terminology
Input and Output Devices ... Before a computer can process your data, you need some method to input the data into the machine....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Recursive field = User has Dog > Dog has owner User > owner User has Dog > Dog has owner user etc… Recursive = Circular and it’s not possible to reflect it in input field.
Thanks for your PR.
I think that maybe another type may not be even needed. What about auto-converting it when
@ObjectType
is used as input typeon the fly
?So we could do
and ten simply use it as argument type
That would feel more intuitive than having another type.
It would be good to check if given
ObjectType
isinputable
eg. it does not have any recurrsive fields etc.I’ll think about it as I don’t want to make
typegql
'frameworkish`.If that could be accomplished with reasonable api, then actually I stop seeing point of even having
InputType
at all. We could just validate types of arguments for if they’re able to be input.