servant icon indicating copy to clipboard operation
servant copied to clipboard

[servant-auth] Support for `servant-openapi3`?

Open Juneezee opened this issue 3 years ago • 2 comments

Using the official Todo.hs example from servant-openapi3, I get the following error when using the Auth combinator of servant-auth:

Todo.hs:62:15: error:
    • No instance for (HasOpenApi
                         (Auth '[BasicAuth] :> Get '[JSON] [Todo]))
        arising from a use of ‘toOpenApi’
    • In the first argument of ‘(&)’, namely ‘toOpenApi todoAPI’
      In the first argument of ‘(&)’, namely
        ‘toOpenApi todoAPI & info . title .~ "Todo API"’
      In the first argument of ‘(&)’, namely
        ‘toOpenApi todoAPI & info . title .~ "Todo API"
           & info . version .~ "1.0"’
   |
62 | todoSwagger = toOpenApi todoAPI
   |               ^^^^^^^^^^^^^^^^^

Could we have an official support of servant-openapi3 package by providing the instances for HasOpenApi through servant-auth-openapi3? (similar to servant-auth-swagger)

Juneezee avatar Jan 10 '22 02:01 Juneezee

Hi, thank you very much for the request, it will be done. :)

tchoutri avatar Jan 10 '22 06:01 tchoutri

I feel like the best place for this instance is servant-openapi3 and not servant-auth, because that's where the typeclass and all instances currently live. Core servant packages do not have to know about servant-openapi3.

gdeest avatar Jan 17 '22 11:01 gdeest