OpenAPITools / OpenAPITools/openapi-generator
[BUG] Javascript babel, weird output for comment block
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Using the javascript client module, when using npm run build, the first block comment in the files in src get distorted with a lot of blank spaces and renders navigation of the code really slow.
Initial block comment:
/**
* Custom API
* Custom API
*
* OpenAPI spec version: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
Block comment modified by babel and code added:
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* Custom API
* Custom API
*
* OpenAPI spec version: 0.0.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
Removing the .babelrc appears to prevent this distorsion.
openapi-generator version
4.0.0-beta3
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: Custom API
description: Custom API
version: 0.0.1
servers:
- url: "/api/v1"
paths:
/custom:
get:
summary: Returns a custom object
operationId: app.custom
responses:
'200':
description: Custom found
content:
application/json:
schema:
$ref: '#/components/schemas/object'
'404':
description: Custom not found
components:
schemas:
object:
description: Custom value
type: number
Command line used for generation
npx openapi-generator generate --skip-validate-spec -i custom.yml -g javascript -o custom_api_javascript
Steps to reproduce
After generating the module:
cd custom_api_javascript
npm install
npm run build
Related issues/PRs
None
Suggest a fix
Remove .babelrc, but it might be used for other things.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated JavaScript module's .babelrc and the files under src, then reproduce the issue with npm install and npm run build after generation with the provided command. Done means the first block comment remains readable without the large inserted indentation while the generated module still builds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100