Skip to content

Use this script to rewrite a Swagger document to match the endpoints on a server.

License

Notifications You must be signed in to change notification settings

3D-e-Chem/swagger-rewriter

Repository files navigation

Use this script to rewrite a Swagger document to match the endpoints on a server.

Used to correct Swagger docs generated by Django (django-rest-swagger Python package) so it can be used to generate a Java client using the swagger code generator.

As a bonus it will upgrade the Swagger Document to version 2.0.

Install

Download latest release from GitHub and unpack.

Usage

swagger-rewrite/bin/swagger-rewrite <input swagger location> <rewrites.yaml> <output swagger filename>

Supported rewrites

Response 2 array

When response is defined in Swagger as type object, but endpoint returns array of type object.

Rewrites is yaml file using

response2array:
- /services/proteinfamily/

For example in the default response of GET operation on /services/proteinfamily/ path of will change

"type": "ProteinFamilySerializer"

into

"type": "array", 
"items": {
    "type": "ProteinFamilySerializer"
}

Publish release

  1. Bump version in build.gradle file
  2. Commit & push
  3. Create a release on GitHub.
  4. Run ./gradlew distZip
  5. Upload build/distributions/*.zip to GitHub release page.

About

Use this script to rewrite a Swagger document to match the endpoints on a server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages