Support literals in queries generator
Describe the proposed feature
It would be great if the queries generator supported literals. As an example would be a query like select Foo { discriminator := "bar", ... } would generate a Returns type like { discriminator: "bar", ... }. This way you could perhaps combine some result transforming code based on a discriminated union pattern.
Agreed. We are restraining ourselves to the expressiveness of the EdgeQL type system here, which cannot express a discriminated union like this, but if we put in a little muscle, we might be able to force through a more refined definition if we detect literals. We've brought this kind of functionality in a limited form into the query builder for polymorphic types, but we current don't do any parsing or analysis of the EdgeQL you write in a .edgeql, so we don't have the same opportunities in the queries generator.
If we're lucky, adding discriminated unions to EdgeQL's type system will happen at some reasonable time in the future, and we can passively benefit from that. Until then, this will be a sympathetic, but non-prioritized feature request.