cukes icon indicating copy to clipboard operation
cukes copied to clipboard

JSON Scheme validation steps

Open AlexeyBuzdin opened this issue 9 years ago • 3 comments

AlexeyBuzdin avatar Jan 27 '16 11:01 AlexeyBuzdin

REST API response validation using JSON Schemas would allow to validate the correctness of a whole JSON response. Some benefits I see:

  • that it has a correct structure (no syntax errors)
  • that the property values are of correct type - string, integer, object etc.
  • that values (e.g. integers) fall into expected data range
  • this would prevent repeatability of test steps in case if multiple REST API endpoints or items in JSON response share the same basic structure. In that case this would had to be defined only in one single place - using a single JSON schema.
  • level of validation can differ depending on whether just that the structure needs to be validated (that there are no syntax errors and value validation can be done using the already implemented/supported RestAssured methods) or each and every value

An example of a Java lib that would allow this validation. https://github.com/everit-org/json-schema

JekabsK avatar Jan 27 '16 11:01 JekabsK

REST-assured features Scheme Validation: http://www.jayway.com/2013/12/10/json-schema-validation-with-rest-assured/ ; Need to adopt the same API in cukes-rest

AlexeyBuzdin avatar Feb 22 '16 10:02 AlexeyBuzdin

I also want Jsonpath & jsonSchema validation in cukes-rest framework

itsgauravjain22 avatar Jan 26 '17 17:01 itsgauravjain22