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
  • #12938
Closed
Open
Issue created Jul 20, 2022 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][typescript-nestjs] Undefined `queryParameters` for Service with authentication

Created by: Panzer1119

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?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Some of the generated Nest Services have undefined queryParameters if the operation doesn't use query parameters, but authentication via apikey (as query parameter).

openapi-generator version

6.0.1

OpenAPI declaration file content or url

Radarr API

Generation Details
additionalProperties:
  nestVersion: 6.0.0
  fileNaming: kebab-case
  nestVersion: 9.0.4
  supportsES6: true
  stringEnums: true
  enumPropertyNaming: UPPERCASE
Steps to reproduce

Generate the API Client and inspect the api/*.service.ts files.

openapi-generator-cli generate -g typescript-nestjs -i https://raw.githubusercontent.com/Radarr/Radarr/develop/src/Radarr.Api.V3/openapi.json --additional-properties=fileNaming=kebab-case,nestVersion=9.0.4,supportsES6=true,stringEnums=true,enumPropertyNaming=UPPERCASE
Related issues/PRs
Suggest a fix

If hasQueryParams is false, then queryParameters doesn't get initialized here:

https://github.com/OpenAPITools/openapi-generator/blob/92193f7159d62419634c51eb7d2e9a4e0697d283/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache#L72-L73

So just initialize queryParameters here (with a check for hasQueryParams e.g. {{^hasQueryParams}}):

https://github.com/OpenAPITools/openapi-generator/blob/92193f7159d62419634c51eb7d2e9a4e0697d283/modules/openapi-generator/src/main/resources/typescript-nestjs/api.service.mustache#L123-L128

Assignee
Assign to
Time tracking