refactor(types): carry field-function parameter values as a typed value
What does this MR do and why?
First of three MRs for list-valued field-function parameters (#213 (closed)):
- this MR: parameter values become a typed value, no behaviour change
- !521 (merged): list-valued and required parameter definitions
- !522 (merged): the
[a, b]syntax
Field-function parameter values flow as ParameterValue::Scalar(String) | List(Vec<String>) instead of plain strings, from FunctionArg through resolution, Sort::parameters, ResolvedField, codegen and the transformer. The definition-side default enum is renamed ParameterDefault to free the name.
Nothing produces a list yet: the parser still reads scalars only, and resolution refuses a list for every definition ("Expected a single value, not a list"). Everything downstream already handles both shapes, so the next two MRs only have to declare and parse lists:
DisplayField::key()quotes list items (labels(["a", "b"])) and labels list every item;labels([bug, "feature*"])filters likelabels(bug, "feature*").- Slugs for aliased parameterised fields join sanitised list items with
_0, which no item can produce and no parameter key can start with, so distinct lists get distinct response keys even on multi-parameter fields. format_graphql_paramsrenders a list as a GraphQL list literal with the same per-item quoting as a scalar of that parameter.- The
parametersecho on compile-output fields emits a JSON array for a list; the npm type widens toRecord<string, string | string[]>.
Wire contract
ParameterValue serialises untagged: a scalar stays a JSON string, a list is a JSON array of strings. Compile output holding plain-string parameter values in _internal deserialises as scalars, pinned by a test. schema.json is unchanged.
How to review
Mostly .into() churn plus the new type in src/types/field_parameter.rs. Worth a careful read: src/types/display_field.rs (slug join, key()), src/codegen/graphql.rs (format_graphql_params), the legacy-shape test in display_field.rs.
Part of #213 (closed)