oneOf input types

Open
#442 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
fsharp, graphql

Research direction

Start by reviewing the linked GraphQL oneOf RFC and the existing F# input-object and discriminated-union mapping entry points. Compare the current schema-generation behavior with the Cat, Dog, and Pet examples in the issue. Done means oneOf input types are supported according to the RFC and covered by the project's relevant tests.

Written by the indexing model from the issue text.

Description

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

Dominant language
F#
Stars
406
Forks
74
Avg merge
1d 8h
Merged PRs (30d)
14

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fsprojects/FSharp.Data.GraphQL

All issues in fsprojects/FSharp.Data.GraphQL

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.