forked from loafle/openapi-generator-original
[TypeScript Client] fix install Aurelia + fix use deprecated function (#2514)
* [TypeScript Client] fix install Aurelia + fix use deprecated function in typescript client codegen * [TypeScript Client] Aurelia - update typescript version * [TypeScript Client] Aurelia - update typescript version
This commit is contained in:
parent
cd6779584f
commit
d056df6250
@ -36,6 +36,7 @@ declare -a scripts=(
|
||||
"./bin/php-ze-ph-petstore-server.sh"
|
||||
"./bin/openapi3/php-petstore.sh"
|
||||
"./bin/typescript-angular-petstore-all.sh"
|
||||
"./bin/typescript-aurelia-petstore.sh"
|
||||
"./bin/typescript-axios-petstore-all.sh"
|
||||
"./bin/typescript-fetch-petstore-all.sh"
|
||||
"./bin/typescript-node-petstore-all.sh"
|
||||
|
@ -22,6 +22,7 @@ import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.utils.SemVer;
|
||||
import org.openapitools.codegen.utils.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -512,7 +513,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
||||
if (name.length() == 0) {
|
||||
return "DefaultService";
|
||||
}
|
||||
return initialCaps(name) + serviceSuffix;
|
||||
return StringUtils.camelize(name) + serviceSuffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,6 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -104,7 +105,7 @@ public class TypeScriptAureliaClientCodegen extends AbstractTypeScriptClientCode
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
// Aurelia uses "asGet", "asPost", ... methods; change the method format
|
||||
op.httpMethod = initialCaps(op.httpMethod.toLowerCase(Locale.ROOT));
|
||||
op.httpMethod = StringUtils.camelize(op.httpMethod.toLowerCase(Locale.ROOT));
|
||||
|
||||
// Collect models to be imported
|
||||
for (CodegenParameter param : op.allParams) {
|
||||
|
@ -23,6 +23,7 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.utils.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -321,7 +322,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo
|
||||
if (name.length() == 0) {
|
||||
return "DefaultService";
|
||||
}
|
||||
return initialCaps(name) + "Service";
|
||||
return StringUtils.camelize(name) + "Service";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,6 +21,7 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.openapitools.codegen.utils.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -98,7 +99,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen
|
||||
if (name.length() == 0) {
|
||||
return "Default" + apiSuffix;
|
||||
}
|
||||
return initialCaps(name) + apiSuffix;
|
||||
return StringUtils.camelize(name) + apiSuffix;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,11 +18,13 @@ Module system
|
||||
|
||||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
|
||||
|
||||
### Installation ###
|
||||
### Building ####
|
||||
|
||||
`openapi-generator` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`.
|
||||
|
||||
CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`.
|
||||
To build and compile the typescript sources to javascript use:
|
||||
```
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
#### NPM ####
|
||||
You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope).
|
||||
|
@ -1,21 +1,23 @@
|
||||
{
|
||||
"name": "{{#npmName}}{{{npmName}}}{{/npmName}}{{^npmName}}typescript-fetch-api{{/npmName}}",
|
||||
"name": "{{#npmName}}{{{npmName}}}{{/npmName}}{{^npmName}}typescript-aurelia-api{{/npmName}}",
|
||||
"version": "{{#npmVersion}}{{{npmVersion}}}{{/npmVersion}}{{^npmVersion}}0.0.0{{/npmVersion}}",
|
||||
"license": "Unlicense",
|
||||
"main": "./dist/api.js",
|
||||
"browser": "./dist/api.js",
|
||||
"typings": "./dist/api.d.ts",
|
||||
"main": "./dist/Api.js",
|
||||
"browser": "./dist/Api.js",
|
||||
"typings": "./dist/Api.d.ts",
|
||||
"dependencies": {
|
||||
{{^supportsES6}}"core-js": "^2.4.0",
|
||||
{{/supportsES6}}"isomorphic-fetch": "^2.2.1"
|
||||
{{/supportsES6}}"isomorphic-fetch": "^2.2.1",
|
||||
"aurelia-framework": "^1.3.1",
|
||||
"aurelia-http-client": "^1.3.0"
|
||||
},
|
||||
"scripts" : {
|
||||
"prepublish" : "typings install && tsc",
|
||||
"test": "tslint api.ts"
|
||||
"scripts": {
|
||||
"build": "tsc --outDir dist/",
|
||||
"prepare": "npm run build",
|
||||
"test": "tslint Api.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tslint": "^3.15.1",
|
||||
"typescript": "^1.8.10",
|
||||
"typings": "^1.0.4"
|
||||
"typescript": "^2.4 || ^3.0"
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,14 @@
|
||||
"noImplicitAny": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": ".",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
]
|
||||
],
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
|
@ -18,11 +18,13 @@ Module system
|
||||
|
||||
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
|
||||
|
||||
### Installation ###
|
||||
### Building ####
|
||||
|
||||
`openapi-generator` does not generate JavaScript directly. The generated Node module comes with `package.json` that bundles `typescript` and `typings` so it can self-compile during `prepublish` stage. The should be run automatically during `npm install` or `npm publish`.
|
||||
|
||||
CAVEAT: Due to [privilege implications](https://docs.npmjs.com/misc/scripts#user), `npm` would skip all scripts if the user is `root`. You would need to manually run it with `npm run prepublish` or run `npm install --unsafe-perm`.
|
||||
To build and compile the typescript sources to javascript use:
|
||||
```
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
#### NPM ####
|
||||
You may publish the module to NPM. In this case, you would be able to install the module as any other NPM module. It maybe useful to use [scoped packages](https://docs.npmjs.com/misc/scope).
|
||||
|
@ -1,21 +1,23 @@
|
||||
{
|
||||
"name": "typescript-fetch-api",
|
||||
"name": "typescript-aurelia-api",
|
||||
"version": "0.0.0",
|
||||
"license": "Unlicense",
|
||||
"main": "./dist/api.js",
|
||||
"browser": "./dist/api.js",
|
||||
"typings": "./dist/api.d.ts",
|
||||
"main": "./dist/Api.js",
|
||||
"browser": "./dist/Api.js",
|
||||
"typings": "./dist/Api.d.ts",
|
||||
"dependencies": {
|
||||
"core-js": "^2.4.0",
|
||||
"isomorphic-fetch": "^2.2.1"
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"aurelia-framework": "^1.3.1",
|
||||
"aurelia-http-client": "^1.3.0"
|
||||
},
|
||||
"scripts" : {
|
||||
"prepublish" : "typings install && tsc",
|
||||
"test": "tslint api.ts"
|
||||
"scripts": {
|
||||
"build": "tsc --outDir dist/",
|
||||
"prepare": "npm run build",
|
||||
"test": "tslint Api.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tslint": "^3.15.1",
|
||||
"typescript": "^1.8.10",
|
||||
"typings": "^1.0.4"
|
||||
"typescript": "^2.4 || ^3.0"
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,15 @@
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "."
|
||||
"rootDir": ".",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist",
|
||||
|
Loading…
x
Reference in New Issue
Block a user