Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7382
Closed
Open
Issue created Sep 09, 2020 by Administrator@rootContributor5 of 5 checklist items completed5/5 checklist items

[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.

Assignee
Assign to
Time tracking