Skip to content
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

How to pass object array to Weave init in OperationBuilder parameter #42

Closed
bududomasidet opened this issue Nov 7, 2020 · 6 comments
Closed
Labels
enhancement New feature or request

Comments

@bududomasidet
Copy link

Screenshot 2020-11-07 at 16 30 52

Hey there!
Could you please tell me if its possible to build Weave query like this. I didn't find any approach here. Not so familiar with FunctionBuilders

@NicholasBellucci
Copy link
Owner

NicholasBellucci commented Nov 8, 2020

So currently this wouldn't be supported as the function builder is expecting a type that conforms to ObjectWeavable but this poses an interesting situation. In theory I might be able to build out a custom solution for this issue. Let me look into this some today and see what I can come up with.

@NicholasBellucci
Copy link
Owner

Could you help me out a little and give me an idea of your end goal. Maybe a quick mock of the desired query.

@NicholasBellucci NicholasBellucci added the enhancement New feature or request label Nov 8, 2020
@bududomasidet
Copy link
Author

Hey Nicholas!
Thank you for the answer :)
The final query I want to request can be represented like this:
`
{
ort_first: visitor(site: ort) {
tv {
onAirShowNext(channel: ORT_1) {
...showFragment
}
}
}
ort_second: visitor(site: ORT) {
tv {
onAirShowNext(channel: ORT_2) {
...showFragment
}
}
}
....
}

fragment imageUriFragment on Image {
src {
absoluteUri
}
}

fragment showFragment on Show {
name
startsAt
endsAt
hosts {
name
defaultImage {
alexa340: legacyImage(recipe: "alexa340") {
...imageUriFragment
}
}
}
guests {
name
}
}
`

I tried to write ForEach statement with OperationBuilder, but failed to do it :(

@NicholasBellucci
Copy link
Owner

NicholasBellucci commented Nov 9, 2020

Ok so yesterday I created a ForEachWeavable which can be found on a new branch here: https://github.com/NicholasBellucci/SociableWeaver/tree/feature/foreach-weavable. If you would like to check this branch out and then refer to a new test that I added this might be a start to solving this use case.

Please feel free to provide any sort of feedback and we can converse on how to make this solution work best.

@bududomasidet
Copy link
Author

Wow! Seems like everything works fine!
Will you add public init for ForEachWeavable?
Thank you @NicholasBellucci 👍
I don't have an idea how can it be improved for now. I will take a look after finishing project.

But I really enjoy your declarative stuff on GraphQL requests 💯

@NicholasBellucci
Copy link
Owner

Version 0.1.11 now supports ForEachWeavable. I will document later this evening. Glad everything worked well. Going to close the issue but if anything comes up feel free to create a new one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants