Skip to content

Commit

Permalink
rename all occurences to Webrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Oct 17, 2024
1 parent f86042e commit dfad5ce
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
20 changes: 10 additions & 10 deletions _examples/golang-basics/example.gen.go

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

2 changes: 1 addition & 1 deletion _examples/golang-basics/example.ridl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct ComplexType
- user: User

struct GenVersions
- WebRpcGenVersion: string
- WebrpcGenVersion: string
- TmplTarget: string
- TmplVersion: string
- SchemaVersion: string
Expand Down
4 changes: 2 additions & 2 deletions _examples/golang-basics/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ func (rpc *ExampleServiceRPC) Version(ctx context.Context) (*Version, error) {
SchemaVersion: WebRPCSchemaVersion(),
SchemaHash: WebRPCSchemaHash(),
ClientGenVersion: &GenVersions{
WebRpcGenVersion: clientVersions.WebRpcGenVersion,
WebrpcGenVersion: clientVersions.WebrpcGenVersion,
TmplTarget: clientVersions.CodeGenName,
TmplVersion: clientVersions.CodeGenVersion,
SchemaVersion: clientVersions.CodeGenVersion,
},
ServerGenVersion: &GenVersions{
WebRpcGenVersion: serverVersions.WebRpcGenVersion,
WebrpcGenVersion: serverVersions.WebrpcGenVersion,
TmplTarget: serverVersions.CodeGenName,
TmplVersion: serverVersions.CodeGenVersion,
SchemaVersion: serverVersions.CodeGenVersion,
Expand Down
14 changes: 7 additions & 7 deletions _examples/golang-imports/api.gen.go

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

14 changes: 7 additions & 7 deletions main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,28 @@ func WebRPCSchemaHash() string {
return "{{.SchemaHash}}"
}

type WebRpcGenVersions struct {
WebRpcGenVersion string
type WebrpcGenVersions struct {
WebrpcGenVersion string
CodeGenName string
CodeGenVersion string
SchemaName string
SchemaVersion string
}

func VersionFromHeader(h http.Header) (*WebRpcGenVersions, error) {
func VersionFromHeader(h http.Header) (*WebrpcGenVersions, error) {
if h.Get(WebrpcHeader) == "" {
return nil, fmt.Errorf("header is empty or missing")
}

versions, err := parseWebRpcGenVersions(h.Get(WebrpcHeader))
versions, err := parseWebrpcGenVersions(h.Get(WebrpcHeader))
if err != nil {
return nil, fmt.Errorf("webrpc header is invalid: %w", err)
}

return versions, nil
}

func parseWebRpcGenVersions(header string) (*WebRpcGenVersions, error) {
func parseWebrpcGenVersions(header string) (*WebrpcGenVersions, error) {
versions := strings.Split(header, ";")
if len(versions) < 3 {
return nil, fmt.Errorf("expected at least 3 parts while parsing webrpc header: %v", header)
Expand All @@ -143,8 +143,8 @@ func parseWebRpcGenVersions(header string) (*WebRpcGenVersions, error) {
return nil, fmt.Errorf("schema name and schema version could not be parsed from: %s", versions[2])
}

return &WebRpcGenVersions{
WebRpcGenVersion: webrpcGenVersion,
return &WebrpcGenVersions{
WebrpcGenVersion: webrpcGenVersion,
CodeGenName: tmplTarget,
CodeGenVersion: tmplVersion,
SchemaName: schemaName,
Expand Down

0 comments on commit dfad5ce

Please sign in to comment.