{
  "openapi": "3.0.1",
  "info": {
    "title": "IBM Cloud Pak for AIOps Change Risk REST API",
    "description": "This documentation is for the IBM Cloud Pak for AIOps Change Risk REST API",
    "version": "1.0.0"
  },
  "paths": {
    "/change_requests/risk_assessment": {
      "post": {
        "description": "Get the risk assessment by providing a change request ticket information.",
        "operationId": "getChangeRiskAssessment",
        "parameters": [
          {
            "name": "include_explanation",
            "in": "query",
            "description": "Turn on/off explanation. Explanation included by default.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "requestBody": {
          "description": "change request for assessment",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Change"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Risk assessment response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskAssessment"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "504": {
            "description": "Internal processing timeout",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          }
        }
      }
    },
    "/feedback/types/risk_assessment": {
      "post": {
        "tags": [
          "Feedback"
        ],
        "description": "Provide feedback for the corresponding change risk assessment",
        "operationId": "postChangeRiskAssessmentFeedback",
        "requestBody": {
          "description": "feedback for risk assessment",
          "content": {
            "*/*": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackRiskAssessment"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Response",
            "content": {}
          },
          "400": {
            "description": "Bad request",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          }
        }
      }
    },
    "/feedback/types/risk_assessment_explanation": {
      "post": {
        "tags": [
          "Feedback"
        ],
        "description": "Provide feedback for the corresponding change risk assessment",
        "operationId": "postChangeRiskAssessmentExplanationFeedback",
        "requestBody": {
          "description": "feedback for risk assessment explanation",
          "content": {
            "*/*": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackRiskAssessmentExplanation"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Risk assessment response",
            "content": {}
          },
          "400": {
            "description": "Bad request",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          },
          "default": {
            "description": "unexpected error",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorContainer"
                }
              }
            }
          }
        }
      }
    },
    "/healthcheck": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Gets the health of the server.",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "description": "OK",
            "content": {}
          },
          "500": {
            "description": "Internal server error",
            "content": {}
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Change": {
        "required": [
          "assigned_to",
          "number"
        ],
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "sys_domain": {
            "type": "string"
          },
          "business_service": {
            "type": "string"
          },
          "short_description": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "justification": {
            "type": "string"
          },
          "backout_plan": {
            "type": "string"
          },
          "impact": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "state": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "sys_created_by": {
            "type": "string"
          },
          "assigned_to": {
            "type": "string"
          },
          "close_code": {
            "type": "string"
          },
          "close_notes": {
            "type": "string"
          }
        }
      },
      "Incident": {
        "required": [
          "description",
          "number"
        ],
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "severity": {
            "type": "string"
          }
        }
      },
      "Feedback": {
        "required": [
          "user_response"
        ],
        "type": "object",
        "properties": {
          "user_response": {
            "maxLength": 50,
            "minLength": 2,
            "type": "string"
          }
        }
      },
      "FeedbackRiskAssessment": {
        "required": [
          "assessment_id",
          "feedback"
        ],
        "type": "object",
        "properties": {
          "assessment_id": {
            "maxLength": 50,
            "minLength": 2,
            "type": "string"
          },
          "feedback": {
            "$ref": "#/components/schemas/Feedback"
          }
        }
      },
      "FeedbackRiskAssessmentExplanation": {
        "required": [
          "assessment_id",
          "feedback",
          "relevant_ticket_number"
        ],
        "type": "object",
        "properties": {
          "assessment_id": {
            "maxLength": 50,
            "minLength": 2,
            "type": "string"
          },
          "relevant_ticket_number": {
            "maxLength": 50,
            "minLength": 2,
            "type": "string"
          },
          "feedback": {
            "$ref": "#/components/schemas/Feedback"
          }
        }
      },
      "RiskAssessment": {
        "required": [
          "change_risk_score",
          "id",
          "prediction_confidence",
          "prediction_text"
        ],
        "type": "object",
        "properties": {
          "number": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "prediction_text": {
            "type": "string"
          },
          "prediction_confidence": {
            "type": "number",
            "format": "float"
          },
          "change_risk_score": {
            "type": "number",
            "format": "float"
          },
          "explanation": {
            "$ref": "#/components/schemas/Explanation"
          }
        }
      },
      "Explanation": {
        "required": [
          "words"
        ],
        "type": "object",
        "properties": {
          "words": {
            "type": "object",
            "properties": {}
          },
          "relevant_tickets": {
            "$ref": "#/components/schemas/RelevantTickets"
          },
          "ticket_relevance_level": {
            "type": "object",
            "properties": {}
          },
          "ticket_similarity_level": {
            "type": "object",
            "properties": {}
          }
        }
      },
      "RelevantTickets": {
        "type": "array",
        "items": {
          "type": "object",
          "allOf": [
            {
              "type": "object",
              "properties": {
                "ticket_similarity_level": {
                  "type": "string"
                },
                "ticket_relevance_level": {
                  "type": "string"
                },
                "induced_incidents": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Incident"
                  }
                },
                "caused_incidents": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Incident"
                  }
                }
              }
            },
            {
              "$ref": "#/components/schemas/Change"
            }
          ]
        }
      },
      "ErrorContainer": {
        "type": "object",
        "properties": {
          "errors": {
            "$ref": "#/components/schemas/Errors"
          },
          "trace": {
            "type": "string",
            "example": "9daee671-916a-4678-850b-10b911f0236d"
          }
        }
      },
      "Errors": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Error"
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "http_code": {
            "type": "integer",
            "format": "int32",
            "example": 500
          },
          "code": {
            "type": "string",
            "example": "missing_field"
          },
          "message": {
            "type": "string",
            "example": "The `id` field is required."
          },
          "more_info": {
            "type": "string"
          }
        }
      }
    }
  }
}