Skip to content

Instantly share code, notes, and snippets.

@karlosmid
Created July 13, 2020 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karlosmid/051fe628b35273bfe07631a3183a61b8 to your computer and use it in GitHub Desktop.
Save karlosmid/051fe628b35273bfe07631a3183a61b8 to your computer and use it in GitHub Desktop.
Phoenix Swagger validation in production
def start(_type, _args) do
if Application.fetch_env!(:your_app_name, :production) do
PhoenixSwagger.Validator.parse_swagger_schema(
Path.join(["#{:code.priv_dir(:your_app_name)}", "static", "swagger.json"])
)
else
PhoenixSwagger.Validator.parse_swagger_schema("priv/static/swagger.json")
end
// ... rest of your Phoenix Application start up code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment