Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vendor extensions #16

Closed
wants to merge 18 commits into from
Closed

Conversation

egoodhall
Copy link
Contributor

@egoodhall egoodhall commented Jul 29, 2018

This PR adds vendor extension support to swagger-diff. To enable the vendor extensions, you can use the same methods as normal (compareV1/compareV2), with a 3rd argument (boolean) that will enable vendor extensions if true. The original API still exists, so there shouldn't be any issues with backwards compatibility

Vendor extensions are shown in the rendered Markdown and HTML just like any other changed value, as can be seen below in the partial diff rendering (vendor extensions start with x-):


  • info
    • Add x-create-info-ext
    • Delete x-remove-info-ext
    • x-change-info-ext: change me! → i was changed!
  • securityDefinitions
    • petstore_auth
      • Add x-create-security-ext
      • Delete x-remove-security-ext
      • x-change-security-ext: change me! → i was changed!
  • tags
    • pet
      • Add x-create-tags-ext
      • Delete x-remove-tags-ext
      • x-change-tags-ext: change me! → i was changed!
  • /pet
    • Add x-create-path-ext
    • Delete x-remove-path-ext
    • x-change-path-ext: change me! → i was changed!
  • POST /pet Add a new pet to the store
    • Add x-create-method-ext
    • Delete x-remove-method-ext
    • x-change-method-ext: change me! → i was changed!
    • Parameters
      • Add tags //add new query param demo
      • Add body.newFeild //a feild demo by sayi
      • Add body.category.newCatFeild
      • body:
        • Add x-create-param-ext
        • Delete x-remove-param-ext
        • x-change-param-ext: change me! → i was changed!
      • Delete body.category.name
    • Responses:
      • 405
        • Add x-create-response-ext
        • Delete x-remove-response-ext
        • x-change-response-ext: change me! → i was changed!

This PR addresses #15.

@coveralls
Copy link

coveralls commented Jul 29, 2018

Pull Request Test Coverage Report for Build 55

  • 371 of 387 (95.87%) changed or added relevant lines in 11 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+1.05%) to 92.717%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main/java/com/deepoove/swagger/diff/compare/SpecificationDiff.java 25 27 92.59%
src/main/java/com/deepoove/swagger/diff/SwaggerDiff.java 7 10 70.0%
src/main/java/com/deepoove/swagger/diff/model/ChangedOperation.java 9 13 69.23%
src/main/java/com/deepoove/swagger/diff/output/MarkdownRender.java 132 139 94.96%
Files with Coverage Reduction New Missed Lines %
src/main/java/com/deepoove/swagger/diff/output/MarkdownRender.java 1 96.6%
Totals Coverage Status
Change from base Build 47: 1.05%
Covered Lines: 942
Relevant Lines: 1016

💛 - Coveralls

Eric Marshall added 7 commits July 31, 2018 13:51
By default, vendor extensions are now disabled
in SpecificationDiff.diff, and also in the
methods that were previously exposed by
SwaggerDiff. To allow for running the diff with
vendor extensions enabled, each of the exposed
compare methods (compareV1, compareV2) has been
overloaded to add a boolean third argument,
`withExtensions`, that will override the default
without breaking the previous API
- The SpecificationDiff can now hold its own vendor extension groups,
  as well as diff for any root-level vendor extensions that are found
- Adds support in HTML and markdown rendering for the above additions
- The diffing of extensions is now handled by an internal class in the
  SpecificationDiff, which handles enabling/disabling them more sane.
- Fix a bug in the HTML rendering
@egoodhall egoodhall closed this Dec 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants