diff --git a/integration/meta-typings-as-const/simple.ts b/integration/meta-typings-as-const/simple.ts index a580f23b9..52d1d1618 100644 --- a/integration/meta-typings-as-const/simple.ts +++ b/integration/meta-typings-as-const/simple.ts @@ -147,11 +147,6 @@ export const protoMetadata = { references: { ".simple.TestEnum": TestEnum, ".simple.Test": Test }, dependencies: [protoMetadata1], options: { - enums: { - "TestEnum": { - options: undefined, - values: { "VALUE_A": { "string_value": "A" }, "VALUE_B": { "string_value": "B" } }, - }, - }, + enums: { "TestEnum": { values: { "VALUE_A": { "string_value": "A" }, "VALUE_B": { "string_value": "B" } } } }, }, } as const satisfies ProtoMetadata; diff --git a/src/schema.ts b/src/schema.ts index 4bfb0106d..36501353a 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -140,7 +140,7 @@ export function generateSchema(ctx: Context, fileDesc: FileDescriptorProto, sour if (methodsOptions.length > 0 || serviceOptions) { servicesOptions.push(code` '${service.name}': { - options: ${serviceOptions}, + ${serviceOptions ? code`options: ${serviceOptions},` : ""} methods: {${joinCode(methodsOptions, { on: "," })}} } `); @@ -173,7 +173,7 @@ export function generateSchema(ctx: Context, fileDesc: FileDescriptorProto, sour if (valuesOptions.length > 0 || enumOptions) { enumsOptions.push(code` '${Enum.name}': { - options: ${enumOptions}, + ${enumOptions ? code`options: ${enumOptions},` : ""} values: {${joinCode(valuesOptions, { on: "," })}} } `);