Stedi

Enable payload validation for transformed JSON documents in Mappings APIMarch 15, 2023


Stedi Mappings let you transform JSON documents from one structure to another. By default, the Mappings API does not apply any payload validation on the /map endpoint.
Now, you can enable Strict validation mode to validate the input and the output payload of the mapping operation. Validation helps you ensure that the mapping results are accurate and catch deviations from expected results early.
To apply strict validation, set the validation_mode query parameter to strict. Mappings uses the source schema to validate the input document and the target schema to validate the outgoing document.
If validation of the input or output payload fails, the response is a 400 error with the validation_failed code and validation_errors object.
HTTP/1.1 400
Content-Type: application/json

{
  "code": "validation_failed",
  "message": "The input of the mapping does not conform to the specified source JSON Schema, and the output of the mapping does not conform to the specified target JSON Schema.",
  "validation_errors": {
    "source": {
      "mapping_input": {
        "quantity": 15,
        "unit_price": 2.50
      },
      "errors": [
        {
          "code": "required",
          "message": "must have required property 'unit_description'",
          "json_pointer": "/",
          "json_schema_pointer": "#/required"
        }
      ]
    },
    "target": {
      "mapping_output": {
        "total": 37.50
      },
      "errors": [
        {
          "code": "type",
          "message": "must be integer",
          "json_pointer": "/total",
          "json_schema_pointer": "#/properties/total/type"
        }
      ]
    }
  }
}
Stedi

Build EDI integrations fast, without being an EDI expert

Start building
About
ProductPricingDocumentationChangelog
Follow
  1. Twitter
  2. GitHub
Backed by
AdditionBloomberg BetaFirst RoundStripeUSV
Customer AgreementService TermsPrivacy Notice

Stedi is a registered trademark of Stedi, Inc. All names, logos, and brands of third parties listed on our site are trademarks of their respective owners (including “X12”, which is a trademark of X12 Incorporated). Stedi, Inc. and its products and services are not endorsed by, sponsored by, or affiliated with these third parties. Our use of these names, logos, and brands is for identification purposes only, and does not imply any such endorsement, sponsorship, or affiliation.