-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gen): support proto_paths for gen graphql through proto file (#3206
- Loading branch information
Showing
7 changed files
with
195 additions
and
18 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
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
15 changes: 15 additions & 0 deletions
15
tailcall-fixtures/fixtures/protobuf/news_proto_paths.proto
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 news; | ||
|
||
import "protobuf/news_dto.proto"; | ||
import "google/protobuf/empty.proto"; | ||
|
||
service NewsService { | ||
rpc GetAllNews(google.protobuf.Empty) returns (NewsList) {} | ||
rpc GetNews(NewsId) returns (News) {} | ||
rpc GetMultipleNews(MultipleNewsId) returns (NewsList) {} | ||
rpc DeleteNews(NewsId) returns (google.protobuf.Empty) {} | ||
rpc EditNews(News) returns (News) {} | ||
rpc AddNews(News) returns (News) {} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/cli/fixtures/generator/gen_proto_with_proto_paths_config.md
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 @@ | ||
```json @config | ||
{ | ||
"inputs": [ | ||
{ | ||
"curl": { | ||
"src": "http://jsonplaceholder.typicode.com/users", | ||
"fieldName": "users" | ||
} | ||
}, | ||
{ | ||
"proto": { | ||
"src": "tailcall-fixtures/fixtures/protobuf/news_proto_paths.proto", | ||
"url": "http://localhost:50051", | ||
"protoPaths": ["tailcall-fixtures/fixtures/"] | ||
} | ||
} | ||
], | ||
"preset": { | ||
"mergeType": 1.0, | ||
"inferTypeNames": true, | ||
"treeShake": true | ||
}, | ||
"output": { | ||
"path": "./output.graphql", | ||
"format": "graphQL" | ||
}, | ||
"schema": { | ||
"query": "Query" | ||
} | ||
} | ||
``` |
81 changes: 81 additions & 0 deletions
81
...enerator_spec__tests__cli__fixtures__generator__gen_proto_with_proto_paths_config.md.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,81 @@ | ||
--- | ||
source: tests/cli/gen.rs | ||
expression: config.to_sdl() | ||
--- | ||
schema @server @upstream { | ||
query: Query | ||
} | ||
|
||
input GEN__news__MultipleNewsId { | ||
ids: [Id] | ||
} | ||
|
||
input GEN__news__NewsInput { | ||
body: String | ||
id: Int | ||
postImage: String | ||
status: Status | ||
title: String | ||
} | ||
|
||
input Id { | ||
id: Int | ||
} | ||
|
||
enum Status { | ||
DELETED | ||
DRAFT | ||
PUBLISHED | ||
} | ||
|
||
type Address { | ||
city: String | ||
geo: Geo | ||
street: String | ||
suite: String | ||
zipcode: String | ||
} | ||
|
||
type Company { | ||
bs: String | ||
catchPhrase: String | ||
name: String | ||
} | ||
|
||
type GEN__news__NewsList { | ||
news: [News] | ||
} | ||
|
||
type Geo { | ||
lat: String | ||
lng: String | ||
} | ||
|
||
type News { | ||
body: String | ||
id: Int | ||
postImage: String | ||
status: Status | ||
title: String | ||
} | ||
|
||
type Query { | ||
GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.AddNews") | ||
GEN__news__NewsService__DeleteNews(newsId: Id!): Empty @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") | ||
GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.EditNews") | ||
GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") | ||
GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(url: "http://localhost:50051", body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") | ||
GEN__news__NewsService__GetNews(newsId: Id!): News @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.GetNews") | ||
users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") | ||
} | ||
|
||
type User { | ||
address: Address | ||
company: Company | ||
email: String | ||
id: Int | ||
name: String | ||
phone: String | ||
username: String | ||
website: String | ||
} |
858ac97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running 30s test @ http://localhost:8000/graphql
4 threads and 100 connections
777276 requests in 30.02s, 3.90GB read
Requests/sec: 25895.97
Transfer/sec: 132.92MB