Dennis S
Dennis S

Reputation: 858

Fetching a model schema from Swagger

I'm trying to fetch a model schema for an item in Swagger. I'd like to do this through an http request from a different machine from the one hosting Swagger.

I can fetch the Swagger API-docs as json from:

domain.com/swagger/v2/api-docs.json

The response contains:

{
  "swagger": "2.0",
  ...
  paths: {
    "/endpoint": {
      "get": {
        ...
        "responses": {
          "200":{
            "description":"OK",
            "schema": {
              "type":"array",
              "items": {
                "$ref":"#/definitions/Item"
              }
            }
          }
        }
      }
    }
  }
}

Is there any way to fetch the "/definitions/Item" model schema?

I'd like to do an http GET on something like:

domain.com/swagger/v2/api-docs/definitions/Item.json

I'm using Swagger version 2.0.

Thanks

Upvotes: 2

Views: 3262

Answers (1)

Neil
Neil

Reputation: 993

It's at the bottom of the same document. Eg: if you go to the live demo of the swagger editor (http://editor.swagger.io/#/edit) and scroll to the bottom you'll see the object definitions that are referenced in the endpoint definitions.

Upvotes: 1

Related Questions