-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.proto.tmpl
47 lines (37 loc) · 1.16 KB
/
server.proto.tmpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
syntax = "proto3";
package fhirproxy;
option go_package = "proto";
import "github.com/google/fhir/proto/stu3/resources.proto";
{{- range .Resource -}}
{{$type := .Type}}
{{$searchParams := .SearchParam}}
service {{.Type}} {
{{range .Interaction -}}
{{if (eq .Code "read") -}}
rpc Read(Read{{$type}}Request) returns (Read{{$type}}Response) {}
{{else if (eq .Code "search-type") -}}
rpc Search(Search{{$type}}Request) returns (Search{{$type}}Response) {}
{{- end}}
{{- end}}
}
{{- range .Interaction -}}
{{if (eq .Code "read")}}
message Read{{$type}}Request {
string id = 1;
}
message Read{{$type}}Response {
google.fhir.stu3.proto.{{$type}} resource = 1;
}
{{else if (eq .Code "search-type")}}
message Search{{$type}}Request {
{{- /* FIXME: the ordering of params is significant, so they should probably be sorted alphabetically, but even then it would break backward compatibility if a future version of the statement added new params */ -}}
{{- range $i,$p := $searchParams}}
string {{normalise $p.Name}} = {{$i}};
{{- end}}
}
message Search{{$type}}Response {
google.fhir.stu3.proto.Bundle results = 1;
}
{{- end}}
{{- end}}
{{- end}}