afulki

afulki

Validate JSON response against SWAGGER document

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

Most Liked

aseigo

aseigo

Have you tried the validation features in GitHub - xerions/phoenix_swagger: Swagger integration to Phoenix framework · GitHub? Perhaps the test response validator could be of use?

mbuhot

mbuhot

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.

afulki

afulki

Thanks, will look there!

Last Post!

afulki

afulki

I didn’t find an easy solution, I wrote a small command line app in Elixir which executes the python script as a system call.This results in the swagger being split into a series of JSON Schema files, in a subdirectory, as I know the operation (passed in the command line) I also know which operation I’m testing. So I can open the appropriate JSON schema file and compare that against the response from the web-service.

I’m sorry I can’t share the source, it was written on the company time :slightly_frowning_face:

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New

We're in Beta

About us Mission Statement