[BUG][NodeJS-Express-Server ReferenceRequestBodies are not parsed by the controller
Created by: RalphBragg
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? - [5] 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
The NodeJS Express Server generator controller.js does not process reference request bodies. Is there are a way to make it do so?
openapi-generator version
5
OpenAPI declaration file content or url
post:
operationId: organisationsOrganisationIdAuthorisationserversPOST
parameters:
- description: The organisation ID
explode: false
in: path
name: OrganisationId
required: true
schema:
$ref: '#/components/schemas/OrganisationId'
style: simple
requestBody:
$ref: '#/components/requestBodies/AuthorisationServerRequest'
responses:
"201":
content:
application/json:
schema:
$ref: '#/components/schemas/AuthorisationServer'
description: Authorisation server response
"400":
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequest'
description: Bad Request
"401":
description: Unauthorized
"404":
description: Not found
"406":
description: Not Acceptable
"500":
description: Internal Server Error
"502":
description: Bad Gateway
security:
- authorizer: []
summary: Create an Authorisation Server for the given organisation
tags:
- Authorisation Servers
x-eov-operation-handler: controllers/AuthorisationServersController
Command line used for generation
OPENAPI_GENERATOR_VERSION=5.0.0-SNAPSHOT openapi-generator-cli generate -i /TrustFramework.yaml -o ./output -g nodejs-express-server
Steps to reproduce
- Generate the server.
- Test that GETs function correctly.
- Post's fail to process throwing an undefined exception in Controller.js collectRequestParams() const { content } = request.openapi.schema.requestBody; as content is undefined whent the requestbody is a reference.
Related issues/PRs
Suggest a fix
Can reference request bodies be handled