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

Support passing a %Reference{} as a response when doing controller specs #532

Conversation

mracos
Copy link
Contributor

@mracos mracos commented Apr 5, 2023

Fixes #530

@@ -27,6 +27,7 @@ defmodule OpenApiSpexTest.UserControllerAnnotated do
},
unauthorized: Unauthorized.response(),
not_found: NotFound.response(),
unprocessable_entity: %Reference{"$ref": "#/components/responses/unprocessable_entity"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the referenced response defined? In the tests we should show how such references are mean to be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like this? 0ccecab

@@ -27,6 +27,7 @@ defmodule OpenApiSpexTest.UserControllerAnnotated do
},
unauthorized: Unauthorized.response(),
not_found: NotFound.response(),
unprocessable_entity: %Reference{"$ref": "#/components/responses/unprocessable_entity"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also update examples/phoenix_app showing how this can be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? a3824e4

@tegon
Copy link

tegon commented May 17, 2023

Hey @zorbash is anything holding this off?

@zorbash
Copy link
Contributor

zorbash commented May 18, 2023

Hey @zorbash is anything holding this off?

I tested this locally in some of my apps and seems to be working without issues.

@zorbash zorbash merged commit 0db3946 into open-api-spex:master May 18, 2023
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

Successfully merging this pull request may close these issues.

Components in operations responses
3 participants