shipengine-openapi icon indicating copy to clipboard operation
shipengine-openapi copied to clipboard

Validate address endpoint violates the partial_address model validation

Open nmusco opened this issue 4 years ago • 0 comments

When calling the address validation endpoint it will sometimes respond with address_line2 of the matched address value set to an empty string instead of a null value. The partial_address model requires the address_line2 value be null or have a length > 0. This is causing issues with auto generated client libraries.

Rule:

        address_line2:
          type: string
          minLength: 1
          nullable: true
          example: Unit 408
          description: >
            The second line of the street address.  For some addresses, this
            line may not be needed.

Response:

[
  {
    "status": "verified",
    "original_address": {
      "name": "REDACTED",
      "phone": null,
      "company_name": null,
      "address_line1": "REDACTED",
      "address_line2": null,
      "address_line3": null,
      "city_locality": "REDACTED",
      "state_province": "REDACTED",
      "postal_code": "REDACTED",
      "country_code": "US",
      "address_residential_indicator": "unknown"
    },
    "matched_address": {
      "name": "REDACTED",
      "phone": null,
      "company_name": null,
      "address_line1": "REDACTED",
      "address_line2": "",
      "address_line3": null,
      "city_locality": "REDACTED",
      "state_province": "REDACTED",
      "postal_code": "REDACTED",
      "country_code": "US",
      "address_residential_indicator": "yes"
    },
    "messages": []
  }
]

nmusco avatar Dec 18 '20 17:12 nmusco