Anand Garlapati
Anand Garlapati

Reputation: 11

How to convert my custom json to swagger 2.0 json

I'm new to swagger documentation. We have an existing project developed in progress language for RESTFul Web Services. The different resource based urls consumes and produces in application/json format. The input and output json formats for one of our resource url is given below:

Request:

{
    "request": {
      "companyNumber": 5000,
      "operatorInit": "sys",
      "operatorPassword": "",
      "customerNumber": 101,
      "shipTo": "",
      "warehouse": "01",
      "productCode": "2-001",
      "crossReferenceFlag": false,
      "retrieveFlag": false,
      "tInbinlocation": {
        "t-inbinlocation": [
          {
            "binloc": "",
            "icswbinloc1fl": false,
            "icswbinloc2fl": false,
            "addrecordfl": false,
            "deleterecordfl": false,
            "charuser": "",
            "user1": "",
            "user2": "",
            "user3": "",
            "user4": "",
            "user5": "",
            "user6": 0,
            "user7": 0,
            "user8": null,
            "user9": null
          }
        ]
      },
      "tInfieldvalue": {
        "t-infieldvalue": [
          {
            "level": "",
            "lineno": 0,
            "seqno": 0,
            "fieldname": "",
            "fieldvalue": ""
          }
        ]
      }
    }
}

Response:

{
  "response": {
    "cErrorMessage": "",
    "crossReferenceProduct": "2-001",
    "crossReferenceType": "",
    "tOutbinlocation": {
      "t-outbinlocation": []
    },
    "tOutfieldvalue": {
      "t-outfieldvalue": []
    }
  }
}

How to convert above request and response json formats into swagger 2.0 json format?

Thanks!

Upvotes: 1

Views: 3337

Answers (1)

Tony Vincent
Tony Vincent

Reputation: 14272

Try using api-spec-converter.
this tool supports converting API descriptions between popular formats.

  Supported formats:
    * swagger_1
    * swagger_2
    * api_blueprint
    * io_docs
    * google
    * raml
    * wadl

Upvotes: 1

Related Questions