diff --git a/src/schema-routes/schema-routes.js b/src/schema-routes/schema-routes.js index 81a73a8f..5670ddcc 100644 --- a/src/schema-routes/schema-routes.js +++ b/src/schema-routes/schema-routes.js @@ -110,7 +110,7 @@ class SchemaRoutes { originalRouteName; const pathParamMatches = (routeName || "").match( - /({(([A-z]){1}([a-zA-Z0-9]-?_?\.?)+)([0-9]+)?})|(:(([A-z]){1}([a-zA-Z0-9]-?_?\.?)+)([0-9]+)?:?)/g, + /({[a-zA-Z]([-_.]*[a-zA-Z0-9])*})|(:[a-zA-Z]([-_.]*[a-zA-Z0-9])*:?)/g, ); // used in case when path parameters is not declared in requestInfo.parameters ("in": "path") diff --git a/tests/spec/extractRequestParams/expected.ts b/tests/spec/extractRequestParams/expected.ts index 08b222e0..3c5b71c6 100644 --- a/tests/spec/extractRequestParams/expected.ts +++ b/tests/spec/extractRequestParams/expected.ts @@ -472,6 +472,52 @@ export class Api extends HttpClient + this.request< + { + /** @format date-time */ + since?: string; + status?: string; + /** base64safe encoded public signing key */ + sub?: string; + }, + Error + >({ + path: `/i_key/${iPk}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Get public details of an Authentiq ID. + * + * @tags key, get + * @name UnderlinesDetail + * @request GET:/i_key/underlines/{i__UK} + */ + underlinesDetail: (iUk: string, params: RequestParams = {}) => + this.request< + { + /** base64safe encoded public signing key */ + sub?: string; + }, + Error + >({ + path: `/i_key/underlines/${iUk}`, + method: "GET", + format: "json", + ...params, + }), + }; login = { /** * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples diff --git a/tests/spec/extractRequestParams/schema.json b/tests/spec/extractRequestParams/schema.json index c9fc4a0a..8d4d5098 100644 --- a/tests/spec/extractRequestParams/schema.json +++ b/tests/spec/extractRequestParams/schema.json @@ -56,6 +56,20 @@ "required": true, "type": "string" }, + "i__UK": { + "description": "Variable with double __ in it.", + "in": "path", + "name": "i__UK", + "required": true, + "type": "string" + }, + "i_PK": { + "description": "Public Signing Key - Authentiq ID (43 chars)", + "in": "path", + "name": "i_PK", + "required": true, + "type": "string" + }, "BarBaz": { "description": "bar baz", "in": "path", @@ -424,6 +438,85 @@ "tags": ["key", "put"] } }, + "/i_key/{i_PK}": { + "get": { + "description": "Get public details of an Authentiq ID.\n", + "parameters": [ + { + "$ref": "#/parameters/i_PK" + } + ], + "produces": ["application/json"], + "responses": { + "200": { + "description": "Successfully retrieved", + "schema": { + "properties": { + "since": { + "format": "date-time", + "type": "string" + }, + "status": { + "type": "string" + }, + "sub": { + "description": "base64safe encoded public signing key", + "type": "string" + } + }, + "title": "JWT", + "type": "object" + } + }, + "404": { + "description": "Unknown key `unknown-key`", + "schema": { + "$ref": "#/definitions/Error" + } + }, + "410": { + "description": "Key is revoked (gone). `revoked-key`", + "schema": { + "$ref": "#/definitions/Error" + } + }, + "default": { + "$ref": "#/responses/ErrorResponse" + } + }, + "tags": ["key", "get"] + } + }, + "/i_key/underlines/{i__UK}": { + "get": { + "description": "Get public details of an Authentiq ID.\n", + "parameters": [ + { + "$ref": "#/parameters/i__UK" + } + ], + "produces": ["application/json"], + "responses": { + "200": { + "description": "Successfully retrieved", + "schema": { + "properties": { + "sub": { + "description": "base64safe encoded public signing key", + "type": "string" + } + }, + "title": "JWT", + "type": "object" + } + }, + "default": { + "$ref": "#/responses/ErrorResponse" + } + }, + "tags": ["key", "get"] + } + }, "/login": { "post": { "consumes": ["application/jwt"], diff --git a/tests/spec/extractRequestParams/schema.ts b/tests/spec/extractRequestParams/schema.ts index 08b222e0..3c5b71c6 100644 --- a/tests/spec/extractRequestParams/schema.ts +++ b/tests/spec/extractRequestParams/schema.ts @@ -472,6 +472,52 @@ export class Api extends HttpClient + this.request< + { + /** @format date-time */ + since?: string; + status?: string; + /** base64safe encoded public signing key */ + sub?: string; + }, + Error + >({ + path: `/i_key/${iPk}`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Get public details of an Authentiq ID. + * + * @tags key, get + * @name UnderlinesDetail + * @request GET:/i_key/underlines/{i__UK} + */ + underlinesDetail: (iUk: string, params: RequestParams = {}) => + this.request< + { + /** base64safe encoded public signing key */ + sub?: string; + }, + Error + >({ + path: `/i_key/underlines/${iUk}`, + method: "GET", + format: "json", + ...params, + }), + }; login = { /** * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples