radarlabs / api-diff Goto Github PK
View Code? Open in Web Editor NEWA command line tool for diffing json rest APIs
License: Apache License 2.0
A command line tool for diffing json rest APIs
License: Apache License 2.0
My application supports requests with bulk parameter support, so for ex, URL is like /foo?id=1&id=3&id=5, its converting the same to /foo?id[]=1&id[]=3&id[]=5
how to handle this to avoid brackets getting added
If I do this currently:
api-diff \
--old.host https://api.mywebsite.com/api/v1/ \
--new.host https://api.mywebsite.com/api/v2/ \
--endpoint /myendpoint \
--method POST \
--input_params input_params.txt \
--output_mode html > output.html
Everything after .com
gets stripped, which means it's not possible to test different versions of API on the same host.
This seems to only happen when I put "http" or "https" in the host urls.
In my API the response contains an absolute URL. For example:
{
"url": "https://staging.example.com/api/node/1"
}
and
{
"url": "https://example.com/api/node/1"
}
Running the following command
api-diff \
--new.host staging.example.com \
--old.host example.com \
--input_queries queries.txt \
--output_mode html \
-o report.html
Will tell me that there is a difference in API response. But as you can see the difference only occurs in the hostname. The reset /api/node/1
is the same.
Is there any flag to ignore host and ignore the occurrence of hostname in API response?
HI
Thanks for this tool . I almost got it to work but the compare with baseline won't do it.
These 2 Commands ARE working, so I'm pretty sure the config.hjson is correct ..
API_DIFF_CONFIG=config.hjson api-diff \
--old.dev \
--old.key NOOONNNNNNNNOOO=\
--new.dev \
--new.key NOOONNNNNNNNOOO=\
--input_queries sqmsII.txt
API_DIFF_CONFIG=config.hjson api-diff generate-baseline \
--old.dev \
--old.key NOOONNNNNNNNOOO=\
--input_queries sqmsII.txt \
> addresses-baseline.json
But both of these commands give me an error
API_DIFF_CONFIG=config.hjson api-diff \
--new.dev \
--new.key NOOONNNNNNNNOOO=\
--input_json_baseline addresses-baseline.json
PROCESS FAILED
Could not find host via arguments specified {
"extra_params": [],
"key_type": "test"
}
API_DIFF_CONFIG=config.hjson api-diff \
--new.host https://XXX.bpmspace.net \
--new.key NOOONNNNNNNNOOO=\
--input_json_baseline addresses-baseline.json
PROCESS FAILED
Could not find host via arguments specified {
"extra_params": [],
"key_type": "test"
}
Also Without Config file I get an error (sliltly different)
api-diff \
--new.host https://XXX.bpmspace.net \
--new.key NOOONNNNNNNNOOO=\
--input_json_baseline addresses-baseline.json
PROCESS FAILED
Could not find host via arguments specified {
"extra_params": []
}
Can you please help me?
thanks rob
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.