openapi-generator
openapi-generator copied to clipboard
[BUG][HASKELL] Multiple SecuritySchemes produce Multiple Declarations Error
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
- create
minimal.yamlwith the content above -
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:latest generate -o /local/out -g haskell -i /local/minimal.yaml -
cd out/ -
stack build<-- fails
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).