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

No ability to serlialize null input fields #383

Open
tbartley opened this issue Feb 21, 2022 · 0 comments
Open

No ability to serlialize null input fields #383

tbartley opened this issue Feb 21, 2022 · 0 comments
Labels
feature-request Request a new feature

Comments

@tbartley
Copy link

Describe the bug
When a nullable input field is explicitly set to null, the null value should be propagated to the API to enable the semantic difference between an explicit null value and an omitted value to be communicated.

To Reproduce
Consider schema:

type ObjectWithNullable {
  id: ID!
  nullable: String
}

input InputWithNullable {
  id: ID!
  nullable: String
}

type Mutation {
  update(input: InputWithNullables!): ObjectWithNullable! # Return value is immaterial
}

and graphql document:

mutation update($input: InputWithNullable!) {
  update(input: $input) {
    nullable
  }
}

Expected behavior

In the generated code, when I invoke update with input and set nullable to null, the Input.fromNullable correctly returns an Input with value null and defined true however the null value is not serialised in to the request body by JsonWriter in AppSyncOfflineMutationManager.httpRequestBody - fix would seem to be to set JsonWriter.serializeNulls to true after construction.

Screenshots
N/A

Environment(please complete the following information):

  • AppSync SDK Version: 3.1.1

Device Information (please complete the following information):

  • Device: Simulator
  • Android Version: 29
  • Specific to simulators: No

Additional context

@div5yesh div5yesh added the bug Something isn't working label Mar 3, 2023
@tjleing tjleing added feature-request Request a new feature and removed bug Something isn't working labels Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

3 participants