Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing if-match header for copy file #192

Open
dkocher opened this issue Sep 15, 2021 · 1 comment
Open

Missing if-match header for copy file #192

dkocher opened this issue Sep 15, 2021 · 1 comment
Labels

Comments

@dkocher
Copy link

dkocher commented Sep 15, 2021

Description of the issue

The definition for post_files_id_copy seems to lack the header parameter if-match. This is supposedly required to copy a file to a destination where the target already exists.

Current content

    "/files/{file_id}/copy": {
      "post": {
        "operationId": "post_files_id_copy",
        "summary": "Copy file",
        "description": "Creates a copy of a file.",
        "tags": [
          "Files"
        ],
        "x-box-tag": "files",
        "x-box-enable-explorer": true,
        "x-box-sanitized": true,
        "parameters": [
          {
            "name": "file_id",
            "description": "The unique identifier that represent a file.\n\nThe ID for any file can be determined\nby visiting a file in the web application\nand copying the ID from the URL. For example,\nfor the URL `https://*.app.box.com/files/123`\nthe `file_id` is `123`.",
            "example": "12345",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fields",
            "description": "A comma-separated list of attributes to include in the\nresponse. This can be used to request fields that are\nnot normally returned in a standard response.\n\nBe aware that specifying this parameter will have the\neffect that none of the standard fields are returned in\nthe response unless explicitly specified, instead only\nfields for the mini representation are returned, additional\nto the fields requested.",
            "in": "query",
            "example": [
              "id",
              "type",
              "name"
            ],
            "required": false,
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "parent"
                ],
                "nullable": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "An optional new name for the copied file.\n\nThere are some restrictions to the file name. Names containing\nnon-printable ASCII characters, forward and backward slashes\n(`/`, `\\`), and protected names like `.` and `..` are\nautomatically sanitized by removing the non-allowed\ncharacters.",
                    "example": "FileCopy.txt",
                    "maxLength": 255
                  },
                  "version": {
                    "type": "string",
                    "description": "An optional ID of the specific file version to copy.",
                    "example": "0"
                  },
                  "parent": {
                    "type": "object",
                    "description": "The destination folder to copy the file to.",
                    "required": [
                      "id"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "description": "The ID of folder to copy the file to.",
                        "example": "0"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Returns a new file object representing the copied file.\n\nNot all available fields are returned by default. Use the\n[fields](#param-fields) query parameter to explicitly request\nany specific fields.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            }
          },
          "304": {
            "description": "Returns an empty response when the `If-None-Match` header matches\nthe current `etag` value of the file. This indicates that the file\nhas not changed since it was last requested."
          },
          "400": {
            "description": "Returns an error if some of the parameters are missing or\nnot valid.\n\n* `bad_request` when a parameter is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientError"
                }
              }
            }
          },
          "404": {
            "description": "Returns an error if either the source file or the destination\nfolder could not be found, or the authenticated user does not\nhave access to either.\n\n* `not_found` when the authenticated user does not have access\n  to the source file or the destination folder",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientError"
                }
              }
            }
          },
          "409": {
            "description": "* `operation_blocked_temporary`: Returned if either of the destination\n  or source folders is locked due to another move, copy, delete or\n  restore operation in process.\n\n  The operation can be retried at a later point.\n\n* `item_name_in_use` when a folder with the same name already\n  exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientError"
                }
              }
            }
          },
          "default": {
            "description": "An unexpected client error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientError"
                }
              }
            }
          }
        }
      }
    }

Expected content

Add header definition like

          {
            "name": "if-match",
            "description": "Ensures this item hasn't recently changed before\nmaking changes.\n\nPass in the item's last observed `etag` value\ninto this header and the endpoint will fail\nwith a `412 Precondition Failed` if it\nhas changed since.",
            "in": "header",
            "required": false,
            "example": "1",
            "schema": {
              "type": "string"
            }
          }
@dkocher dkocher added the bug label Sep 15, 2021
@dkocher
Copy link
Author

dkocher commented Sep 15, 2021

Note that put_files_id contains the definition as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant