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
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
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
Last Post!
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 ![]()
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









