Fix a problem in the generation of typescript-jquery when we have enum in a query param (#7506)

This commit is contained in:
Jean-François Côté 2018-01-28 01:48:33 -05:00 committed by William Cheng
parent 1d661f3683
commit d1933b5fca
5 changed files with 16 additions and 7 deletions

View File

@ -72,6 +72,12 @@ public class TypeScriptJqueryClientCodegen extends AbstractTypeScriptClientCodeg
@Override
public String getSwaggerType(Property p) {
String swaggerType = super.getSwaggerType(p);
if (p instanceof StringProperty) {
StringProperty sp = (StringProperty) p;
if (sp.getEnum() != null) {
return swaggerType;
}
}
if (isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) {
return swaggerType;
}
@ -108,8 +114,11 @@ public class TypeScriptJqueryClientCodegen extends AbstractTypeScriptClientCodeg
@Override
public void postProcessParameter(CodegenParameter parameter) {
super.postProcessParameter(parameter);
if (!parameter.isEnum) {
parameter.dataType = addModelPrefix(parameter.dataType);
}
}
private void addNpmPackageGeneration() {
if (additionalProperties.containsKey(NPM_NAME)) {

View File

@ -1 +1 @@
2.3.1
2.4.0-SNAPSHOT

View File

@ -1,4 +1,4 @@
## @swagger/angular2-typescript-petstore@0.0.1
## @swagger/jquery-typescript-petstore@0.0.1
This generator creates TypeScript/JavaScript client that utilizes [jQuery](https://jquery.com/). The generated Node module can be used in the following environments:
@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
_published:_
```
npm install @swagger/angular2-typescript-petstore@0.0.1 --save
npm install @swagger/jquery-typescript-petstore@0.0.1 --save
```
_unPublished (not recommended):_

View File

@ -1,7 +1,7 @@
{
"name": "@swagger/angular2-typescript-petstore",
"name": "@swagger/jquery-typescript-petstore",
"version": "0.0.1",
"description": "JQuery client for @swagger/angular2-typescript-petstore",
"description": "JQuery client for @swagger/jquery-typescript-petstore",
"main": "api.js",
"scripts": {
"build": "tsc"