{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "Many to many",
    "description": "API that needs many-to-many",
    "termsOfService": "http://swagger.io/terms/",
    "contact": {
      "name": "Swagger API Team",
      "email": "foo@example.com",
      "url": "http://madskristensen.net"
    },
    "license": {
      "name": "MIT",
      "url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT"
    }
  },
  "host": "petstore.swagger.io",
  "basePath": "/api",
  "schemes": [
    "http"
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/students": {
      "get": {
        "description": "Returns all students from the system.\n",
        "operationId": "findStudents",
        "responses": {
          "200": {
            "description": "student response",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/Student"
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    },
    "/students/{id}": {
      "get": {
        "description": "Returns a user based on a single ID, if the user does not have access to the student",
        "operationId": "find student by id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "ID of student to fetch",
            "required": true,
            "type": "integer",
            "format": "int64"
          }
        ],
        "responses": {
          "200": {
            "description": "student response",
            "schema": {
              "$ref": "#/definitions/Student"
            }
          },
          "default": {
            "description": "unexpected error",
            "schema": {
              "$ref": "#/definitions/Error"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Student": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "format": "int64"
        },
        "mainclasses": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Class"
          }
        },
        "backupclasses": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Class"
          }
        },
        "name": {
          "type": "string"
        }
      }
    },
    "Class": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "participants": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/Student"
          }
        },
        "name": {
          "type": "string"
        }
      }
    },
    "Error": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}