Closed TomashKhamlai closed 5 years ago
Should the parameter really be required?
Seems like row 64 should be if (isset($addressInput['country_code'])) {
instead of having country_code
required. This is my guess because how the other code handing parameter country_code
looks like.
I'll create a pull request for the fix the requested way and change if it should be optional.
@hAmpzter, yes country_code
should be always required.
Please look at this
Any field marked with an :asterisk: is required. But be careful, some of the fields are not always required and depends on Magento configuration. Most of the time developers should believe the schema which has the information about required and not required fields. Required fields are marked with an exclamation sign.
input CartAddressInput {
firstname: String!
lastname: String!
company: String
street: [String!]!
city: String!
region: String
postcode: String
country_code: String!
telephone: String!
save_in_address_book: Boolean
}
In the image, you see that postcode is required, but it is not required for all countries and can be configured as not required field for any country.
Hi @TomashKhamlai. The schema looks following:
input CartAddressInput {
firstname: String!
lastname: String!
company: String
street: [String!]!
city: String!
region: String
postcode: String
country_code: String!
telephone: String!
save_in_address_book: Boolean
}
country_code
is required input parameter and the case that validation does not properly happening shows that it is a framework bug. Such validation should not happen in resolvers and such test cases are redundant.
Closing this PR since the framework bug is assigned to the internal team.
Preconditions (*)
Steps to reproduce (*)
country_code
parameterExpected result (*)
Required parameter "country_code" is missing
Actual result (*)