Skip to content

[2.4.1] input null on collection will get a error graphql query #271

@jxnu-liguobin

Description

@jxnu-liguobin

Issue Description

Hi, i find a minor question in query string (maybe)
Describe your bug in detail.

Steps to Reproduce

invoke:

jobMutationService.submitSegmentUserExportJob("ExQWkgQ7", null, null, charset = "UTF-16LE")

query:

{"query":"mutation { submitSegmentUserExportJob(segmentId: \"ExQWkgQ7\", , , charset: \"UTF-16LE\"){ name error { code message __typename } id updater creator description stage creatorId createdAt updaterId updatedAt __typename } }"}

if use Collections.emptyList()

jobMutationService.submitSegmentUserExportJob("ExQWkgQ7", Collections.emptyList(), Collections.emptyList(), charset = "UTF-16LE")

query is

{"query":"mutation { submitSegmentUserExportJob(segmentId: \"ExQWkgQ7\", tags: [  ], properties: [  ], charset: \"UTF-16LE\"){ name error { code message __typename } id __typename stage description creatorId createdAt updaterId updatedAt creator updater } }"}

Expected Result

Explain in detail what behavior you expected to happen.

my schema:

submitSegmentUserExportJob(segmentId: HashId!, tags: [HashId!], properties: [String!], charset: String): SegmentUserExportJob!

In Java, collection is allowed to be given null. As a non mandatory field, can I use null or not?
I want there will be no extra commas like code blocksegmentId: \"ExQWkgQ7\", , , charset:
Of course, I'm not sure if there will be any other problems at the moment. I think it is probably the best to support option

Actual Result

Explain in detail what behavior actually happened.

Your Environment and Setup

  • graphql-java-codegen: E.g.: 2.4.1
  • Build tool: E.g.: Maven
  • Java tool: E.g.: Oracle 8u241
  • Mapping Config: E.g.:
<configuration>
    <outputDir>${project.build.directory}/generated-sources/graphql</outputDir>
    <packageName>io.github.kobylynskyi.graphql.model</packageName>
</configuration>

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions