Skip to content
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

fix(handler-meta): check for .name with undefined value in ObjectExpression #2565

Merged
2 changes: 1 addition & 1 deletion src/rollup/plugins/handlers-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function astToObject(node: Expression | Literal): any {
const obj: Record<string, any> = {};
for (const prop of node.properties) {
if (prop.type === "Property") {
const key = (prop.key as any).name;
const key = (prop.key as any).name ?? (prop.key as any).value;
obj[key] = astToObject(prop.value as any);
}
}
Expand Down
5 changes: 5 additions & 0 deletions test/fixture/api/meta/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ defineRouteMeta({
tags: ["test"],
description: "Test route description",
parameters: [{ in: "query", name: "test", required: true }],
responses: {
200: {
description: "OK",
},
},
},
});

Expand Down