You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow the generator to have custom scalar codecs specified. Maintain a runtime schema type map. Pass requests/responses through a middleware that uses the runtime schema type map to apply encoders/decoders to custom scalar fields.
Codecs
gr --codecs './customScalarCodecs.ts'
By default look for a a file at <outputDirPath>/customScalarCodecs.ts or <outputDirPath>/custom-scalar-codecs.ts.
The contract for the module is exported codecs whose names match a custom scalar in the schema.
Perceived Problem
Custom scalars have no runtime codec.
Ideas / Proposed Solution(s)
Allow the generator to have custom scalar codecs specified. Maintain a runtime schema type map. Pass requests/responses through a middleware that uses the runtime schema type map to apply encoders/decoders to custom scalar fields.
Codecs
By default look for a a file at
<outputDirPath>/customScalarCodecs.ts
or<outputDirPath>/custom-scalar-codecs.ts
.The contract for the module is exported codecs whose names match a custom scalar in the schema.
Example:
When a custom scalar has no defined codec then an error is thrown.
** Automatic Runtime codec application **
Use a type map that knows which parts of the schema are custom scalars. This runtime type map will be part of the code generation.
Example type map:
An internal middleware will be used doing something like as follows.
The text was updated successfully, but these errors were encountered: