{
  "openapi": "3.1.0",
  "info": {
    "title": "JSDaj Import Preflight",
    "version": "0.2.0"
  },
  "security": [
    {
      "bearerAuth": []
    },
    {}
  ],
  "paths": {
    "/v1/check": {
      "post": {
        "operationId": "check_product_csv",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "csv": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5242880
                  },
                  "mode": {
                    "default": "create",
                    "type": "string",
                    "enum": [
                      "create",
                      "update"
                    ]
                  },
                  "overwrite": {
                    "default": false,
                    "type": "boolean"
                  },
                  "offset": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "csv",
                  "mode",
                  "overwrite",
                  "offset",
                  "limit"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded findings page",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "apiVersion": {
                      "type": "string",
                      "const": "v1"
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "create",
                        "update"
                      ]
                    },
                    "overwrite": {
                      "type": "boolean"
                    },
                    "headers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "records": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "errors": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "warnings": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "errors",
                        "warnings"
                      ],
                      "additionalProperties": false
                    },
                    "page": {
                      "type": "object",
                      "properties": {
                        "offset": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "limit": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "total": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "returned": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "nextOffset": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "offset",
                        "limit",
                        "total",
                        "returned",
                        "nextOffset"
                      ],
                      "additionalProperties": false
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "severity": {
                            "type": "string",
                            "enum": [
                              "error",
                              "warning"
                            ]
                          },
                          "code": {
                            "type": "string"
                          },
                          "row": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "column": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "severity",
                          "code",
                          "row",
                          "column",
                          "message"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "apiVersion",
                    "mode",
                    "overwrite",
                    "headers",
                    "records",
                    "counts",
                    "page",
                    "findings"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    },
    "/v1/report.csv": {
      "post": {
        "operationId": "export_preflight_csv",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "csv": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 5242880
                  },
                  "mode": {
                    "default": "create",
                    "type": "string",
                    "enum": [
                      "create",
                      "update"
                    ]
                  },
                  "overwrite": {
                    "default": false,
                    "type": "boolean"
                  },
                  "offset": {
                    "default": 0,
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                  },
                  "limit": {
                    "default": 100,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "csv",
                  "mode",
                  "overwrite",
                  "offset",
                  "limit"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bounded findings page",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
