{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/shanghai-jiao-tong-university/main/json-schema/shanghai-jiao-tong-university-envelope.json",
  "title": "SJTU API Response Envelope",
  "description": "Generated by API Evangelist, derived from Shanghai Jiao Tong University's own published documentation — SJTU publishes no JSON Schema. The single response envelope every Shanghai Jiao Tong University API returns, on both the Open API platform (api.sjtu.edu.cn) and the Data Resources platform (graphql.sjtu.edu.cn/v1). Derived from the 通用结构 section of https://developer.sjtu.edu.cn/api/overview.html and https://developer.sjtu.edu.cn/graphql/overview.html. Note that errno, not the HTTP status, is the authoritative success signal: the documentation's own notification example shows a failed call returning HTTP 200 with errno 10001.",
  "type": "object",
  "required": [
    "errno"
  ],
  "properties": {
    "errno": {
      "type": "integer",
      "description": "Error code. 0 means the call succeeded. See errors/shanghai-jiao-tong-university-errors.yml for the code table.",
      "examples": [
        0,
        10002
      ]
    },
    "error": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional message. May embed structured detail after a blank line, as in 'BAD_PARAMETERS\\n\\nMORE_INFORMATION:phones is required'.",
      "examples": [
        "success",
        "Authentication Failed."
      ]
    },
    "total": {
      "type": [
        "integer",
        "string"
      ],
      "description": "Optional. On the Open API platform this is the total length of the queried data set, so total >= entities.length. On the Data Resources platform it is the number of records returned by this call, used to decide whether to page again. The Open API overview types it as a string and the Data Resources overview types it as an int — the platforms disagree, and a client should accept either.",
      "examples": [
        0,
        1,
        20
      ]
    },
    "nextToken": {
      "type": "string",
      "description": "Optional; Open API platform only. Pass back as the pageToken query parameter to fetch the next page. Absent on the last page.",
      "examples": [
        "3A4bz-e"
      ]
    },
    "entities": {
      "type": "array",
      "description": "Returned objects. Length 0 when there is nothing to return; a single object is at entities[0].",
      "items": {
        "type": "object"
      }
    }
  }
}
