Comments (4)
Could be useful. Though, could you explain what are the required propreties in outputs for ? The idea of required properties for outputs is strange isn't ?
Mean while you can disable the rule https://github.com/zallek/swagger-diff#configure-specific-rules
from swagger-diff.
Now there is only rule, named "add-required-object-property".
It makes sense to impose this rule on input parameters:
adding a required property on an input object, breaks the api because older clients will not provide this property.
However, in our opinion, it does not make sense to impose this rule on an output parameter:
adding a property (even a required one) on an output object, does not break the api;
older clients just ignore this property in deserializing and do not care about the new property.
What is your opinion?
In our opinion, there are 2 solutions:
- do not impose this rule on output parameters
- split the "add-required-object-property" rule into 2:
"add-required-object-property-on-input-parameter" and
"add-required-object-property-on-output-parameter"
which can both be set to mimic the current behavior.
from swagger-diff.
If you take a stand on this, I'm willing to create a PullRequest to implement it.
Koen
from swagger-diff.
Sorry @koenj @stevenhabex for the delay answer.
I understand the problem.
2 rules are inconvenient for output object required property:
- add-required-object-property
- edit-object-property-required (the name isn't so good, it's for object properties which became required. If you have a better idea to name this rule I'm taking it).
Though I'm agree it could be nice to separate input from outputs.
The problem is that currently for objects in definitions we don't know if there are used as input or output. This rule can be easily implemented for objects in parameters inlined but not so much the parameters which linked to a definition.
Example:
One solution would be to dereference internals references. The problem with that is that it duplicates the definition everywhere it's being used. So if 2 different operations are using the same definition which changes. It creates 2 duplicate diffs. That's why currently definitions are deferenced.
Another solution could be to recursively tag definitions used as input (by just adding _usedAsInput: true
on definitions). It would require to loop on all input paramters, tag referenced definitions and their sub definitions (If a definition reference an other definition). With this tag we could easily in the rule test if it's used as input).
PS: If you want to work on a PR for that, I would be with pleasure :)
from swagger-diff.
Related Issues (20)
- Regarding a Slight CHange in Output HOT 2
- Add / Delete Method rules HOT 1
- unmatched diff section HOT 2
- Use npm dependency instead op github link HOT 7
- Add a bunch of new rules HOT 1
- CLI tool should return a non-zero code when there's a diff HOT 2
- Add XML output format to support CI test summary HOT 1
- make successful CLI execution silent
- All differences are detected only when info.version is equal for compared documents
- Is this project still alive? HOT 9
- it there any html render to output differences
- Adding open source license
- not a valid JSON Schema?
- The current version of `lodash.*` needs to be updated to avoid security audit warnings HOT 1
- Is there a way to get 'method' in 'add-path' rule
- Support for OpenAPI3
- update dependency on json-schema-ref-parser to avoid EOL phantomjs in dependency tree
- Make it browser compatible HOT 2
- Add integration test
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-diff.