PhoenixSpec.Discovery (PhoenixSpec v0.1.1)

View Source

Discovers response modules associated with controllers in a Phoenix application.

Summary

Functions

Returns the JSON view module for a controller, following Phoenix 1.7+ conventions.

Finds response modules for the given router's controllers.

Functions

controller_to_json_view(controller)

@spec controller_to_json_view(module()) :: module() | nil

Returns the JSON view module for a controller, following Phoenix 1.7+ conventions.

MyAppWeb.PostControllerMyAppWeb.PostJSON

json_views_from_router(router)

@spec json_views_from_router(module()) :: [module()]

Finds response modules for the given router's controllers.

Phoenix *JSON modules are preferred. A controller is returned as its own response module when it renders JSON inline.