How to view local JSON file in Swagger UI

18,176 views
Skip to first unread message

cml...@g.clemson.edu

unread,
Aug 6, 2015, 8:49:48 PM8/6/15
to Swagger
I wrote my Swagger documentation for my API in the Swagger editor and downloaded the JSON file, and would like to view this documentation in the Swagger UI.  I have tried 2 different approaches to this: 

The first being simply cloning the UI repo and placing my JSON file in the dist folder, then opening dist/index.html in a browser and searching for my file through the UI by searching "../my_swagger.json".  This returns a message "Please specify the protocol for file:///Users/user1/Desktop/swagger-ui-master/dist/index.html/../my_swagger.json".  Does this mean that my my_swagger.json file is incorrect?

The second method I tried was by customizing the dist/index.html file to point to my file, as shown below, however this just displays a blank UI page when I open index.html in a browser.  

I simply want to display the documentation I created in the editor in the UI, and I don't think my JSON file should have errors since I pulled it directly from the editor.  I also don't want to have to host my JSON file, as I'd like to simply read it from the local file just for demonstration purposes.  Any help would be greatly appreciated.
<script type="text/javascript">
    $(function () {
      var url = window.location.search.match(/url=([^&]+)/);
      var spec = "file:///Users/user1/Desktop/my_swagger.json";
      
      if (url && url.length > 1) {
        url = decodeURIComponent(url[1]);
      } else {
      }

      // Pre load translate...
      if(window.SwaggerTranslator) {
        window.SwaggerTranslator.translate();
      }
      window.swaggerUi = new SwaggerUi({
        url: url,
        spec: spec,
        dom_id: "swagger-ui-container",
        supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
        onComplete: function(swaggerApi, swaggerUi){
          if(typeof initOAuth == "function") {
            initOAuth({
              clientId: "your-client-id",
              clientSecret: "your-client-secret",
              realm: "your-realms",
              appName: "your-app-name", 
              scopeSeparator: ","
            });
          }

Ron Ratovsky

unread,
Aug 6, 2015, 9:08:02 PM8/6/15
to Swagger
That's not going to work.

Put the JSON itself as the value for the spec variable, and that would load it.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

cml...@g.clemson.edu

unread,
Aug 7, 2015, 1:23:28 PM8/7/15
to Swagger
Meaning literally copy and paste the JSON and put it as the value for spec?
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Aug 7, 2015, 1:23:52 PM8/7/15
to Swagger
Exactly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

cml...@g.clemson.edu

unread,
Aug 7, 2015, 1:48:10 PM8/7/15
to Swagger
I tried that but I still get a blank UI page.  Wouldn't the quotation marks from the JSON specs throw off the code's interpretation of the end string for the value of the variable?  Or is there a way to set the JSON code block to a variable?
Exactly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Aug 7, 2015, 1:50:35 PM8/7/15
to Swagger

You’re supposed to have something like:


var spec = { ... }

.
.
.

window.swaggerUi = new SwaggerUi({         
url: url,
  spec: spec, 
...

Exactly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

cml...@g.clemson.edu

unread,
Aug 7, 2015, 2:15:58 PM8/7/15
to Swagger
Does it all need to be on one line or something? That's the format I have my code in, it's just that my JSON file is something like 500 lines and I'm not sure if it's some formatting error within it causing a syntax error.  

If I were to clone a new version of the UI, set var spec to my full JSON code downloaded directly from the editor, and then save it and open index.html, the UI should display my documentation created in the editor, correct?  Sorry to keep bugging you, it's just tough to debug.
Exactly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Aug 7, 2015, 2:17:58 PM8/7/15
to Swagger

If I were to clone a new version of the UI, set var spec to my full JSON code downloaded directly from the editor, and then save it and open index.html, the UI should display my documentation created in the editor, correct?

That is correct, just also remember to pas it as a spec parameter to the SwaggerUi object as well.


Exactly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

cml...@g.clemson.edu

unread,
Aug 7, 2015, 2:32:48 PM8/7/15
to Swagger
I still get the same result.  Sorry to post this whole huge block of code, but this is what I have, and the UI shows up as it does in this screenshot.


<script type="text/javascript">
    $(function () {
      var url = window.location.search.match(/url=([^&]+)/);
      var spec = {
  "swagger" : “2.0”,
  "info" : {
    "description" : "This is a demo of ...\n",
    "version" : "1.0.0",
    "title" : "API Demo",
    "contact" : {
      "name" : "..."
    }
  },
  "host" : "server.com",
  "basePath" : "/lpapi/v1",
  "schemes" : [ "http" ],
  "paths" : {
    "/dashboard/{MSISDN}" : {
      "get" : {
        "tags" : [ "dashboard" ],
        "summary" : "Get dashboard",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "ok",
            "schema" : {
              "$ref" : "#/definitions/DashboardResponse"
            }
          }
        }
      }
    },
    "/device/status" : {
      "get" : {
        "tags" : [ "device" ],
        "summary" : "Get device status",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "EncryptedMSISDN",
          "in" : "query",
          "description" : "",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "ok"
          }
        }
      }
    },
    "/device/{MSISDN}/plan/cancel" : {
      "post" : {
        "tags" : [ "device" ],
        "summary" : "Cancel a plan",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "204" : {
            "description" : "ok, plan and subscription are canceled (no return)"
          }
        }
      }
    },
    "/device/{MSISDN}/plan/history" : {
      "post" : {
        "tags" : [ "device" ],
        "summary" : "Cancel plan",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "ok, returns plan histories",
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/definitions/PlanHistory"
              }
            }
          }
        }
      }
    },
    "/device/{MSISDN}/plan/restore" : {
      "post" : {
        "tags" : [ "device" ],
        "summary" : "Restore a plan",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "204" : {
            "description" : "ok, plan is restored (no return)"
          }
        }
      }
    },
    "/device/{MSISDN}/plan/suspend" : {
      "post" : {
        "tags" : [ "device" ],
        "summary" : "Suspend a plan",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "204" : {
            "description" : "ok, plan is suspended (no return)"
          }
        }
      }
    },
    "/device/{MSISDN}/sharedPlan" : {
      "post" : {
        "tags" : [ "device" ],
        "summary" : "Add to shared plan",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        }, {
          "in" : "body",
          "name" : "body",
          "description" : "BAN, billingMarket, billingSubMarket, termsAndConditions, datagroupId, offeringCode",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/SharedPlanBody"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "MSISDN not updated"
          }
        }
      }
    },
    "/device/{MSISDN}/trialPlan" : {
      "post" : {
        "tags" : [ "device" ],
        "summary" : "Activate trial plan",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "Accept-Language",
          "in" : "header",
          "description" : "see rfc 2616",
          "required" : true,
          "type" : "string"
        }, {
          "in" : "body",
          "name" : "body",
          "description" : "subscriber and terms and conditions",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/TrialPlanBody"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "new MSISDN is returned",
            "schema" : {
              "$ref" : "#/definitions/UpdatedMSISDNResponse"
            }
          },
          "204" : {
            "description" : "MSISDN not updated"
          }
        }
      }
    },
    "/device/{MSISDN}/validate" : {
      "get" : {
        "tags" : [ "device" ],
        "summary" : "Validate device",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "ok",
            "schema" : {
              "$ref" : "#/definitions/DeviceStatusResponse"
            }
          }
        }
      }
    },
    "/product/catalog" : {
      "put" : {
        "tags" : [ "product" ],
        "summary" : "Product catalog",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "MSISDN and userCountry",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/CatalogBody"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "ok",
            "schema" : {
              "$ref" : "#/definitions/CatalogResponse"
            }
          }
        }
      }
    },
    "/product/quote" : {
      "put" : {
        "tags" : [ "product" ],
        "summary" : "Product quote",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "MSISDN and userCountry",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/QuoteBody"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "ok",
            "schema" : {
              "$ref" : "#/definitions/QuoteResponse"
            }
          }
        }
      }
    },
    "/subscriber/{MSISDN}" : {
      "put" : {
        "tags" : [ "subscriber" ],
        "summary" : "Update subscriber",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        }, {
          "in" : "body",
          "name" : "body",
          "description" : "subscriber",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/Subscriber"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "new MSISDN is returned",
            "schema" : {
              "$ref" : "#/definitions/UpdatedMSISDNResponse"
            }
          },
          "204" : {
            "description" : "MSISDN not updated"
          }
        }
      }
    },
    "/subscription" : {
      "post" : {
        "tags" : [ "subscriber" ],
        "summary" : "Create subscription",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "ICCID, MSISDN, and nickname",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/SubscriptionBody"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "subscription is created"
          }
        }
      }
    },
    "/termsAndConditions" : {
      "get" : {
        "tags" : [ "common" ],
        "summary" : "Get terms and conditions",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "Accept-Language",
          "in" : "header",
          "description" : "see rfc 2616",
          "required" : true,
          "type" : "string"
        }, {
          "name" : "userCountry",
          "in" : "query",
          "description" : "ISO 3166-1 e.g. US",
          "required" : true,
          "type" : "string"
        } ],
        "responses" : {
          "200" : {
            "description" : "ok, returns terms and conditions and a JWT",
            "schema" : {
              "$ref" : "#/definitions/TermsAndConditionsResponse"
            }
          }
        }
      }
    },
    "/validateAddress" : {
      "put" : {
        "tags" : [ "common" ],
        "summary" : "Validate an address",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "an address element",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/Address"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "ok, returns list of matched addresses (if list size is 1 then perfect match)",
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/definitions/Address"
              }
            }
          },
          "422" : {
            "description" : "address is in northern territories of Canada"
          }
        }
      }
    },
    "/validateMobileAccount" : {
      "put" : {
        "tags" : [ "common" ],
        "summary" : "Validate a mobile account",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "in" : "body",
          "name" : "body",
          "description" : "MSISDN, SSN, billing account password, billing zip code",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/ValidateMobileAccountBody"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "ok",
            "schema" : {
              "$ref" : "#/definitions/ValidateMobileAccountResponse"
            }
          },
          "401" : {
            "description" : "user must create passcode"
          },
          "422" : {
            "description" : "authentication failed for MobileAccount"
          }
        }
      }
    },
    "/vehicle/list" : {
      "get" : {
        "tags" : [ "vehicle" ],
        "summary" : "Get vehicle list",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "description" : "ok, returns list of vehicles for user",
            "schema" : {
              "type" : "array",
              "items" : {
                "$ref" : "#/definitions/Vehicle"
              }
            }
          }
        }
      }
    },
    "/vehicle/{MSISDN}" : {
      "put" : {
        "tags" : [ "vehicle" ],
        "summary" : "Update vehicle",
        "description" : "",
        "consumes" : [ "application/json", "application/xml" ],
        "produces" : [ "application/json", "application/xml" ],
        "parameters" : [ {
          "name" : "MSISDN",
          "in" : "path",
          "description" : "MSISDN",
          "required" : true,
          "type" : "string"
        }, {
          "in" : "body",
          "name" : "body",
          "description" : "car nickname",
          "required" : true,
          "schema" : {
            "$ref" : "#/definitions/UpdateVehicleBody"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "vehicle is updated (no return)"
          }
        }
      }
    }
  },
  "definitions" : {
    "Address" : {
      "required" : [ "addressLine1", "city", "country", "state", "zipcode" ],
      "properties" : {
        "addressLine1" : {
          "type" : "string"
        },
        "addressLine2" : {
          "type" : "string",
          "description" : "Optional address line"
        },
        "zipcode" : {
          "type" : "string"
        },
        "city" : {
          "type" : "string"
        },
        "state" : {
          "type" : "string"
        },
        "country" : {
          "type" : "string"
        },
        "phone" : {
          "type" : "string"
        }
      }
    },
    "Subscriber" : {
      "properties" : {
        "firstName" : {
          "type" : "string"
        },
        "lastName" : {
          "type" : "string"
        },
        "email" : {
          "type" : "string"
        },
        "languagePreference" : {
          "type" : "string",
          "description" : "default is en"
        },
        "phoneNumber" : {
          "type" : "string"
        },
        "address" : {
          "$ref" : "#/definitions/Address"
        }
      }
    },
    "Vehicle" : {
      "properties" : {
        "nickname" : {
          "type" : "string"
        },
        "MSISDN" : {
          "type" : "string"
        }
      }
    },
    "TrialStatus" : {
      "properties" : {
        "trialStatus" : {
          "type" : "string",
          "description" : "ex. active, available, unavailable"
        }
      }
    },
    "PlanStatus" : {
      "properties" : {
        "planStatus" : {
          "type" : "string"
        }
      }
    },
    "PlanType" : {
      "properties" : {
        "planType" : {
          "type" : "string"
        }
      }
    },
    "Plan" : {
      "properties" : {
        "SOC" : {
          "$ref" : "#/definitions/SOC"
        },
        "planType" : {
          "$ref" : "#/definitions/PlanType"
        },
        "status" : {
          "$ref" : "#/definitions/PlanStatus"
        },
        "expirationDate" : {
          "type" : "string",
          "description" : "DD/MM/YYYY"
        },
        "eventsThrough" : {
          "type" : "string",
          "description" : "actual enddate of plan if data is used up before expirationDate (DD/MM/YYYY)"
        },
        "dataUsage" : {
          "$ref" : "#/definitions/DataUsage"
        }
      }
    },
    "DataUsage" : {
      "properties" : {
        "unitOfMeasure" : {
          "type" : "string",
          "description" : "ex. GB, MB ..."
        },
        "allottedUnits" : {
          "type" : "string",
          "description" : "units allotted to plan"
        },
        "usedUnits" : {
          "type" : "string",
          "description" : "used units in plan"
        }
      }
    },
    "PlanHistory" : {
      "properties" : {
        "offeringCode" : {
          "type" : "string"
        },
        "socOrderId" : {
          "type" : "string"
        },
        "sessionStatus" : {
          "type" : "string"
        },
        "sessionStatusReasonDescription" : {
          "type" : "string"
        },
        "effectiveDate" : {
          "type" : "string"
        },
        "expirationDate" : {
          "type" : "string"
        },
        "autoRenewType" : {
          "type" : "string"
        },
        "autoRenewIndicator" : {
          "type" : "string"
        },
        "remainingAllowance" : {
          "type" : "string"
        },
        "oneTimeCharge" : {
          "$ref" : "#/definitions/Amount"
        },
        "taxAmount" : {
          "$ref" : "#/definitions/Amount"
        },
        "paymentMethod" : {
          "type" : "string"
        },
        "paymentReferenceNumber" : {
          "type" : "string"
        },
        "last4CreditCardNumber" : {
          "type" : "string"
        },
        "paymentSource" : {
          "type" : "string"
        },
        "chargebackSessionId" : {
          "type" : "string"
        }
      }
    },
    "Amount" : {
      "properties" : {
        "amount" : {
          "type" : "string"
        },
        "monetaryUnit" : {
          "type" : "string"
        }
      }
    },
    "SOC" : {
      "properties" : {
        "offeringCode" : {
          "type" : "string"
        },
        "offeringDescription" : {
          "type" : "string"
        }
      }
    },
    "TermsAndConditions" : {
      "properties" : {
        "documentProductCode" : {
          "type" : "string"
        },
        "documentVersionNumber" : {
          "type" : "string"
        },
        "documentType" : {
          "type" : "string"
        },
        "documentScope" : {
          "type" : "string"
        },
        "softwareVersionNumber" : {
          "type" : "string"
        },
        "documentText" : {
          "type" : "string"
        }
      }
    },
    "TermsAndConditionsResponse" : {
      "properties" : {
        "termsAndConditions" : {
          "$ref" : "#/definitions/TermsAndConditions"
        },
        "token" : {
          "type" : "string",
          "description" : "a JWT (add authorization fields)"
        }
      }
    },
    "ValidateMobileAccountBody" : {
      "properties" : {
        "MSISDN" : {
          "type" : "string",
          "description" : "personal phone number of mobile account"
        },
        "SSN" : {
          "type" : "string",
          "description" : "4 last digits in SSN"
        },
        "billingZipCode" : {
          "type" : "string",
          "description" : "zip code"
        },
        "bilingAccountPassword" : {
          "type" : "string",
          "description" : "password"
        }
      }
    },
    "ValidateMobileAccountResponse" : {
      "properties" : {
        "BAN" : {
          "type" : "string",
          "description" : "billing account number of validated mobileAccount"
        },
        "billingMarket" : {
          "type" : "string",
          "description" : "BillingMarket of BAN"
        },
        "billingSubMarket" : {
          "type" : "string",
          "description" : "BillingSubMarket of BAN"
        },
        "datagroups" : {
          "type" : "array",
          "description" : "list of datagroups (as int converted to string)",
          "items" : {
            "type" : "string"
          }
        },
        "token" : {
          "type" : "string",
          "description" : "a JWT (with BAN and available datagroupIds added on top of the token)"
        }
      }
    },
    "UpdateVehicleBody" : {
      "properties" : {
        "nickname" : {
          "type" : "string",
          "description" : "nickname of the car"
        }
      }
    },
    "DeviceStatusResponse" : {
      "properties" : {
        "ICCID" : {
          "type" : "string",
          "description" : "ICCID"
        },
        "MSISDN" : {
          "type" : "string",
          "description" : "MSISDN"
        },
        "trialStatus" : {
          "description" : "trialStatus enum",
          "$ref" : "#/definitions/TrialStatus"
        },
        "planStatus" : {
          "type" : "string",
          "description" : "planStatus enum"
        },
        "sharedPlanStatus" : {
          "type" : "string",
          "description" : "planStatus enum"
        },
        "canRegister" : {
          "type" : "boolean",
          "description" : "indicates whether vehicle can be registered"
        },
        "carCountry" : {
          "type" : "string",
          "description" : "country of car"
        },
        "token" : {
          "type" : "string",
          "description" : "a JWT (encoded authorization fields include MSISDN, canRegister)"
        }
      }
    },
    "SharedPlanBody" : {
      "properties" : {
        "BAN" : {
          "type" : "string",
          "description" : "billing account number"
        },
        "billingMarket" : {
          "type" : "string",
          "description" : "billing market of BAN"
        },
        "billingSubMarket" : {
          "type" : "string",
          "description" : "billing sub market of BAN"
        },
        "termsAndConditions" : {
          "$ref" : "#/definitions/TermsAndConditions"
        },
        "datagroupId" : {
          "type" : "string"
        },
        "offeringCode" : {
          "type" : "string"
        }
      }
    },
    "TrialPlanBody" : {
      "properties" : {
        "subscriber" : {
          "$ref" : "#/definitions/Subscriber"
        },
        "termsAndConditions" : {
          "$ref" : "#/definitions/TermsAndConditions"
        }
      }
    },
    "UpdatedMSISDNResponse" : {
      "properties" : {
        "MSISDN" : {
          "type" : "string",
          "description" : "new MSISDN"
        },
        "token" : {
          "type" : "string",
          "description" : "JWT with new MSISDN"
        }
      }
    },
    "SubscriptionBody" : {
      "properties" : {
        "ICCID" : {
          "type" : "string"
        },
        "MSISDN" : {
          "type" : "string"
        },
        "nickname" : {
          "type" : "string",
          "description" : "car nickname"
        }
      }
    },
    "DashboardResponse" : {
      "properties" : {
        "vehicle" : {
          "$ref" : "#/definitions/Vehicle"
        },
        "plan" : {
          "$ref" : "#/definitions/Plan"
        },
        "Subscriber" : {
          "$ref" : "#/definitions/Subscriber"
        }
      }
    },
    "CatalogBody" : {
      "properties" : {
        "MSISDN" : {
          "type" : "string"
        },
        "userCountry" : {
          "type" : "string",
          "description" : "country ISO 3166-1 (e.g. US/CA)"
        }
      }
    },
    "CatalogResponse" : {
      "properties" : {
        "SOCs" : {
          "type" : "array",
          "description" : "list of available prepaid plans",
          "items" : {
            "$ref" : "#/definitions/SOC"
          }
        },
        "token" : {
          "type" : "string",
          "description" : "JWT with available offeringCodeIds"
        }
      }
    },
    "QuoteBody" : {
      "properties" : {
        "MSISDN" : {
          "type" : "string"
        },
        "offeringCode" : {
          "type" : "string",
          "description" : "SOC"
        }
      }
    },
    "QuoteResponse" : {
      "required" : [ "token", "totalAmount" ],
      "properties" : {
        "totalAmount" : {
          "description" : "total amount for SOC",
          "$ref" : "#/definitions/Amount"
        },
        "baseAmount" : {
          "description" : "amount for prepaid plan excluding taxes",
          "$ref" : "#/definitions/Amount"
        },
        "recurringAmount" : {
          "description" : "amount for postpaid plan excluding taxes",
          "$ref" : "#/definitions/Amount"
        },
        "totalTaxAmount" : {
          "description" : "tax amount",
          "$ref" : "#/definitions/Amount"
        },
        "token" : {
          "type" : "string",
          "description" : "JWT with totalAmount"
        }
      }
    }
  }
}};
      
      if (url && url.length > 1) {
        url = decodeURIComponent(url[1]);
      } else {
      }

      // Pre load translate...
      if(window.SwaggerTranslator) {
        window.SwaggerTranslator.translate();
      }
      window.swaggerUi = new SwaggerUi({
        url: url,
        spec: spec,
        dom_id: "swagger-ui-container",
        supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
        onComplete: function(swaggerApi, swaggerUi){
          if(typeof initOAuth == "function") {
            initOAuth({
              clientId: "your-client-id",
              clientSecret: "your-client-secret",
              realm: "your-realms",
              appName: "your-app-name", 
              scopeSeparator: ","
            });
          }

          if(window.SwaggerTranslator) {
            window.SwaggerTranslator.translate();
          }

          $('pre code').each(function(i, e) {
            hljs.highlightBlock(e)
          });

          addApiKeyAuthorization();
        },
        onFailure: function(data) {
          log("Unable to Load SwaggerUI");
        },
        docExpansion: "none",
        apisSorter: "alpha",
        showRequestHeaders: false
      });

      function addApiKeyAuthorization(){
        var key = encodeURIComponent($('#input_apiKey')[0].value);
        if(key && key.trim() != "") {
            var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query");
            window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth);
            log("added key " + key);
        }
      }

      $('#input_apiKey').change(addApiKeyAuthorization);

      // if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
      /*
        var apiKey = "myApiKeyXXXX123456789";
        $('#input_apiKey').val(apiKey);
      */

      window.swaggerUi.load();

      function log() {
        if ('console' in window) {
          console.log.apply(console, arguments);
        }
      }
  });
  </script>
Exactly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Aug 7, 2015, 4:09:19 PM8/7/15
to Swagger
You have two issues:

  1. The "swagger" : “2.0” line uses funky quote characters to encompass the 2.0 value.
  2. You have an extra enclosing curly braces at the end of the JSON.

Fix both issues and you're golden (loaded fine here).


Exactly.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

cml...@g.clemson.edu

unread,
Aug 7, 2015, 5:46:26 PM8/7/15
to Swagger
What browser are you using?  I fixed the issues but the UI loaded the petstore example for some reason.
...

Ron Ratovsky

unread,
Aug 7, 2015, 5:50:51 PM8/7/15
to Swagger
Here you go.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
index.html

cml...@g.clemson.edu

unread,
Aug 7, 2015, 5:57:59 PM8/7/15
to Swagger
Fantastic.  Thanks so much for your help, I must just be slightly insane.
Here you go.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ron Ratovsky

unread,
Aug 7, 2015, 6:00:05 PM8/7/15
to Swagger
As are many genius people.

Here you go.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages