#dagger.gql experiments
1 messages · Page 1 of 1 (latest)
Yeah my concern with this one is that it's less obvious to the uninitiated what's actually happening. I like the idea that the format is so obvious you never need to lookup graphql syntax after seeing one example. I'm playing around with another iteration
I'm going to make a version that assumes a very simple data model, where a project is just:
- Dependencies
- A graph (graphql types + resolver implementation)
That's small enough that I could make them distinct queries, and not need mutation + input tpye
{
myExtension: host {
workdir(path: "./extensions/myExtension") {
asExtension(sdk: "go")
}
}
yarn: git(url: "ssh://git@github.com/dagger/cloak") {
branch(name: "main") {
tree {
directory(path: "examples/yarn") {
asDependency
}
}
}
}
netlify: git(url: "ssh://git@github.com/dagger/cloak") {
branch(name: "main") {
tree {
directory(path: "examples/netlify") {
asDependency
}
}
}
}
}
Where I ended up. I like that it's all one block and retains the ability to specify extensions+dependencies using the full power of chaining. But I don't love the verbosity.
But technically we could add a lot of sugar to fix the verbosity, e.g. something like this:
{
myExtension: localExtension(
path: "./extensions/myExtension"
sdk: "go"
)
yarn: gitDependency(
url: "ssh://git@github.com/dagger/cloak"
branch: "main"
path: "examples/yarn"
)
netlify: gitDependency(
url: "ssh://git@github.com/dagger/cloak"
branch: "main"
path: "examples/netlify"
)
}
That would make simple cases simple but retain the full power of chaining for more obscure use cases. I still don't absolutely love it, but maybe something in that direction is promising?
That sounds promising too
I'm not totally sold on "graph" here, I completely get the reasoning but for some reason it feels confusing at the moment. I do like "api" though. But we can save that bikeshedding for later 🙂
Another mildly interesting thing here is that the use of aliases on the top level of a single block may be highly relevent to namespacing. I.e. if there is a namespace conflict it will be obvious because you'll be trying to use the same alias twice. It also open the door to resolving namespace conflicts by just changing the alias (similar to go where you can alias imports)
went on lunch break btw
yeah “graph” is an experimental alternative to “api”. The important thing is that it’s not “extension” because that creates confusion with external dependencies which we already call “extensions”
I got a little lost in all the variations, and keep thinking about the "10x easier extension DX" problem, so switched my focus to that for a little bit
cc @hybrid lynx @little orchid 🙂
My last experiment in todoapp demov3 branch: https://github.com/shykes/todoapp/blob/cloak-demov3/frontend/dagger.gql