Composability of schemas #35
Replies: 2 comments 1 reply
-
I started riffing in #37, feel free to add suggestions/edits there or discuss here or both, as it feels best. :) @obi1kenobi , thanks for getting this discussion going! |
Beta Was this translation helpful? Give feedback.
-
I've been following the work in #37, and I have to commend @yaacovCR for the high quality of the document 💯 Here are my notes on things I'm interested in discussing. Overlapping enum types with different valuesIn my opinion, it's also quite possible that different enum values in single-service composite schemas may be due to a bug, rather than an intentional choice. This is especially true for enum values used as inputs. In the interest of choosing a good tradeoff between spec completeness and simplicity, I'd be in favor of saying "overlapping enum types used as inputs must match exactly to make the schemas composable." Otherwise, I worry about the risk of providing a complete spec that is unimplementable in practice due to overwhelming complexity. I could also be convinced to disallow composition of enums with different values altogether, regardless of input/output use or manner of execution. Default values for input object fieldsTwo questions and one comment here. If composing a field with a default value with a matching field without a default value, is the resulting field required to specify a default in the composed schema? And is that default required to match the default of the underlying field that had a default? Perhaps it would be good to specify that default values can be unset or overridden by composition metadata, subject to waves hands making the types/nullability work out. I'm intentionally hand-waving away the specific rule so we don't get hung up on defining what it is before deciding if this piece of metadata is worth it or not. Addition of schema entities as part of compositionDuring composition, it's also sometimes useful to add entities that are only valid in the scope of the composed schema, and are not valid in any of the subschemas individually. For example:
There are multiple ways of going about this, and it's not immediately clear to me that one of the approaches dominates all others in all use cases. This is something I'd be interested in discussing in more detail. Treatment of
|
Beta Was this translation helpful? Give feedback.
-
Opening this discussion so @yaacovCR, I, and anyone else interested can fill it in.
Will write more in a bit as a I try to collect my thoughts and produce something more tightly edited than just a big wall of text :)
Beta Was this translation helpful? Give feedback.
All reactions