[BUG][typescript-axios] The generated ts file from 5.0.0 cannot be transpiled.
See original GitHub issueBug 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?
- What’s the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The generation works fine with the 5.0.0-beta2
. When switching to the stable version 5.0.0
, the generated code has some compilation errors: TS2339: Property 'isJsonMime' does not exist on type 'Configuration'.
openapi-generator version
5.0.0
OpenAPI declaration file content or url
---
openapi: 3.0.0
info:
title: Swagger Test Service
description: Test Service for OpenApi version 2 aka. Swagger as YAML file.
version: 1.0.0
paths:
"/entities/{pathParam}":
parameters:
- in: path
name: pathParam
required: true
schema:
type: string
post:
summary: Test POST
operationId: postEntity
description: Test POST
parameters:
- in: query
name: queryParam
schema:
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
minItems: 0
items:
"$ref": "#/components/schemas/TestEntity"
tags:
- default
patch:
summary: Test PATCH
operationId: patchEntity
requestBody:
content:
application/json:
schema:
"$ref": "#/components/schemas/TestEntity"
responses:
'200':
description: Success
tags:
- default
components:
schemas:
TestEntity:
type: object
properties:
stringProperty:
type: string
description: A string property
integerProperty:
type: integer
description: An integer property
tags:
- name: default
Generation Details
npx openapi-generator-cli generate --input-spec /input-dir/open-api.json --generator-name typescript-axios --output /output-dir/openapi --template-dir /template-dir/templates --api-package api --model-package model --additional-properties withSeparateModelsAndApi=true --skip-validate-spec
Steps to reproduce
- Generate the client by using the command and the spec file above.
- Transpile the generated code and see
TS2339: Property 'isJsonMime' does not exist on type 'Configuration'.
Suggest a fix
Make isJsonMime
as an optional function of the type Configuration
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How do I import/reference/require a transpiled TypeScript file?
I have created a myLib.min.js / myLib.d.ts file combination from my TypeScript project using AMD module type, ES5 target and TypeScript 1.8 --outFile ......
Read more >@rollup/plugin-babel - npm
A Rollup plugin for seamless integration between Rollup and Babel. Why? If you're using Babel to transpile your ES6/7 code and Rollup to ......
Read more >Experimenting With ts-node And Using TypeScript In Node.js ...
This means that all TypeScript files should be loaded and transpiled before you have a chance to bind your HTTP server to a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This works, but honestly, it makes for a really not-nice API:
Before:
Now:
Hi @macjohnny , I resolve the issue by updating the configuration template from the
5.0.0
. Thank you for taking care.