feat(codegen): first-class coercedType hint on data type defs#866
Merged
Conversation
Replace the built-in-name switch and private side channels (_isInt, _rawEnumOptions via _rawDef) in resolveCoercedType with a coercedType field on EnvGraphDataTypeDef that each type declares. Plugin-registered data types can now declare what their coerce() outputs so generated env modules type their fields correctly instead of always emitting string (which made the Go loader fail at runtime on numeric blob values). Types that declare nothing still fall back to string.
Contributor
|
The changes in this PR will be included in the next version bump.
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
varlock-website | c333247 | Commit Preview URL Branch Preview URL |
Jul 06 2026, 11:25 PM |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Follow-up to #849.
resolveCoercedTypehardcoded built-in type names and read private back-channels (_isInt,_rawEnumOptionsvia_rawDef), so plugin-registered data types always emitted asstringin every generated language — silently wrong TS types, and a runtimejson.Unmarshalfailure in the generated Go loader when the coerced blob value is numeric.coercedTypefield ('string' | 'int' | 'number' | 'boolean' | 'object' | { enum: [...] }) to data type defs; built-ins declare it, and field resolution consumes it generically (info.dataType?.coercedType ?? 'string'). The_isInt/_rawEnumOptions/_rawDefside channels are gone.registerDataType— no API change. Types that declare nothing still fall back tostring.coercedTypedocumented in the code-generation guide's plugin section, plus a pointer on the data-types reference page.