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

  3. 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
        }
      ]
    }
  1. Errors in response thrown by GraphQL service.

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)

@magento-cicd2
Copy link
Contributor

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


ranosys seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.

@ghost
Copy link

ghost commented Jan 31, 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.

2 participants