[BUG][javascript-flowtyped] Flow check error (node.js)
Created by: zole40
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output?
Description
I found the following problem in the generated code when tried to run the flow check
:
Cannot delete localVarUrlObj.search because undefined [1] is incompatible with null [2]. [incompatible-type]
openapi/src/api.js
localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
[1] delete localVarUrlObj.search;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
return {
/private/tmp/flow/flowlib_34e1ce2/node.js
[2] 2191│ search: string | null,
openapi-generator version: 4.3.1
OpenAPI declaration file content or url
openapi: '3.0.3'
info:
version: 0.1.0
title: Test
servers:
- url: /api
tags:
- name: test
description: |
paths:
/dummy:
get:
summary: Dummy endpoint.
operationId: dummy
tags:
- simulation
description: |
Dummy endpoint.
responses:
'200':
description: Success call
content:
application/json:
schema:
$ref: '#/components/schemas/DummySuccess'
default:
description: Server error
content:
application/json:
schema:
$ref: '#/components/schemas/DummyError'
components:
schemas:
DummySuccess:
type: string
example: ok
DummyError:
properties:
errorMassage:
type: string
example: error
Generation Details
- generatorName = "javascript-flowtyped"
Steps to reproduce
- run generator javascript-flowtyped
- run flow check
Related issues/PRs
Suggest a fix
Change this line delete localVarUrlObj.search;
to this localVarUrlObj.search = null;
It could solve the flow issue. It is seen to be ok, but I did not test it all possibilities yet.