From f6e1b3d704300498dd6e204f7d6ec7822cd2b1e7 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 15:50:08 +0200 Subject: [PATCH] fix: keep schema hash on by default, omit via -schemaHash=false v0.15.0 made schema hash emission opt-in (default off), a breaking change for consumers that rely on the hash and version constants. Restore the hash to on by default and make omission opt-out instead. - default (or -schemaHash): hash + version constants emitted, as before v0.15.0. - -schemaHash=false: omits the hash from the header comment and the version constants (WebRPCVersion, WebRPCSchemaVersion, WebRPCSchemaHash). The "Code generated by ... DO NOT EDIT." line stays. Regenerated _examples (hash restored). --- _examples/hello-webrpc/webapp/client.gen.js | 11 ++++++++++- main.go.tmpl | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/_examples/hello-webrpc/webapp/client.gen.js b/_examples/hello-webrpc/webapp/client.gen.js index f4c3a69..4fd4fa7 100644 --- a/_examples/hello-webrpc/webapp/client.gen.js +++ b/_examples/hello-webrpc/webapp/client.gen.js @@ -1,9 +1,18 @@ -// hello-webrpc v1.0.0 +// hello-webrpc v1.0.0 949b00a8db9810c69295f9dd9f02587a65d3c497 // -- // Code generated by webrpc-gen@v0.37.0 with ../../ generator. DO NOT EDIT. // // webrpc-gen -schema=hello-api.ridl -target=../../ -exports=false -client -out=./webapp/client.gen.js +// WebRPC description and code-gen version +const WebRPCVersion = "v1" + +// Schema version of your RIDL schema +const WebRPCSchemaVersion = "v1.0.0" + +// Schema hash generated from your RIDL schema +const WebRPCSchemaHash = "949b00a8db9810c69295f9dd9f02587a65d3c497" + // // Types // diff --git a/main.go.tmpl b/main.go.tmpl index e9c9d3c..015bf20 100644 --- a/main.go.tmpl +++ b/main.go.tmpl @@ -5,7 +5,7 @@ {{- set $opts "client" (ternary (in .Opts.client "" "true") true false) -}} {{- set $opts "server" (ternary (in .Opts.server "" "true") true false) -}} {{- set $opts "exports" (ternary (in .Opts.exports "false") false true) -}} -{{- set $opts "schemaHash" (ternary (in .Opts.schemaHash "" "true") true false) -}} +{{- set $opts "schemaHash" (ternary (eq (default .Opts.schemaHash "true") "false") false true) -}} {{- /* Print help on -help. */ -}} {{- if exists .Opts "help" -}}