Skip to content

fix: Fixed a bug where properties with '.' as a key were not referenced #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/internal/OpenApiTools/components/PathItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export const generateStatements = (
),
);
}
// TODO Check usage
// if (pathItem.parameters) {
// Parameters.generateNamespaceWithList(entryPoint, currentPoint, store, factory, pathItem.parameters, context);
// }
Expand Down
6 changes: 5 additions & 1 deletion src/internal/ResolveReference/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export { OpenApi };

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

const escapeFromJsonCyclic = (obj: any) => JSON.parse(JSON.stringify(obj));

const isObject = (value: any): value is ObjectLike => {
return !!value && value !== null && !Array.isArray(value) && typeof value === "object";
};
Expand Down Expand Up @@ -89,7 +91,9 @@ const resolveLocalReference = (entryPoint: string, currentPoint: string, obj: an
`This is an implementation error. Please report any reproducible information below.\nhttps://github.com/Himenon/openapi-typescript-code-generator/issues/new/choose\n`,
);
}
return DotProp.get(rootSchema, ref.path.replace(/\//g, "."));
// "." in the key
const escapedPath = ref.path.replace(/\./g, "\\.").replace(/\//g, ".");
return escapeFromJsonCyclic(DotProp.get(rootSchema, escapedPath));
}
return obj;
}
Expand Down
Loading