Skip to content

Commit c59f1ef

Browse files
committed
feat: make schema hash in header comment opt-in via -schemaHash
The schema hash in the OpenAPI header comment changes on every schema edit, producing perpetual git merge conflicts in the generated YAML. Gate the hash behind a new -schemaHash target option (default false), flipping the previous always-on behavior: - default: header comment carries only the name and version (no hash). The "Code generated by ... DO NOT EDIT." line stays. - with -schemaHash: restores today's output exactly (hash in the header). This generator emits only a header comment (no version helper functions or constants exist here), so the gate is comment-only. Mirrors the sibling gen-golang change. Regenerated _examples to reflect the new default.
1 parent fc1bff5 commit c59f1ef

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

_examples/openapi.gen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# example v1.0.0 ceb35c0c54325918ffdd24bf625bb6c8c941f75e
1+
# example v1.0.0
22
# --
33
# Code generated by webrpc-gen@v0.37.0 with ../ generator; DO NOT EDIT
44
#

main.go.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
{{- set $opts "servers" (default .Opts.servers "") -}}
1010
{{- set $opts "securityAnnotation" (default .Opts.securityAnnotation "") -}}
1111
{{- set $opts "securitySchemes" (default .Opts.securitySchemes "") -}}
12+
{{- set $opts "schemaHash" (ternary (in .Opts.schemaHash "" "true") true false) -}}
1213

1314
{{- /* Print help on -help. */ -}}
1415
{{- if exists .Opts "help" -}}
@@ -65,7 +66,7 @@
6566
{{- $webrpcErrors := .WebrpcErrors -}}
6667
{{- $schemaErrors := .Errors -}}
6768

68-
# {{.SchemaName}} {{.SchemaVersion}} {{.SchemaHash}}
69+
# {{.SchemaName}} {{.SchemaVersion}}{{if $opts.schemaHash}} {{.SchemaHash}}{{end}}
6970
# --
7071
# Code generated by webrpc-gen@{{.WebrpcGenVersion}} with {{.WebrpcTarget}} generator; DO NOT EDIT
7172
#

0 commit comments

Comments
 (0)