OpenAPITools / OpenAPITools/openapi-generator

[BUG] [typescript] lacks support for parameters serialization with array and object values

Open
#17,283 0 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

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)?
  • 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

Current implementation of path, query and header parameters serialization has support only for primitive values.

openapi-generator version

Tested 7.1.0 and master. Not a regression.

OpenAPI declaration file content or url
paths:
  /some-path/{foo}/{bar}:
    parameters:
      - in: path
        name: foo
        required: true
        schema:
          type: array
          items:
            type: string
      - in: path
        name: bar
        required: true
        schema:
          type: object
          properties:
            baz:
              type: string
      - in: query
        name: qux
        required: true
        schema:
          type: array
          items:
            type: string
      - in: query
        name: quux
        required: true
        schema:
          type: object
          properties:
            baz:
              type: string
      - in: header
        name: quux
        required: true
        schema:
          type: object
          properties:
            baz:
              type: string
Generation Details
openapi-generator-cli generate --generator-name="typescript" --additional-properties="enumPropertyNaming=original,modelPropertyNaming=original"
Related issues/PRs
Suggest a fix

Properly implement spec with proper support for style and explode options.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the TypeScript generator entry point used by the supplied openapi-generator-cli command, then trace serialization for path, query, and header parameters. Reproduce the issue with the provided OpenAPI YAML, focusing on array and object values and their style/explode options. Done means generated TypeScript clients serialize these parameters according to the OpenAPI specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.