Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oneOf input types #442

Open
laurencepettitt opened this issue Sep 20, 2023 · 1 comment
Open

oneOf input types #442

laurencepettitt opened this issue Sep 20, 2023 · 1 comment

Comments

@laurencepettitt
Copy link

laurencepettitt commented Sep 20, 2023

Description

The RFC for oneOf input types is nearing completion and is in the phase of gathering feedback from libraries and users

graphql-js and HotChocolate already have implemented this feature based on the RFC.

Repro steps

N/A

Expected behavior

I imagine that an F# discriminated union, like this

type Cat = { Name: string; Meows: bool }
type Dog = { Name: string; Barks: bool }
type Pet = 
    | DogPet of Dog
    | CatPet of Cat

could be mapped to a GraphQL oneOf input type, like this

input Cat {
    name: String
    meows: Boolean
}
input Dog {
    name: String
    barks: Boolean
}
input Pet @oneOf {
    dogPet: Dog
    catPet: Cat
}

Actual behavior

oneOf input type not supported.

Known workarounds

Essentially none.

Related information

N/A

@laurencepettitt laurencepettitt changed the title anyOf input types oneOf input types Sep 21, 2023
@xperiandri
Copy link
Collaborator

Yep, this is doable. Would you like to help?
I suppose we need #380 to be merged and on top of it we can add oneOf

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

No branches or pull requests

2 participants