Skip to content

Invalid output when a parameter description contains a "." #985

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 task done
axelhzf opened this issue Nov 11, 2022 · 2 comments
Closed
1 task done

Invalid output when a parameter description contains a "." #985

axelhzf opened this issue Nov 11, 2022 · 2 comments

Comments

@axelhzf
Copy link
Contributor

axelhzf commented Nov 11, 2022

Description

When a parameter description contains a "." at the end, it produces an invalid typescript output. Here is a small schema that produce an invalid output

openapi: 3.0.0
info:
  title: A
  version: '1.0'
paths:
  '/programs/{id}/data':
    parameters:
      - name: id
        in: path
        schema:
          type: string
        required: true
        description: Description.
    get:
      responses:
        200:
          description: OK.
          content:
            "application/json":
              schema:
                type: string

The code generated is

export interface paths {
  "/programs/{id}/data": {
    get: {
      responses: {
        /** @description OK. */
        200: {
          content: {
            "application/json": string;
          };
        };
      };
    };
    {
    parameters: {
        /** @description Description. */
      path: {
        id: string;
      };
    };
  }
  };
}

There are an extra {} around parameters. If I remove the "." at the end of the description, the generation works correctly.

Name Version
openapi-typescript 6.0.2
Node.js 16.17.1
OS + version macOS 13

Reproduction

Generate the types from the previous schema

Expected result

(in case it’s not obvious)

Checklist

@axelhzf
Copy link
Contributor Author

axelhzf commented Nov 13, 2022

Fixed by #986

@axelhzf axelhzf closed this as completed Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant