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

Cast error when missing operation #549

Open
lud-wj opened this issue Jul 6, 2023 · 1 comment
Open

Cast error when missing operation #549

lud-wj opened this issue Jul 6, 2023 · 1 comment
Assignees

Comments

@lud-wj
Copy link

lud-wj commented Jul 6, 2023

     ** (UndefinedFunctionError) function :ok.operationId/0 is undefined (module :ok is not available)
     code: |> get("/my/route")
     stacktrace:
       :ok.operationId()
       (open_api_spex 3.17.3) lib/open_api_spex/plug/cast_and_validate.ex:124: OpenApiSpex.Plug.CastAndValidate.call/2
       

This happens because I have plug CastAndValidate, render_error: FallbackController but I forgot to declare the operation for some route.

I guess it should throw an explicit exception or maybe just let the request pass.

@zorbash zorbash self-assigned this Jul 6, 2023
@zorbash
Copy link
Contributor

zorbash commented Jul 6, 2023

Looks slightly similar to #447
You can use the following to silence such errors, but it does make to raise a more informative exception.

operation :some_action, false
def some_action(...) do
end

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