Skip to content

parse in path variable name with dash error #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Mr-sgreen opened this issue Mar 2, 2021 · 3 comments
Closed

parse in path variable name with dash error #184

Mr-sgreen opened this issue Mar 2, 2021 · 3 comments
Assignees
Labels
bug Something isn't working next release

Comments

@Mr-sgreen
Copy link

Condition:

part of the swagger json file as follows:

"/location/{location-code}/content": {
			"get": {
				"summary": "find location content by location code",
				"deprecated": false,
				"produces": [
					"*/*"
				],
				"operationId": "findLocationPushContentUsingGET",
				"responses": {
					"200": {
						"schema": {
							"type": "array",
							"items": {
								"$ref": "#/definitions/PushContentVo"
							}
						},
						"description": "OK"
					},
					"401": {
						"description": "Unauthorized"
					},
					"403": {
						"description": "Forbidden"
					},
					"404": {
						"description": "Not Found"
					}
				},
				"parameters": [
					{
						"in": "path",
						"name": "location-code",
						"description": "location-code",
						"type": "string",
						"required": true
					},
				],
				"tags": [
					"push-location-controller"
				]
			}
}

Behavior:
throw error that location-code is illegal variable name in function parameter define

 SyntaxError: ')' expected. (2124:48)
2122 |  * @request GET:/location/{location-code}/content
  2123 |  */
> 2124 | findLocationPushContentUsingGet: (location-code: string, params: RequestParams = {}) =>
       |                                                ^
  2125 |     this.request<(PushContentVo)[], void>({
  2126 |         path: `/location/${location-code}/content`,
  2127 |         method: 'GET',

Expect:
swagger-typescript-api to auto filter dash and change to lowerCamelCase, in this case should be locationCode

@js2me
Copy link
Member

js2me commented Mar 2, 2021

Hello @Mr-sgreen !
Thanks for this issue, will fix that in an hour

@js2me js2me self-assigned this Mar 2, 2021
@js2me js2me added bug Something isn't working next release labels Mar 2, 2021
@Mr-sgreen
Copy link
Author

Thank you!

Hello @Mr-sgreen !
Thanks for this issue, will fix that in an hour

@js2me js2me mentioned this issue Mar 2, 2021
js2me added a commit that referenced this issue Mar 2, 2021
* fix: bug with `kebab-case` path params (issue #184, thanks @Mr-sgreen)

* fix: typings for --js option; feat: --silent option (output only errors to console)

* bump: up version to 6.1.0
@js2me
Copy link
Member

js2me commented Mar 2, 2021

@Mr-sgreen should be fixed in 6.1.0 release!
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next release
Projects
None yet
Development

No branches or pull requests

2 participants