Schema validation using Postman [duplicate]

2019-08-02 20:15发布

问题:

This question already has an answer here:

  • How to validate response in Postman? 1 answer

My response looks like this as below:-

{
    "Header": {
        "MessageId": "11",
        "From": "user1 (user2@domain1.org)",
        "To": ["user2 (user1@domain2.org)"],
        "Cc": [],
        "Bcc": [],
        "Subject": "FW: Send a mail with normal text file base64 encoded",
        "BodyText": "Me to Me concept super",,
        "Direction": 2,
        "SystemDateTime": "2004-10-10T10:55:03.487",
        "InstanceId": "tecf32af-db97-49eb-a3e3-73952c923401",
        "HasAttachment": false
    },
    "Attachments": []
}

I want to know how to validate the schema of my response using the postman tool

回答1:

Use tv4 available in the Postman sandbox to do schema validation of the JSON response. Read more at Postman Tip 4.

If you do not have a JSON Schema defined for your response, you can write one by hand, or generate one based on the response you have using one of the many tools available online to generate JSON schemas.



标签: postman