Skip to content

parse in path variable name with dash error #184

Closed
@Mr-sgreen

Description

@Mr-sgreen

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions