{
  "openapi": "3.1.0",
  "info": { "title": "Model query API", "version": "0.1.0" },
  "paths": {
    "/entities": {
      "get": {
        "operationId": "listEntities",
        "summary": "List the entities of the model",
        "responses": {
          "200": {
            "description": "OK",
            "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Entity" } } } }
          }
        }
      }
    },
    "/entities/{id}": {
      "get": {
        "operationId": "getEntity",
        "summary": "Read an entity",
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "The identifier of the entity" }],
        "responses": {
          "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Entity" } } } },
          "404": { "description": "Unknown identifier" }
        }
      }
    },
    "/search": {
      "get": {
        "operationId": "searchModel",
        "summary": "Search the model",
        "parameters": [{ "name": "q", "in": "query", "required": true, "schema": { "type": "string" }, "description": "The words to match by prefix" }],
        "responses": {
          "200": {
            "description": "OK",
            "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/SearchHit" } } } }
          }
        }
      }
    },
    "/findings": {
      "get": {
        "operationId": "listFindings",
        "summary": "List the findings of the last build",
        "responses": {
          "200": {
            "description": "OK",
            "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Finding" } } } }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Entity": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "title": { "type": "string" }, "links": { "type": "array", "items": { "$ref": "#/components/schemas/Link" } } } },
      "Link": { "type": "object", "properties": { "from": { "type": "string" }, "to": { "type": "string" }, "relation": { "type": "string" }, "confidence": { "type": "number" } } },
      "Finding": { "type": "object", "properties": { "check": { "type": "string" }, "severity": { "type": "string" }, "path": { "type": "string" } } },
      "SearchHit": { "type": "object", "properties": { "id": { "type": "string" }, "score": { "type": "number" } } }
    }
  }
}
