Coder Social home page Coder Social logo

sayi / swagger-diff Goto Github PK

View Code? Open in Web Editor NEW
272.0 14.0 85.0 457 KB

:ski: Compare two swagger API specifications(1.x or v2.0)

Home Page: http://deepoove.com/swagger-diff/

License: Apache License 2.0

Java 95.38% CSS 4.14% HTML 0.47%
swagger diff compare swagger-diff

swagger-diff's People

Contributors

jlamaille avatar sayi avatar sturman avatar syngu00 avatar tipsy avatar viclovsky avatar wwerner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swagger-diff's Issues

Provide swagger-diff as standalone tool

Hi
Could you publish this amazing library as standalone tool to make it much more easier to use? This tool should accept parameters such as OldSpecification, NewSpecification, RenderingMode, OutputFile.

OpenAPI v3 support

Hi there!

Do you have a plans to support v3 format specs?

Regards,
Serhii

Missing return type diff

In some cases return type differences are not reported

For example (see attached file) : property "liste" was deleted and property "donneeReference" was added to "rubrique" definition but no difference is being reported by the tool
CDS.zip

Add support for vendor extensions

Thank you for everything you've done on this library, it's awesome. I'm currently using it in a project uses vendor extensions, and while it seems that vendor extensions aren't currently supported by swagger-diff, I currently have a local implementation that supports vendor extensions in all of the Swagger 2.0 supported locations.

It's a sizable change, due to the fact that vendor extensions can be found in so many places throughout swagger specifications, and the rendering has to be modified as well to fit this. If you think there's a better way to do this, or have strong opinions on whether/how it should be exposed, I'd love any suggestions.

maybe a mistake

com.deepoove.swagger.diff.compare.ModelDiff#diff(io.swagger.models.Model, io.swagger.models.Model, java.lang.String, java.util.Set<io.swagger.models.Model>)

left maybe a mistake

  • Model rightSubModel = findModel(left, newDedinitions);

License type

Hello,

What's the license of this library?

Regards
Ofer

Infinite recursion for comparing models

If model contains $ref like that

"definitions": {
"Pet": {
      "type": "object",
      "properties": {
        "parent_pet": {
          "$ref": "#/definitions/Pet"
        },

you get infinite recursion for models compare.

Stacktrace:

java.lang.OutOfMemoryError: Java heap space
at com.deepoove.swagger.diff.compare.ModelDiff.diff(ModelDiff.java:65)

Example:
infinite_recursion.txt

Contract testing

Are you using swagger-diff for contract testing? or just to generate the diff report?

SLF4J runtime error for swagger-diff v1.2.1

Hi. With new v1.2.1 I am getting this error/warning in runtime:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

This is my Java environment:

java 10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)

Array of Object Response Changes Not Detected

For example, if in petstore_v2_1.json and petstore_v2_2.json you change lines ~723 and ~722 respectively from
"schema": { "$ref": "#/definitions/User" }
to
"schema": { "type" : "array", "items" : { "$ref" : "#/definitions/User" } }
it will no longer detect that there was a change, even though it previously was caught (GET /user/{username}) when it was only a single object being returned. This is pretty important if you only return a certain object type from an endpoint as an array.

Add support for compare by JsonNode

Thank you for the great work on this library. I have a use case where I have a jsonNode containing the swagger contents (and not a URI or a file). I'd prefer not to have to write this data to a file just to use this tool.

I have a local implementation that adds a compareV2Json static method to SwaggerDiff that looks a lot like compareV2 and calls a new associated private constructor. If you have strong feelings about the method name, I'm happy to adjust.

swagger-parser already has a read(JsonNode) method.

If there's a simpler way to achieve this that doesn't require a code change, I'd appreciate a pointer.

Thanks!

Missing Dependencies(Maven)

Looks like maven is missing the version of jcommander you are using.

Maven Central

Worked around this by excluding the jcommander dependency and depending on the latest version 1.72

Runtime incompatibility - NoSuchMethodError

The following line of code results in NoSuchMethodError:-
com.deepoove.swagger.diff.compare.ParameterDiff

    private Property mapToProperty(Parameter rightPara) {
        Property prop = new StringProperty();
        prop.setAccess(rightPara.getAccess());
        prop.setAllowEmptyValue(rightPara.getAllowEmptyValue());
        prop.setDescription(rightPara.getDescription());
        prop.setName(rightPara.getName());
        prop.setReadOnly(rightPara.isReadOnly());
        prop.setRequired(rightPara.getRequired());
        return prop;
    }

The offending call is rightPara.getAllowEmptyValue() where rightPara is of type io.swagger.models.parameters.Parameter, imported from io.swagger:swagger-models. I have trawled the versions of that module and cannot find one that is compatible (i.e. has the method getAllowEmptyValue()). Help please!!
Other than this, I'm really loving this tool! :)

Missing response diff

Hi, nice tool.

The tool never detects response changes. For example return code 401 disappeared in favor of 400 and the difference wasn't reported.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.