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

Responses using ref aren't supported #59

Open
JohnRoux opened this issue Sep 18, 2020 · 0 comments
Open

Responses using ref aren't supported #59

JohnRoux opened this issue Sep 18, 2020 · 0 comments
Assignees

Comments

@JohnRoux
Copy link

Currently only schema references are supported.
I think we need to do a couple checks here as several swagger objects should be supported.

My use-case for this is pretty simple. Api has a couple of generic responses (404, 401 etc), duplicating all of those for each request isn't ideal, and the perfect usecase for using a ref.

This is where the issue is actually breaking
AbstractBody Line 331:

 if(!isset($schemaArray['$ref']) && isset($schemaArray['content'])) {
            $schemaArray['$ref'] = $schemaArray['content'][key($schemaArray['content'])]['schema']['$ref'];
        }

Api Doc Example:

"/api/user": {
            "get": {
                "tags": [
                    "User"
                ],
                "summary": "Get list of all users",
                "description": "Returns list of users",
                "operationId": "user_index",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/UserIncludes"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "User Collection",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/User"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "404": {
                        "$ref": "#/components/responses/ModelNotFound"
                    }
                },
                "security": [
                    {
                        "apiAuth": []
                    }
                ]
            }
        },
@byjg byjg self-assigned this Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants