-
Notifications
You must be signed in to change notification settings - Fork 5
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
Pass target model in AugmentRequest #104
Conversation
Figured this out I think, although we do have an issue where the query fails in the types phase. For now I might just work around this with a try/catch and add a TODO. This is a good forcing function to enable filtered queries (so we can avoid asking for the members). |
In preparation for adding builder types, and making AugmentResponse not visible in the macro APIs any more. Will do that after #104 is also merged, as we really need both.
Thanks! I think there are three things worth discussing here, maybe we can discuss today? Minimizing data + round trips.I think we need an API design here that is perfect for performance, or very close. That means no unnecessary data returned and no unnecessary round trips. I think the way to do that is for the macro to specify its initial query in the This could be implemented as a next step after this PR, but there is one aspect that is maybe worth thinking about now, which is that we then need API for specifying the initial query, for example a getter that goes with each macro method, for the bootstrap code to call. Evolving classes vs parameters.Classes are easier to evolve than lists of parameters, because you can add fields to a class and old code that receives the class does not have to change. So I wonder if we should put as much as we can in one "macro scope" object ... actually, we have scopes, see next item ;) That would leave the target as the only parameter for these methods, which makes sense because it's the thing that can be different per method. So for example Use of
|
We might want them to be able to only request certain aspects of the I am a bit skeptical that they will be able to express the query at all without already having access to the target. So, we might need to invent a special syntax for expressing queries as templates with variables, in this case the variable would be the target. But, macros can also target different kinds of targets so I am still a bit skeptical this will work out well. We will have to work through examples of that. I do think it makes sense for the API to provide the target object directly still and not just a generic Model for the initial query response. Especially if you have an initial query you want to run, and it is merged with the implicit Model, you wouldn't even necessarily be able to find what the actual target was in that object because it would be littered with a bunch of other stuff. We could provide the target as a qualified name, and then add a way to look it up in the model easily (we probably want this functionality anyways).
I do think it should be a next step, this PR can be adapted to fit whatever we come up with.
How would we deal with models from query responses? Would the implicit model from the scope always get merged with each query response (maybe using #105?) |
In preparation for adding builder types, and making `AugmentResponse` not visible in the macro APIs any more. Will do that after #104 is also merged, as we really need both.
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.
LG to land with various followups as discussed :) thanks.
Specific follow up summary:
|
Yes, I think the builder can know which type is useful and return that specific type instead of |
Closes #100
model
field to AugmentRequest, with implementations to pass it (although, these use a host side query).hostService
from theMacroHost
(used to do the query)Model
parameter to all macro methods (typed asObject
for right now for most of them, as we don't have better types yet).Model.qualifiedNameOfMember
extension toqualifiedNameOf
generalizing and fixing it:Map<String, Object?>
now which is the only thing we can generalize on for the moment, but see Consider mimicking type hierarchies in our extension types. #103 for one possible workaround.