-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support proto_paths for gen graphql through proto file
- Loading branch information
Showing
7 changed files
with
197 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) {} | ||
} |
33 changes: 33 additions & 0 deletions
33
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,33 @@ | ||
```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 | ||
} |