GraphQL - Using same field names in different types within union

后端 未结 2 1876
悲哀的现实
悲哀的现实 2021-01-02 00:09

If I have a union type like this:

union AllOnboardingQuestionTypes = StepFinal | TimeRangesQuestion | PercentQuestion | SingleSelectQuestion | MultiSelectQu         


        
2条回答
  •  失恋的感觉
    2021-01-02 01:03

    I had the same problem and find three different solutions to it:

    1. Using Interface
    2. Using Union
    3. Using a String with additional type information

    All not very nice but working. I put a simple example project with all solutions on Github: https://github.com/chnoack/apollo-dynamic-types-example

提交回复
热议问题