Skip to content

Commit d93333c

Browse files
authored
fix: Fixed a bug where properties with '.' as a key were not referenced (#64)
1 parent f305896 commit d93333c

File tree

3 files changed

+2102
-660
lines changed

3 files changed

+2102
-660
lines changed

src/internal/OpenApiTools/components/PathItem.ts

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ export const generateStatements = (
284284
),
285285
);
286286
}
287+
// TODO Check usage
287288
// if (pathItem.parameters) {
288289
// Parameters.generateNamespaceWithList(entryPoint, currentPoint, store, factory, pathItem.parameters, context);
289290
// }

src/internal/ResolveReference/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export { OpenApi };
99

1010
export type ObjectLike = { [key: string]: any };
1111

12+
const escapeFromJsonCyclic = (obj: any) => JSON.parse(JSON.stringify(obj));
13+
1214
const isObject = (value: any): value is ObjectLike => {
1315
return !!value && value !== null && !Array.isArray(value) && typeof value === "object";
1416
};
@@ -89,7 +91,9 @@ const resolveLocalReference = (entryPoint: string, currentPoint: string, obj: an
8991
`This is an implementation error. Please report any reproducible information below.\nhttps://github.com/Himenon/openapi-typescript-code-generator/issues/new/choose\n`,
9092
);
9193
}
92-
return DotProp.get(rootSchema, ref.path.replace(/\//g, "."));
94+
// "." in the key
95+
const escapedPath = ref.path.replace(/\./g, "\\.").replace(/\//g, ".");
96+
return escapeFromJsonCyclic(DotProp.get(rootSchema, escapedPath));
9397
}
9498
return obj;
9599
}

0 commit comments

Comments
 (0)