-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(grpc): generate union types for oneof protobuf #1992
base: test/union-output
Are you sure you want to change the base?
Conversation
Moving to draft until — conflicts & comments are resolved |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## test/union-output #1992 +/- ##
=====================================================
+ Coverage 84.25% 84.42% +0.17%
=====================================================
Files 214 215 +1
Lines 20229 20454 +225
=====================================================
+ Hits 17043 17268 +225
Misses 3186 3186 ☔ View full report in Codecov by Sentry. |
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
Action required: PR inactive for 2 days. |
pub fn to_sdl(&self) -> String { | ||
let doc = self.to_document(); | ||
crate::core::document::print(doc) | ||
ConfigModule::from(self.clone()).to_sdl() |
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.
Why are we moving this call into ConfigModule?
|
||
/// Normalizes current config with default settings | ||
pub fn normalize_default(self) -> Valid<Self, String> { | ||
self.transform(UnionInputType.pipe(AmbiguousType::default())) |
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.
Can also add remove_unused
over here.
@@ -0,0 +1,35 @@ | |||
schema: |
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.
schema:
query: Query
types:
T1:
fields:
t1:
type: String
T2:
fields:
t2:
type: Int
T3:
fields:
t3:
type: Boolean
t33:
type: Float
required: true
V:
fields:
v:
type: U
Query:
fields:
test:
type: U
args:
u:
type: U
required: true
v:
type: V
required: true
http:
baseURL: http://localhost
path: /users/{{args.input}}
unions:
U:
types: ["T1", "T2", "T3"]
Tried with a nested input type. It doesn't produce correct SDLs
#[derive(Default)] | ||
pub struct UnionInputType; | ||
|
||
impl Transform for UnionInputType { |
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.
Can we split this PR into two — One with just the transformer and one with the the from_proto changes.
Summary:
Briefly describe the changes made in this PR.
Issue Reference(s):
Fixes #1912
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>