Skip to content

Commit

Permalink
Update the regex to be more concise and inclue 1 letter params
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoseinian committed Apr 28, 2024
1 parent 1d9a29c commit fd18c23
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/schema-routes/schema-routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
21 changes: 21 additions & 0 deletions tests/spec/extractRequestParams/expected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,27 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
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 = {
/**
Expand Down
37 changes: 37 additions & 0 deletions tests/spec/extractRequestParams/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
"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",
Expand Down Expand Up @@ -480,6 +487,36 @@
"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"],
Expand Down
21 changes: 21 additions & 0 deletions tests/spec/extractRequestParams/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,27 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
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 = {
/**
Expand Down

0 comments on commit fd18c23

Please sign in to comment.