Validate JSON response against SWAGGER document

validation
json

#1

Simply,

I have a swagger document for a web-service, I want to validate that the response from the service (JSON) matches the format defined by the SWAGGER doc.

I have found myriad ways of testing to make sure the swagger is valid, and for testing against a JSON Schema, but next to nothing on validating data against the swagger doc.

Thanks in advance
Gary


#2

Have you tried the validation features in https://github.com/xerions/phoenix_swagger? Perhaps the test response validator could be of use?


#3

Thanks, will look there!


#4

Which version of swagger are you using?

open_api_spex is a bit like phoenix swagger but targets swagger (open api) 3.0.

It doesn’t support reading the swagger document from file yet, so might not be what you’re looking for.


#5

Thanks will look at that too.

I did come up with a hybrid solution, I found a python app which extract the schema from the swagger and then used ExJsonSchema to validate, works great on my mac, unfortunately not so well on a windows PC for work, I believe it’s the difference in file paths i.e. ‘’ vs ‘/’.

Anyway thanks of the info, I will go read up on it.

Gary