Skip to content

Commit

Permalink
fix: don't write enum/service options when they're empty
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-johnson committed Sep 2, 2024
1 parent c10e4f4 commit ba318c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions integration/meta-typings-as-const/simple.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: "," })}}
}
`);
Expand Down Expand Up @@ -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: "," })}}
}
`);
Expand Down

0 comments on commit ba318c7

Please sign in to comment.