Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][TypeScript] Bug Any Type is mapped to an object data type in TypeScript #20123

Open
5 of 6 tasks
phalgunv opened this issue Nov 17, 2024 · 0 comments
Open
5 of 6 tasks

Comments

@phalgunv
Copy link

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

As per Swagger documentation for Any Type

{} is shorthand syntax for an arbitrary-type schema

openapi-generator-cli maps shorthand for any type {} to object data type when language is set to typescript-angular

openapi-generator version

7.9.0
It is not a regression.

OpenAPI declaration file content or url

Swagger file:
https://github.com/tmforum-apis/TMF620_ProductCatalog/blob/master/TMF620-ProductCatalog-v4.0.0.swagger.json

Please see excerpt for CharacteristicValueSpecification.value

                "value": {
                    "$ref": "#/definitions/Any",
                    "description": "A discrete value that the characteristic can take on, or the actual value of the characteristic"
                }
        "Any": {},
Generation Details

Language: typescript-angular

Steps to reproduce

openapi-generator-cli generate -i https://raw.githubusercontent.com/tmforum-apis/TMF620_ProductCatalog/refs/heads/master/TMF620-ProductCatalog-v4.0.0.swagger.json -g typescript-angular -o ./openapi-generator-cli-TMF620_generated-typescript-models

$ grep "value?" ./openapi-generator-cli-TMF620_generated-typescript-models/model/characteristicValueSpecification.ts
    value?: object;
Related issues/PRs
Suggest a fix

Below type could be used instead of object

type AnyValue = string | number | boolean | any[] | { [key: string]: any };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant