2

I'm just learning GraphQL, but I'm confused with GraphQL schema. I have a GraphQL schema which has a string array data type

My GraphQL Schema like this:

type GetRecommender {
    resourceId: Int!
    title: String
    description: String
    content: [Content]
    tags: [Tags]
    suggestTitle: [SuggestTitle]
    input: [Input]
}

type SuggestTitle {
    input: [Input]
}

type Input {
    hello: String
}

type Content {
    hello: String
}

type Tags {
    hello: String
}

But the expected result like this:

[
  {
    resourceType: 10,
    resourceId: 102698,
    title: 'Course 1 December',
    description: 'Test',
    content: [ 'Fresh' ],
    tags: [ '2D Test Items', 'Mobile Apps' ],
    suggestTitle: { input: [Array] }
  },
  {
    resourceType: 10,
    resourceId: 102536,
    title: 'Course 3 December',
    description: 'Test',
    content: [ 'Fresh' ],
    tags: [ '2D Test Items', 'Mobile Apps' ],
    suggestTitle: { input: [Array] }
  },
]

How to write a right schema to show content, tags and suggestTitle ?

Kholid Saifulloh
  • 191
  • 1
  • 1
  • 5
  • 3
    `content` and `tags` can just be `[String!]`. For `suggestTitle`, it is unclear what "Array" is. array of what? – Joseph D. Jan 17 '22 at 15:44

0 Answers0