Skip to content

[BUG][typescript-node] additionalProperties are ignored #14661

Description

@fetis

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

additionalProperties for components from schema are completely ignored and missed in the output

openapi-generator version

6.3.0

OpenAPI declaration file content or URL

In #/components/schemas

      "PizzaDto": {
        "type": "object",
        "required": [
          "id",
          "name",
          "ingredients"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "ingredients": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id"
              ],
              "properties": {
                "id": {
                  "type": "string"
                }
              }
            }
          }
        },
        "additionalProperties": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
Generation Details

The schema above with default options produces

export class PizzaDto extends null<String, Array> {
    'id': string;
    'name': string;
    'ingredients': Array<PizzaDtoIngredientsInner>;
}

Please note that strange extends null and missed additional props

The expected output should be smth like this

export class PizzaDto  {
    'id': string;
    'name': string;
    'ingredients': Array<PizzaDtoIngredientsInner>;
    [key: string]: string[] | any
}
Steps to reproduce
  1. Run generation with the provided schema
  2. Check the model in pizzaDto.ts
Related issues/PRs

The correct generation was introduced in this PR #4698 but it's broken now.

Suggest a fix

Check the previous implementation of borrow it from typescript-angular (it does it correctly)

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions