-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/gen-tailcall-config-from-url
- Loading branch information
Showing
11 changed files
with
253 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/core/generator/snapshots/tailcall__core__generator__from_proto__test__map_types.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
source: src/core/generator/from_proto.rs | ||
expression: config | ||
--- | ||
schema @server @upstream { | ||
query: Query | ||
} | ||
|
||
input map__MapRequest @tag(id: "map.MapRequest") { | ||
map: JSON! | ||
} | ||
|
||
type Query { | ||
map__MapService__GetMap(mapRequest: map__MapRequest!): map__MapResponse! @grpc(body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") | ||
} | ||
|
||
type map__MapResponse @tag(id: "map.MapResponse") { | ||
map: JSON! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
syntax = "proto3"; | ||
|
||
package map; | ||
|
||
message MapRequest { | ||
map<string, string> map = 1; | ||
} | ||
|
||
message MapResponse { | ||
map<int32, string> map = 1; | ||
} | ||
|
||
service MapService { | ||
rpc GetMap (MapRequest) returns (MapResponse) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: response | ||
--- | ||
{ | ||
"status": 200, | ||
"headers": { | ||
"content-type": "application/json" | ||
}, | ||
"body": { | ||
"data": { | ||
"map__MapService__GetMap": { | ||
"map": { | ||
"1": "value" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: client | ||
--- | ||
scalar Date | ||
|
||
scalar Email | ||
|
||
scalar Empty | ||
|
||
scalar JSON | ||
|
||
scalar PhoneNumber | ||
|
||
type Query { | ||
map__MapService__GetMap(mapRequest: map__MapRequest!): map__MapResponse! | ||
} | ||
|
||
scalar Url | ||
|
||
input map__MapRequest { | ||
map: JSON! | ||
} | ||
|
||
type map__MapResponse { | ||
map: JSON! | ||
} | ||
|
||
schema { | ||
query: Query | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: merged | ||
--- | ||
schema @server(port: 8000) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: true) @link(src: "map.proto", type: Protobuf) { | ||
query: Query | ||
} | ||
|
||
input map__MapRequest { | ||
map: JSON! | ||
} | ||
|
||
type Query { | ||
map__MapService__GetMap(mapRequest: map__MapRequest!): map__MapResponse! @grpc(body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") | ||
} | ||
|
||
type map__MapResponse @tag(id: "map.MapResponse") { | ||
map: JSON! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Grpc map type | ||
|
||
```protobuf @file:map.proto | ||
syntax = "proto3"; | ||
package map; | ||
message MapRequest { | ||
map<string, string> map = 1; | ||
} | ||
message MapResponse { | ||
map<int32, string> map = 1; | ||
} | ||
service MapService { | ||
rpc GetMap (MapRequest) returns (MapResponse) {} | ||
} | ||
``` | ||
|
||
```graphql @config | ||
schema | ||
@server(port: 8000) | ||
@upstream(baseURL: "http://localhost:50051", httpCache: true, batch: {delay: 10}) | ||
@link(src: "map.proto", type: Protobuf) { | ||
query: Query | ||
} | ||
|
||
schema @server @upstream { | ||
query: Query | ||
} | ||
|
||
input map__MapRequest @tag(id: "map.MapRequest") { | ||
map: JSON! | ||
} | ||
|
||
type Query { | ||
map__MapService__GetMap(mapRequest: map__MapRequest!): map__MapResponse! | ||
@grpc(body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") | ||
} | ||
|
||
type map__MapResponse @tag(id: "map.MapResponse") { | ||
map: JSON! | ||
} | ||
``` | ||
|
||
```yml @mock | ||
- request: | ||
method: POST | ||
url: http://localhost:50051/map.MapService/GetMap | ||
response: | ||
status: 200 | ||
textBody: \0\0\0\0\x12\n\t\x08\x01\x12\x05value | ||
``` | ||
|
||
```yml @test | ||
- method: POST | ||
url: http://localhost:8080/graphql | ||
body: | ||
query: > | ||
query { | ||
map__MapService__GetMap(mapRequest: { map: { key: "value" } }) { | ||
map | ||
} | ||
} | ||
``` |