forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[typescript-angular] add customized encoder to use '+' char in query …
…parameter swagger-api#6306
- Loading branch information
Showing
21 changed files
with
177 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
modules/swagger-codegen/src/main/resources/typescript-angular2/encoder.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* CustomQueryEncoderHelper | ||
* Fix plus sign (+) not encoding, so sent as blank space | ||
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318 | ||
*/ | ||
import { QueryEncoder } from "@angular/http"; | ||
|
||
export class CustomQueryEncoderHelper extends QueryEncoder { | ||
encodeKey(k: string): string { | ||
k = super.encodeKey(k); | ||
return k.replace(/\+/gi, '%2B'); | ||
} | ||
encodeValue(v: string): string { | ||
v = super.encodeValue(v); | ||
return v.replace(/\+/gi, '%2B'); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
samples/client/petstore-security-test/typescript-angular2/.swagger-codegen/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.3-SNAPSHOT | ||
2.3.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
samples/client/petstore-security-test/typescript-angular2/encoder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* CustomQueryEncoderHelper | ||
* Fix plus sign (+) not encoding, so sent as blank space | ||
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318 | ||
*/ | ||
import { QueryEncoder } from "@angular/http"; | ||
|
||
export class CustomQueryEncoderHelper extends QueryEncoder { | ||
encodeKey(k: string): string { | ||
k = super.encodeKey(k); | ||
return k.replace(/\+/gi, '%2B'); | ||
} | ||
encodeValue(v: string): string { | ||
v = super.encodeValue(v); | ||
return v.replace(/\+/gi, '%2B'); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
samples/client/petstore-security-test/typescript-angular2/variables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { InjectionToken<string> } from '@angular/core'; | ||
import { InjectionToken } from '@angular/core'; | ||
|
||
export const BASE_PATH = new InjectionToken<string>('basePath'); | ||
export const COLLECTION_FORMATS = { | ||
'csv': ',', | ||
'tsv': ' ', | ||
'ssv': ' ', | ||
'pipes': '|' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
samples/client/petstore/typescript-angular2/default/encoder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* CustomQueryEncoderHelper | ||
* Fix plus sign (+) not encoding, so sent as blank space | ||
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318 | ||
*/ | ||
import { QueryEncoder } from "@angular/http"; | ||
|
||
export class CustomQueryEncoderHelper extends QueryEncoder { | ||
encodeKey(k: string): string { | ||
k = super.encodeKey(k); | ||
return k.replace(/\+/gi, '%2B'); | ||
} | ||
encodeValue(v: string): string { | ||
v = super.encodeValue(v); | ||
return v.replace(/\+/gi, '%2B'); | ||
} | ||
} |
Oops, something went wrong.