Skip to content

Commit

Permalink
Merge pull request #122 from samchon/feat/accessor
Browse files Browse the repository at this point in the history
Fix #121: accessor bug including `#` symbol.
  • Loading branch information
samchon authored Jan 10, 2025
2 parents abbb1e9 + 6575504 commit 2aa6000
Show file tree
Hide file tree
Showing 3 changed files with 28 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.3",
"version": "2.3.4",
"description": "OpenAPI definitions and converters for 'typia' and 'nestia'.",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/AccessorUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export namespace AccessorUtil {
export const reference = (prefix: string): string =>
prefix
.split("/")
.filter((str) => !!str.length)
.filter((str, i) => !!str.length && !(i === 0 && str === "#"))
.join(".");
}
26 changes: 26 additions & 0 deletions test/features/issues/test_issue_121_reference_accessor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { TestValidator } from "@nestia/e2e";
import { OpenApiTypeChecker } from "@samchon/openapi";
import typia from "typia";

export const test_issue_121_reference_accessor = (): void => {
const collection = typia.json.application<[IMember]>();
const accessors: string[] = [];
OpenApiTypeChecker.visit({
closure: (_schema, acc) => {
accessors.push(acc);
},
components: collection.components,
schema: collection.schemas[0],
});
TestValidator.equals("accessors")(accessors)([
"$input.schema",
'$input.components.schemas["IMember"]',
'$input.components.schemas["IMember"].properties["id"]',
'$input.components.schemas["IMember"].properties["age"]',
]);
};

interface IMember {
id: string;
age: number;
}

0 comments on commit 2aa6000

Please sign in to comment.