Skip to content

Java MultiValueMap generates invalid types when run through openapi-typescript #1273

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

Closed
2 tasks done
djMax opened this issue Aug 4, 2023 · 1 comment
Closed
2 tasks done
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library

Comments

@djMax
Copy link

djMax commented Aug 4, 2023

Description

The following OpenAPI component:

    MultiValueMapStringString:
      type: object
      properties:
        all:
          type: object
          additionalProperties:
            type: string
          writeOnly: true
        empty:
          type: boolean
      additionalProperties:
        type: array
        items:
          type: string

Generates the following invalid Typescript:

    MultiValueMapStringString: {
      all?: {
        [key: string]: string | undefined;
      };
      empty?: boolean;
      [key: string]: string[] | undefined;
    };
Property 'all' of type '{ [key: string]: string; }' is not assignable to 'string' index type 'string[]'.ts(2411)
Name Version
openapi-typescript 6.3.9
Node.js 18.16.0
OS + version macOS 13.2.1

Reproduction

The schema above should generate the invalid Typescript

Expected result

Checklist

  • My OpenAPI schema passes the Redocly validator (npx @redocly/cli@latest lint) - lots of little nits about summaries and such, but overall yes
  • I’m willing to open a PR (see CONTRIBUTING.md)
@djMax djMax added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Aug 4, 2023
@drwpow
Copy link
Contributor

drwpow commented Aug 20, 2023

This is a duplicate of other issues, but tracking in #1018. Though the problem isn’t completely fixed yet, it will be in an upcoming version.

@drwpow drwpow closed this as completed Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library
Projects
None yet
Development

No branches or pull requests

2 participants