...

Text file src/github.com/go-openapi/spec/fixtures/specs/todos.json

Documentation: github.com/go-openapi/spec/fixtures/specs

     1{
     2  "swagger": "2.0",
     3  "info": {
     4    "version": "1.0",
     5    "title": "To-do Demo",
     6    "description": "This OAS2 (Swagger 2) file represents a real API that lives at http://todos.stoplight.io.\n\nFor authentication information, click the apikey security scheme in the editor sidebar.",
     7    "contact": {
     8      "name": "Stoplight",
     9      "url": "https://stoplight.io"
    10    },
    11    "license": {
    12      "name": "MIT"
    13    }
    14  },
    15  "host": "todos.stoplight.io",
    16  "schemes": ["http"],
    17  "consumes": ["application/json"],
    18  "produces": ["application/json"],
    19  "securityDefinitions": {
    20    "Basic": {
    21      "type": "basic"
    22    },
    23    "API Key": {
    24      "type": "apiKey",
    25      "name": "apikey",
    26      "in": "query"
    27    }
    28  },
    29  "paths": {
    30    "/todos/{todoId}": {
    31      "parameters": [{
    32        "name": "todoId",
    33        "in": "path",
    34        "required": true,
    35        "type": "string"
    36      }],
    37      "get": {
    38        "operationId": "GET_todo",
    39        "summary": "Get Todo",
    40        "tags": ["Todos"],
    41        "responses": {
    42          "200": {
    43            "description": "",
    44            "schema": {
    45              "$ref": "#/definitions/todo-full"
    46            },
    47            "examples": {
    48              "application/json": {
    49                "id": 1,
    50                "name": "get food",
    51                "completed": false,
    52                "completed_at": "1955-04-23T13:22:52.685Z",
    53                "created_at": "1994-11-05T03:26:51.471Z",
    54                "updated_at": "1989-07-29T11:30:06.701Z"
    55              },
    56              "/todos/foobar": "{\n\t\"foo\": \"bar\"\n}\n",
    57              "/todos/chores": {
    58                "id": 9000,
    59                "name": "Do Chores",
    60                "completed": false,
    61                "created_at": "2014-08-28T14:14:28.494Z",
    62                "updated_at": "2014-08-28T14:14:28.494Z"
    63              },
    64              "new": {
    65                "name": "esse qui proident labore",
    66                "completed": null,
    67                "id": 920778,
    68                "completed_at": "2014-01-07T07:49:55.123Z",
    69                "created_at": "1948-04-21T12:04:21.282Z",
    70                "updated_at": "1951-12-19T11:10:34.039Z",
    71                "user": {
    72                  "name": "irure deserunt fugiat",
    73                  "age": 121.45395681110494
    74                },
    75                "float": -47990796.228164576
    76              }
    77            }
    78          },
    79          "404": {
    80            "$ref": "./todos.common.json#/responses/404"
    81          },
    82          "500": {
    83            "$ref": "./todos.common.json#/responses/500"
    84          }
    85        },
    86        "parameters": [{
    87          "in": "query",
    88          "name": "",
    89          "type": "string"
    90        }]
    91      },
    92      "put": {
    93        "operationId": "PUT_todos",
    94        "summary": "Update Todo",
    95        "tags": ["Todos"],
    96        "parameters": [{
    97          "name": "body",
    98          "in": "body",
    99          "schema": {
   100            "$ref": "#/definitions/todo-partial",
   101            "example": {
   102              "name": "my todo's new name",
   103              "completed": false
   104            }
   105          }
   106        }],
   107        "responses": {
   108          "200": {
   109            "description": "",
   110            "schema": {
   111              "$ref": "#/definitions/todo-full"
   112            },
   113            "examples": {
   114              "application/json": {
   115                "id": 9000,
   116                "name": "It's Over 9000!!!",
   117                "completed": true,
   118                "completed_at": null,
   119                "created_at": "2014-08-28T14:14:28.494Z",
   120                "updated_at": "2015-08-28T14:14:28.494Z"
   121              }
   122            }
   123          },
   124          "401": {
   125            "$ref": "./todos.common.json#/responses/401"
   126          },
   127          "404": {
   128            "$ref": "./todos.common.json#/responses/404"
   129          },
   130          "500": {
   131            "$ref": "./todos.common.json#/responses/500"
   132          }
   133        },
   134        "security": [{
   135            "Basic": []
   136          },
   137          {
   138            "API Key": []
   139          }
   140        ]
   141      },
   142      "delete": {
   143        "operationId": "DELETE_todo",
   144        "summary": "Delete Todo",
   145        "tags": ["Todos"],
   146        "responses": {
   147          "204": {
   148            "description": ""
   149          },
   150          "401": {
   151            "$ref": "./todos.common.json#/responses/401"
   152          },
   153          "404": {
   154            "$ref": "./todos.common.json#/responses/404"
   155          },
   156          "500": {
   157            "$ref": "./todos.common.json#/responses/500"
   158          }
   159        },
   160        "security": [{
   161            "Basic": []
   162          },
   163          {
   164            "API Key": []
   165          }
   166        ]
   167      }
   168    },
   169    "/todos": {
   170      "post": {
   171        "operationId": "POST_todos",
   172        "summary": "Create Todo",
   173        "tags": ["Todos"],
   174        "parameters": [{
   175          "name": "body",
   176          "in": "body",
   177          "schema": {
   178            "$ref": "#/definitions/todo-partial",
   179            "example": {
   180              "name": "my todo's name",
   181              "completed": false
   182            }
   183          }
   184        }],
   185        "responses": {
   186          "201": {
   187            "description": "",
   188            "schema": {
   189              "$ref": "#/definitions/todo-full"
   190            },
   191            "examples": {
   192              "application/json": {
   193                "id": 9000,
   194                "name": "It's Over 9000!!!",
   195                "completed": null,
   196                "completed_at": null,
   197                "created_at": "2014-08-28T14:14:28.494Z",
   198                "updated_at": "2014-08-28T14:14:28.494Z"
   199              },
   200              "/todos/chores": {
   201                "id": 9000,
   202                "name": "Do Chores",
   203                "completed": false,
   204                "created_at": "2014-08-28T14:14:28.494Z",
   205                "updated_at": "2014-08-28T14:14:28.494Z"
   206              }
   207            }
   208          },
   209          "401": {
   210            "$ref": "./todos.common.json#/responses/401"
   211          },
   212          "500": {
   213            "$ref": "./todos.common.json#/responses/500"
   214          }
   215        },
   216        "security": [{
   217            "API Key": []
   218          },
   219          {
   220            "Basic": []
   221          }
   222        ],
   223        "description": "This creates a Todo object.\n\nTesting `inline code`."
   224      },
   225      "get": {
   226        "operationId": "GET_todos",
   227        "summary": "List Todos",
   228        "tags": ["Todos"],
   229        "parameters": [{
   230            "$ref": "#/parameters/limit"
   231          },
   232          {
   233            "$ref": "#/parameters/skip"
   234          }
   235        ],
   236        "responses": {
   237          "200": {
   238            "description": "",
   239            "schema": {
   240              "type": "array",
   241              "items": {
   242                "$ref": "#/definitions/todo-full"
   243              }
   244            },
   245            "examples": {
   246              "application/json": [{
   247                  "id": 1,
   248                  "name": "design the thingz",
   249                  "completed": true
   250                },
   251                {
   252                  "id": 2,
   253                  "name": "mock the thingz",
   254                  "completed": true
   255                },
   256                {
   257                  "id": 3,
   258                  "name": "code the thingz",
   259                  "completed": false
   260                }
   261              ],
   262              "empty": []
   263            },
   264            "headers": {
   265              "foo": {
   266                "type": "string",
   267                "default": "bar"
   268              }
   269            }
   270          },
   271          "500": {
   272            "$ref": "./todos.common.json#/responses/500"
   273          }
   274        },
   275        "description": "​"
   276      }
   277    }
   278  },
   279  "parameters": {
   280    "limit": {
   281      "name": "limit",
   282      "in": "query",
   283      "description": "This is how it works.",
   284      "required": false,
   285      "type": "integer",
   286      "maximum": 100
   287    },
   288    "skip": {
   289      "name": "skip",
   290      "in": "query",
   291      "required": false,
   292      "type": "string"
   293    }
   294  },
   295  "definitions": {
   296    "todo-partial": {
   297      "title": "Todo Partial",
   298      "type": "object",
   299      "properties": {
   300        "name": {
   301          "type": "string"
   302        },
   303        "completed": {
   304          "type": ["boolean", "null"]
   305        }
   306      },
   307      "required": ["name", "completed"]
   308    },
   309    "todo-full": {
   310      "title": "Todo Full",
   311      "allOf": [{
   312          "$ref": "#/definitions/todo-partial"
   313        },
   314        {
   315          "type": "object",
   316          "properties": {
   317            "id": {
   318              "type": "integer",
   319              "minimum": 0,
   320              "maximum": 1000000
   321            },
   322            "completed_at": {
   323              "type": ["string", "null"],
   324              "format": "date-time"
   325            },
   326            "created_at": {
   327              "type": "string",
   328              "format": "date-time"
   329            },
   330            "updated_at": {
   331              "type": "string",
   332              "format": "date-time"
   333            },
   334            "user": {
   335              "$ref": "./todos.common.json#/definitions/user"
   336            }
   337          },
   338          "required": ["id", "user"]
   339        }
   340      ]
   341    }
   342  },
   343  "tags": [{
   344    "name": "Todos"
   345  }]
   346}

View as plain text