You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating a Typescript client from specs where API responses have a field named constructor defined, the generated model file corresponding to the Response object contains the following error: Classes may not have a field named 'constructor'.
openapi-generator version
6.2.0
OpenAPI declaration file content or url
tsbug.yaml:
openapi: 3.0.2
info:
title: Test API
version: '0.0'
contact:
name: Curvegrid
description: Test API.
servers:
- url: 'https://localhost:8080'
tags:
- name: tests
paths:
/tsbug:
get:
operationId: test-bug
summary: Test bug
description: A test endpoint for the typescript bug.
tags:
- tests
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/TestResponse'
components:
schemas:
TestResponse:
title: TestResponse
type: object
description: The response object for the test endpoint.
properties:
constructor:
type: string
required:
- constructor
Bug Report Checklist
Description
When generating a Typescript client from specs where API responses have a field named
constructor
defined, the generated model file corresponding to the Response object contains the following error:Classes may not have a field named 'constructor'.
openapi-generator version
6.2.0
OpenAPI declaration file content or url
tsbug.yaml
:Generation Details
Steps to reproduce
openapi-generator generate -g typescript -i tsbug.yaml -o typescript_client
Related issues/PRs
Suggest a fix
Add
constructor
to the list of reserved words for the typescript client.The text was updated successfully, but these errors were encountered: