Imported PhoenixSwagger.Path.delete/2 conflicts with local function

I am defining swagger_path for delete as follows in my controller file.

swagger_path :delete do
   description("Delete hospital")
   response(200, "OK")

And this gives me the following error when I try to access the Swagger API doc.

imported PhoenixSwagger.Path.delete/2 conflicts with local function

How to resolve this issue?


You probably have import PhoenixSwagger.Path in your controller and define a local delete/2 function while there is also a delete/2 in the imported module.

Either rename your delete/2 to something else, or use :except when importing. You might need to fully qualify calls to the PhoenixSwagger.Path.delete/2 then or use alias to make it a bit more convinient.

1 Like

Thanks NobbZ.

Yes, I have a local function delete/2 in my controller. This code was generated using mix phx.gen.json.

So, I will have to rename this local function(in which case I will have to update my router.ex for delete) or use fully qualified PhoenixSwagger.Path.delete/2. I tried the second option and it works. Thank you.