openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG][HASKELL] Multiple SecuritySchemes produce Multiple Declarations Error

Open kaewik opened this issue 3 years ago • 1 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [ ] What's the actual output vs expected output?
  • [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When specifying multiple securitySchemes one cannot compile the generated Haskell code.

openapi-generator version

6.1.0-SNAPSHOT

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  version: 1.0.0
  title: My API
  description: some description
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
paths:
  /test:
    get:
      responses:
        '200':
          description: some description

Generation Details

No config. Nothing special

Steps to reproduce
  1. create minimal.yaml with the content above
  2. docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:latest generate -o /local/out -g haskell -i /local/minimal.yaml
  3. cd out/
  4. stack build <-- fails

kaewik avatar Jul 27 '22 23:07 kaewik

Hi @lugggas,

if you specify security schemes the generated code uses servants generalized authencitation. It currently does not support multiple schemes simultaneously (https://github.com/OpenAPITools/openapi-generator/pull/12470). An alternative solution that could work is to use wai middlewares (wai-extra and probably wai-middleware-bearer).

7omb avatar Aug 09 '22 17:08 7omb