Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Erlang-Server generator doesn't apply context changes from security definitions to request handlers after validation is successful. In the spec provided there is an api-key validation that attempts to attach a field to the context to be passed into whatever request handler succeeds the call. The values are passed into the state of the open_api handler but not accessed when the request handler is called.
openapi-generator version
4.3.0
OpenAPI declaration file content or url
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "header"
}
},
-spec authorize_api_key(OperationID ::
openapi_api:operation_id(),
ApiKey :: binary()) -> {true, #{}}.
in the above setting anything in the map return value doesn't populate on a succeeding handle_request/3
call.
Command line used for generation
compiled jar=>
swagger generate -i ./src/handler/swagger.json -g erlang-server -o ./apps/openapi
Steps to reproduce
- add security definition to an existing endpoint
- assign a value to the context map in the authorization handler.
- attempt to access that value in the succeeding request handler.
Related issues/PRs
#5751
created pr after filing issue, needs approved.
Suggest a fix
fix is map merging state context and params from openapi_api.erl. PR to follow shortly.