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

Add operation lookup by phoenix {controller, action} #102

Merged
merged 1 commit into from
Apr 28, 2019

Conversation

mbuhot
Copy link
Collaborator

@mbuhot mbuhot commented Apr 21, 2019

This optimization avoids having to call controller.open_api_operation(action)
in each call to CastAndValidate for phoenix controllers.

The caching behaviour is moved into a separate module OpenApiSpex.Plug.Cache, and
updated from CastAndValidate the first time a phoenix controller/action
is used to resolve an Operation.

With this optimization in place, it becomes reasonable to use the @doc based Operation definitions accessed with Code.fetch_docs/1 at runtime.

@mbuhot mbuhot force-pushed the lookup-operation-by-phoenix-controller-action branch 2 times, most recently from dbe879d to e68f25f Compare April 21, 2019 08:11
@mbuhot mbuhot requested a review from moxley April 21, 2019 08:16
@mbuhot
Copy link
Collaborator Author

mbuhot commented Apr 21, 2019

These changes may also be helpful for #72, we could have a no-op Cache adapter in :dev mode.

Copy link
Contributor

@moxley moxley left a comment

Choose a reason for hiding this comment

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

Nice @mbuhot! Looking forward to moving forward with the @doc-based operation specs.

This optimization avoids having to call open_api_operation(action)
in each call to CastAndValidate for phoenix controllers.

The caching behaviour is moved into a separate module, and
updated from CastAndValidate the first time a phoenix controller/action
is used to resolve an Operation.
@mbuhot mbuhot force-pushed the lookup-operation-by-phoenix-controller-action branch from e68f25f to 74bf213 Compare April 28, 2019 06:20
@mbuhot mbuhot merged commit 60eda20 into master Apr 28, 2019
@mbuhot mbuhot deleted the lookup-operation-by-phoenix-controller-action branch April 28, 2019 06:28
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.

2 participants