{
  "openapi": "3.0.0",
  "info": {
    "title": "mprove backend",
    "description": "",
    "version": "12.0.27",
    "contact": {}
  },
  "paths": {
    "/api/ToBackendSyncRepo": {
      "post": {
        "operationId": "SyncRepoController",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ToBackendSyncRepoRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ToBackendSyncRepoResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ToBackendSyncRepoRequest": {
        "type": "object",
        "properties": {
          "info": {
            "$ref": "#/components/schemas/ToBackendSyncRepoRequestInfo"
          },
          "payload": {
            "$ref": "#/components/schemas/ToBackendSyncRepoRequestPayload"
          }
        },
        "required": [
          "info",
          "payload"
        ]
      },
      "ToBackendSyncRepoResponse": {
        "type": "object",
        "properties": {
          "info": {
            "$ref": "#/components/schemas/ToBackendSyncRepoResponseInfo"
          },
          "payload": {
            "$ref": "#/components/schemas/ToBackendSyncRepoResponsePayload"
          }
        },
        "required": [
          "info",
          "payload"
        ]
      },
      "ToBackendSyncRepoRequestInfo": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "enum": [
              "api/ToBackendSyncRepo"
            ]
          },
          "traceId": {
            "type": "string"
          },
          "idempotencyKey": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "traceId",
          "idempotencyKey"
        ]
      },
      "ToBackendSyncRepoRequestPayload": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "projectId": {
                "type": "string"
              },
              "repoId": {
                "type": "string"
              },
              "branchId": {
                "type": "string"
              },
              "lastCommit": {
                "type": "string"
              },
              "envId": {
                "type": "string"
              },
              "getRepo": {
                "type": "boolean",
                "nullable": true
              },
              "getRepoNodes": {
                "type": "boolean",
                "nullable": true
              },
              "getErrors": {
                "type": "boolean",
                "nullable": true
              },
              "debug": {
                "type": "boolean",
                "nullable": true
              },
              "direction": {
                "type": "string",
                "enum": [
                  "to-server"
                ]
              },
              "changedFiles": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DiskSyncFile"
                }
              },
              "deletedFiles": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DiskSyncFile"
                }
              }
            },
            "required": [
              "projectId",
              "repoId",
              "branchId",
              "lastCommit",
              "envId",
              "direction",
              "changedFiles",
              "deletedFiles"
            ]
          },
          {
            "type": "object",
            "properties": {
              "projectId": {
                "type": "string"
              },
              "repoId": {
                "type": "string"
              },
              "branchId": {
                "type": "string"
              },
              "lastCommit": {
                "type": "string"
              },
              "envId": {
                "type": "string"
              },
              "getRepo": {
                "type": "boolean",
                "nullable": true
              },
              "getRepoNodes": {
                "type": "boolean",
                "nullable": true
              },
              "getErrors": {
                "type": "boolean",
                "nullable": true
              },
              "debug": {
                "type": "boolean",
                "nullable": true
              },
              "direction": {
                "type": "string",
                "enum": [
                  "from-server"
                ]
              }
            },
            "required": [
              "projectId",
              "repoId",
              "branchId",
              "lastCommit",
              "envId",
              "direction"
            ]
          }
        ]
      },
      "ToBackendSyncRepoResponseInfo": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "enum": [
              "/api/ToBackendSyncRepo"
            ]
          },
          "method": {
            "type": "string",
            "enum": [
              "POST"
            ]
          },
          "mproveVersion": {
            "type": "string",
            "nullable": true
          },
          "duration": {
            "type": "number",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "Ok",
              "Error"
            ]
          },
          "traceId": {
            "type": "string"
          },
          "error": {
            "nullable": true
          }
        },
        "required": [
          "path",
          "method",
          "status",
          "traceId"
        ]
      },
      "ToBackendSyncRepoResponsePayload": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "orgId": {
                "type": "string"
              },
              "repoId": {
                "type": "string"
              },
              "validationErrorsTotal": {
                "type": "number"
              },
              "validationErrors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BmlError"
                },
                "nullable": true
              },
              "devChangesToCommit": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DiskFileChange"
                }
              },
              "repo": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ToBackendSyncRepoRepo"
                  }
                ],
                "nullable": true
              },
              "needValidate": {
                "type": "boolean",
                "nullable": true
              },
              "structId": {
                "type": "string",
                "nullable": true
              },
              "direction": {
                "type": "string",
                "enum": [
                  "to-server"
                ]
              },
              "appliedChangesOnServer": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "orgId",
              "repoId",
              "validationErrorsTotal",
              "devChangesToCommit",
              "direction",
              "appliedChangesOnServer"
            ]
          },
          {
            "type": "object",
            "properties": {
              "orgId": {
                "type": "string"
              },
              "repoId": {
                "type": "string"
              },
              "validationErrorsTotal": {
                "type": "number"
              },
              "validationErrors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BmlError"
                },
                "nullable": true
              },
              "devChangesToCommit": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DiskFileChange"
                }
              },
              "repo": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ToBackendSyncRepoRepo"
                  }
                ],
                "nullable": true
              },
              "needValidate": {
                "type": "boolean",
                "nullable": true
              },
              "structId": {
                "type": "string",
                "nullable": true
              },
              "direction": {
                "type": "string",
                "enum": [
                  "from-server"
                ]
              },
              "changedFiles": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DiskSyncFile"
                }
              },
              "deletedFiles": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DiskSyncFile"
                }
              }
            },
            "required": [
              "orgId",
              "repoId",
              "validationErrorsTotal",
              "devChangesToCommit",
              "direction",
              "changedFiles",
              "deletedFiles"
            ]
          }
        ]
      },
      "DiskSyncFile": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "New",
              "Deleted",
              "Modified",
              "Conflicted",
              "TypeChange",
              "Renamed",
              "Ignored",
              "Unmodified",
              "Copied",
              "Untracked",
              "Unreadable"
            ],
            "nullable": true
          },
          "content": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "path"
        ]
      },
      "BmlError": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiskFileLine"
            }
          }
        },
        "required": [
          "title",
          "message",
          "lines"
        ]
      },
      "DiskFileChange": {
        "type": "object",
        "properties": {
          "fileName": {
            "type": "string"
          },
          "fileId": {
            "type": "string"
          },
          "parentPath": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "New",
              "Deleted",
              "Modified",
              "Conflicted",
              "TypeChange",
              "Renamed",
              "Ignored",
              "Unmodified",
              "Copied",
              "Untracked",
              "Unreadable"
            ]
          },
          "content": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "fileName",
          "fileId",
          "parentPath",
          "status"
        ]
      },
      "ToBackendSyncRepoRepo": {
        "type": "object",
        "properties": {
          "orgId": {
            "type": "string"
          },
          "projectId": {
            "type": "string"
          },
          "repoId": {
            "type": "string"
          },
          "currentBranchId": {
            "type": "string"
          },
          "repoStatus": {
            "type": "string",
            "enum": [
              "NeedCommit",
              "NeedPull",
              "NeedPush",
              "Ok"
            ]
          },
          "conflicts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiskFileLine"
            }
          },
          "nodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiskCatalogNode"
            },
            "nullable": true
          }
        },
        "required": [
          "orgId",
          "projectId",
          "repoId",
          "currentBranchId",
          "repoStatus",
          "conflicts"
        ]
      },
      "DiskFileLine": {
        "type": "object",
        "properties": {
          "fileId": {
            "type": "string"
          },
          "fileName": {
            "type": "string"
          },
          "lineNumber": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          }
        },
        "required": [
          "fileId",
          "fileName",
          "lineNumber"
        ]
      },
      "DiskCatalogNode": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "isFolder": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "fileId": {
            "type": "string",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DiskCatalogNode"
            },
            "nullable": true
          }
        },
        "required": [
          "id",
          "isFolder",
          "name"
        ]
      }
    }
  }
}
