Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Conversation

@RickyThakur
Copy link

@RickyThakur RickyThakur commented Jan 31, 2019

Description (*)

The exclamation point ( "!" , field value can not be null, required field ) missing from the customer's mutation input type object arguments for the input CustomerAddressInput .

  1. GraphQl uses '!' mark to promise that field can not return null value OR field is required
  2. In graphql-ce/app/code/Magento/CustomerGraphQl/etc/schema.graphqls the CustomerAddressInput has following required fields
city: String
country_id: CountryCodeEnum
firstname: String
lastname: String
street: [String]
telephone: String
  1. Error response for validation for CustomerAddressInputInput is being thrown by GraphQlInputException from resolver
"message": "Required parameters are missing: city, country_id, firstname, lastname, street, telephone",
 "category": "graphql-input",
  ......
  • There should be '!' sign after the datatype declaration according to GraphQl syntax.

city: String!
country_id: CountryCodeEnum!

Fixed Issues (if relevant)

  1. Fix for wrong coupon calculation. magento2#326: The exclamation point ( "!" , field value can not be null, required field ) missing from the customer's mutation input type object arguments for the input CustomerAddressInput

Manual testing scenarios (*)

Mutation for add customer address

mutation{
  createCustomerAddress(
  input: {
     /* intentionally did not provide the input fields to generate validation error */
    }
  ){
    city
    company
    country_id
    customer_id
    default_billing
    default_shipping
    fax
    firstname
    id
    lastname
    middlename
    postcode
    prefix
    region_id
    street
    suffix
    telephone
    vat_id
  }
}



Response

{
  "errors": [
    {
      "message": "Field CustomerAddressInput.city of required type String! was not provided.",
      "category": "graphql",
      "locations": [
        {
          "line": 8,
          "column": 10
        }
      ]
    },
    {
      "message": "Field CustomerAddressInput.country_id of required type CountryCodeEnum! was not provided.",
      "category": "graphql",
      "locations": [
        {
          "line": 8,
          "column": 10
        }
      ]
    },
    {
      "message": "Field CustomerAddressInput.firstname of required type String! was not provided.",
      "category": "graphql",
      "locations": [
        {
          "line": 8,
          "column": 10
        }
      ]
    },
    {
      "message": "Field CustomerAddressInput.lastname of required type String! was not provided.",
      "category": "graphql",
      "locations": [
        {
          "line": 8,
          "column": 10
        }
      ]
    },
    {
      "message": "Field CustomerAddressInput.street of required type [String]! was not provided.",
      "category": "graphql",
      "locations": [
        {
          "line": 8,
          "column": 10
        }
      ]
    },
    {
      "message": "Field CustomerAddressInput.telephone of required type String! was not provided.",
      "category": "graphql",
      "locations": [
        {
          "line": 8,
          "column": 10
        }
      ]
    }

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

deleteCustomerAddress(id: Int!): Boolean @resolver(class: "Magento\\CustomerGraphQl\\Model\\Resolver\\DeleteCustomerAddress") @doc(description: "Delete customer address")
}

input CustomerAddressInput {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This input type is used for createCustomerAddress as well as updateCustomerAddress where all these fields are not required.

@naydav
Copy link
Contributor

naydav commented Apr 2, 2019

Closed due to
#333 (review)

@naydav naydav closed this Apr 2, 2019
@ghost
Copy link

ghost commented Apr 2, 2019

Hi @RickyThakur, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants