apiaryio / gavel2html Goto Github PK
View Code? Open in Web Editor NEWRenders HTML diff from Gavel.js output
License: MIT License
Renders HTML diff from Gavel.js output
License: MIT License
Consider diffing the following:
[
{
"id": 1,
"title": "Jogging in park"
},
{
"id": 2,
"title": "Pick-up posters from post-office"
}
]
The proxy server could not handle the request, because upstream API server is unknown (missing HOST section in API Blueprint). You can try using Mock server instead: http://mock-faf90individualprivatetest.apiary-mock.com/notes
See the distorted diff when viewing the Responsive diff in the console.
This library should get rewritten from scratch.
0.2.0-unstable.1
used by apiary.io works, but isn't in git, we do not have it's CoffeeScript code anywhere, npm contains only compiled JS.Update: The gavel2html
branch for 0.2.0-unstable.1
, which is used by apiary.io, has been recovered from @kuba-kubula's backup disk. It is now pushed to GitHub under kubula/customize_json_converter_html
branch name.
Consider I have the next specification toward my response body:
{
"username": "admin",
"notExistingProp": true
}
When the actual response body is:
{
"username": "admin",
"extraPropA": "...",
"extraPropB": "..."
}
I see both extraPropA
and extraPropB
as new added properties, but I don't see the notExistingProp
as red missing property.
Perhaps a logic flaw during the analyzis if a property is missing:
gavel2html/src/converter.coffee
Lines 137 to 144 in 99897d7
Sometimes gavel2html fails to render the diff for some reason. We're able to see this when using gavel2html internally in apiary.io, but we don't know (yet) what's the exact input to trigger this.
gavelhtml: Internal error.
[TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>:null:null)
at HeadersResultConverter._getLines (/app/node_modules/gavel2html/lib/headers-result-converter.js:27:37)
at HeadersResultConverter.getHtmlPrivate (/app/node_modules/gavel2html/lib/headers-result-converter.js:71:18)
at HeadersResultConverter.Converter.getHtml (/app/node_modules/gavel2html/lib/converter.js:46:17)
at Gavel2Html.getHtml (/app/node_modules/gavel2html/lib/gavel2html.js:61:26)
...
]
Whenever a body field is valid, even if an actual field has additional properties, those properties are not highlighted as added.
{
"expected": { "login": "admin" },
"actual": { "login": "joe", "newProp": true }
}
The newProp
property won't be shown as the added one (green).
Any property that is present in the actual HTTP message field (i.e. body, headers), but is not specified in the expected HTTP message field must be highlighted as the added one.
The README just isn't enough. I'm failing to understand how the library works. Issues:
data*
and gavelResult
options? What would be the output?usePointers
means? Current description is completely cryptic.gavelResult
have?wrapWith
startTag
endTag
missingStartTag
addedStartTag
changedStartTag
comments
commentStartTag
commentEndTag
identString
I would love to add the information, but unfortunately I'm not able to do so, because I don't understand the library myself. I would appreciate if @netmilk @kuba-kubula (as authors) or @XVincentX (as a recent user) could answer at least some of the questions. Feel free to add them as comment here, I'll gladly compile a nice README out of it later.
Actually this library is able to provide an output without gavel validation. Just matter of passing the right parameters. We should probably clarify what's going on here.
Related to apiaryio/dredd#705.
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.