Skip to content

Problem using --array-length when minItems equals to maxItems #1781

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
1 of 2 tasks
Couc opened this issue Jul 24, 2024 · 3 comments
Closed
1 of 2 tasks

Problem using --array-length when minItems equals to maxItems #1781

Couc opened this issue Jul 24, 2024 · 3 comments
Labels
bug Something isn't working openapi-ts Relevant to the openapi-typescript library stale

Comments

@Couc
Copy link

Couc commented Jul 24, 2024

Hello everyone :)
Description

When using --array-length flag and minItems, maxItems with identical values in schema definition, the generated interface is [].

Name Version
openapi-typescript >=7.0.0
Node.js 20.15.0
OS + version Windows 10

Reproduction

Run openapi-typescript with --array-length flag set to true on yaml :

openapi: 3.1.0
info:
  title: Webhook Example
  summary: My lovely API
  version: 1.0.0
  description: some description
  license:
    name: MIT
    identifier: MIT
    url: https://opensource.org/licenses/MIT
jsonSchemaDialect: https://spec.openapis.org/oas/3.1/dialect/base
tags:
  - name: Gameplay
    description: gameplay tag
servers:
  - url: https://redocly-example.com/{var}
    variables:
      var:
        enum:
          - a
          - b
        default: b
security: []
paths:
  /pets/items:
    get:
      operationId: getTest
      summary: Get Test! Foo! Etc!
      responses:
        200:
          description: '200'
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                minItems: 3
                maxItems: 3
        400:
          description: An error response

Expected Result
The part "application/json" should be typed as "[string, string, string]" in :

responses: {
            /** @description 200 */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": [string, string, string];
                };
            };

Current Result

responses: {
            /** @description 200 */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": [];
                };
            };

Checklist

@Couc Couc added bug Something isn't working openapi-ts Relevant to the openapi-typescript library labels Jul 24, 2024
@PartyWumpus
Copy link

I've got the same issue.

Copy link
Contributor

This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

@github-actions github-actions bot added the stale label Oct 23, 2024
Copy link
Contributor

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
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 stale
Projects
None yet
Development

No branches or pull requests

2 participants