[BUG] [Typescript] Missing type
Eywek opened this issue · comments
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?
Description
See examples below
openapi-generator version
From v4.3.0 to 5.0.0-SNAPSHOT
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: datasources-v2-frontend
version: 0.0.0
paths:
'/{id}':
patch:
parameters:
-
name: id
in: path
schema:
type: string
required: true
responses:
'200':
description: Ok
content:
application/json:
schema:
type: object
properties:
data: {type: object, properties: {}}
required:
- data
tags:
- Datasource
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Partial_WorkerDatasourceVersion__'
operationId: update-datasource
components:
schemas:
ApiOptions_:
type: object
properties:
oauth:
type: string
method:
oneOf:
-
type: string
enum:
- GET
-
type: string
enum:
- PATCH
-
type: string
enum:
- POST
-
type: string
enum:
- PUT
body:
type: string
headers:
type: object
properties: {}
additionalProperties:
type: string
query:
type: object
properties: {}
additionalProperties:
type: string
pagination:
oneOf:
-
type: object
properties:
type:
type: string
enum: [query]
value:
type: string
required:
- type
- value
-
type: object
properties:
type:
type: string
enum: [hypermediaAttribute]
value:
type: string
required:
- type
- value
ApiOptions:
$ref: '#/components/schemas/ApiOptions_'
Partial_WorkerDatasourceVersion__:
type: object
properties:
companyId:
type: string
resourceGroupIds:
type: array
items:
type: string
name:
type: string
apiOptions:
$ref: '#/components/schemas/ApiOptions'
Generation Details
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v4.3.0 generate \
--additional-properties=useSingleRequestParameter=true,enumPropertyNaming=UPPERCASE \
-i /local/swagger.yaml \
-g typescript-axios \
-o /local/client
Generated typescript:
/**
*
* @export
* @interface PartialWorkerDatasourceVersion
*/
export interface PartialWorkerDatasourceVersion {
/**
*
* @type {string}
* @memberof PartialWorkerDatasourceVersion
*/
companyId?: string;
/**
*
* @type {Array<string>}
* @memberof PartialWorkerDatasourceVersion
*/
resourceGroupIds?: Array<string>;
/**
*
* @type {string}
* @memberof PartialWorkerDatasourceVersion
*/
name?: string;
/**
*
* @type {ApiOptions}
* @memberof PartialWorkerDatasourceVersion
*/
apiOptions?: ApiOptions;
}
The type ApiOptions
is never defined. Probably because the ApiOptions
ref to ApiOptions
with an underscore and the underscore gets removed by the generator leading to this bug.