Skip to content

Commit

Permalink
Merge pull request #117 from samchon/feat/escape
Browse files Browse the repository at this point in the history
`HttpLlm.appliation()` escapes some special characters.
  • Loading branch information
samchon authored Dec 20, 2024
2 parents 5548c64 + 24a8f73 commit 3d92b1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@samchon/openapi",
"version": "2.3.0",
"version": "2.3.1",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
Expand Down
8 changes: 7 additions & 1 deletion src/composers/HttpLlmApplicationComposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export namespace HttpLlmComposer {
];

// FUNTION NAME
const name: string = props.route.accessor.join("_");
const name: string = emend(props.route.accessor.join("_"));
const isNameVariable: boolean = /^[a-zA-Z0-9_-]+$/.test(name);
const isNameStartsWithNumber: boolean = /^[0-9]/.test(name[0] ?? "");
if (isNameVariable === false)
Expand Down Expand Up @@ -231,3 +231,9 @@ export namespace HttpLlmComposer {
};
};
}

const emend = (str: string): string => {
for (const ch of FORBIDDEN) str = str.split(ch).join("_");
return str;
};
const FORBIDDEN = ["$", "%", "."];

0 comments on commit 3d92b1d

Please sign in to comment.