diff --git a/_examples/hello-webrpc/webapp/client.gen.js b/_examples/hello-webrpc/webapp/client.gen.js index 4fd4fa7..f4c3a69 100644 --- a/_examples/hello-webrpc/webapp/client.gen.js +++ b/_examples/hello-webrpc/webapp/client.gen.js @@ -1,18 +1,9 @@ -// hello-webrpc v1.0.0 949b00a8db9810c69295f9dd9f02587a65d3c497 +// hello-webrpc v1.0.0 // -- // 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 ea313df..e9c9d3c 100644 --- a/main.go.tmpl +++ b/main.go.tmpl @@ -5,6 +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) -}} {{- /* Print help on -help. */ -}} {{- if exists .Opts "help" -}} @@ -52,12 +53,13 @@ {{- set $typeMap "string" "string" -}} {{- set $typeMap "timestamp" "string" -}} -// {{.SchemaName}} {{.SchemaVersion}} {{.SchemaHash}} +// {{.SchemaName}} {{.SchemaVersion}}{{if $opts.schemaHash}} {{.SchemaHash}}{{end}} // -- // Code generated by webrpc-gen@{{.WebrpcGenVersion}} with {{.WebrpcTarget}} generator. DO NOT EDIT. // // {{.WebrpcGenCommand}} +{{- if $opts.schemaHash }} // WebRPC description and code-gen version {{if $opts.exports}}export {{end}}const WebRPCVersion = "{{.WebrpcVersion}}" @@ -66,6 +68,7 @@ // Schema hash generated from your RIDL schema {{if $opts.exports}}export {{end}}const WebRPCSchemaHash = "{{.SchemaHash}}" +{{- end }} {{template "types" dict "Services" .Services "Types" .Types "Opts" $opts}} {{- if $opts.client}}