From cace5c27dc5c4d5e75270c36a2d9350bc61c9218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20-=20=E3=82=A2=E3=83=AC=E3=83=83=E3=82=AF=E3=82=B9?= Date: Fri, 19 Jun 2026 12:48:30 +0200 Subject: [PATCH] feat: add -schemaHash=false to omit schema hash from header comment The schema hash in the OpenAPI header comment changes on every schema edit, causing frequent git conflicts in the generated YAML. This adds a -schemaHash target option (default true) to omit it when desired. - default (or -schemaHash): header comment unchanged (name, version, hash). - -schemaHash=false: header comment carries only the name and version. The "Code generated by ... DO NOT EDIT" line stays. Default behavior is unchanged, so this is non-breaking. --- main.go.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.go.tmpl b/main.go.tmpl index 7972833..2607cae 100644 --- a/main.go.tmpl +++ b/main.go.tmpl @@ -9,6 +9,7 @@ {{- set $opts "servers" (default .Opts.servers "") -}} {{- set $opts "securityAnnotation" (default .Opts.securityAnnotation "") -}} {{- set $opts "securitySchemes" (default .Opts.securitySchemes "") -}} +{{- set $opts "schemaHash" (ternary (eq (default .Opts.schemaHash "true") "false") false true) -}} {{- /* Print help on -help. */ -}} {{- if exists .Opts "help" -}} @@ -65,7 +66,7 @@ {{- $webrpcErrors := .WebrpcErrors -}} {{- $schemaErrors := .Errors -}} -# {{.SchemaName}} {{.SchemaVersion}} {{.SchemaHash}} +# {{.SchemaName}} {{.SchemaVersion}}{{if $opts.schemaHash}} {{.SchemaHash}}{{end}} # -- # Code generated by webrpc-gen@{{.WebrpcGenVersion}} with {{.WebrpcTarget}} generator; DO NOT EDIT #