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

Missed and wrong parameters in OpenAPI schema for "file" #10824

Closed
3 tasks done
kuzmi4 opened this issue Jan 3, 2022 · 0 comments · Fixed by #11290
Closed
3 tasks done

Missed and wrong parameters in OpenAPI schema for "file" #10824

kuzmi4 opened this issue Jan 3, 2022 · 0 comments · Fixed by #11290
Labels

Comments

@kuzmi4
Copy link

kuzmi4 commented Jan 3, 2022

Preflight Checklist

Describe the Bug

In "/files" and "/files/{id}" sections in OpenAPI missed parameters of global query.

        "/files": {
            "get": {
                "summary": "List Files",
                "description": "List the files.",
                "tags": [
                    "Files"
                ],
                "operationId": "getFiles",
                "responses": {
                    "200": {
                        "description": "Successful request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Files"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/UnauthorizedError"
                    }
                }
            },

Must be some like:

        "/files": {
            "get": {
                "summary": "List Files",
                "description": "List the files.",
                "tags": [
                    "Files"
                ],
                "operationId": "getFiles",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Fields"
                    },
                    {
                        "$ref": "#/components/parameters/Limit"
                    },
                    {
                        "$ref": "#/components/parameters/Offset"
                    },
                    {
                        "$ref": "#/components/parameters/Sort"
                    },
                    {
                        "$ref": "#/components/parameters/Filter"
                    },
                    {
                        "$ref": "#/components/parameters/Search"
                    },
                    {
                        "$ref": "#/components/parameters/Meta"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Files"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/UnauthorizedError"
                    }
                }
            },

Also File has wrong ref type: "$ref": "#/components/parameters/Id" - in schema ID - integer type, need change to "$ref": "#/components/parameters/UUId". (#10804 - this case)

        "/files/{id}": {
            "get": {
                "summary": "Retrieve a Files",
                "description": "Retrieve a single file by unique identifier.",
                "tags": [
                    "Files"
                ],
                "operationId": "getFile",
                "responses": {
                    "200": {
                        "description": "Successful request",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Files"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/UnauthorizedError"
                    }
                },
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Id"
                    }
                ]
            },

To Reproduce

Get latest OAS file from directus

Errors Shown

No response

What version of Directus are you using?

9.4.2

What version of Node.js are you using?

16.13.1

What database are you using?

Postgres 13

What browser are you using?

Firefox

What operating system are you using?

Linux 4.18.0-348.7.1.el8_5.x86_64

How are you deploying Directus?

Docker

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

Successfully merging a pull request may close this issue.

2 participants