We currently have some generic marker types defined which are used to provide "behavioral" context to the generators:
/**
* Some APIs will return values such as numbers also as a string (notably epoch timestamps). This behavior
* is used to capture this behavior while keeping the semantics of the field type.
*
* Depending on the target language, code generators can keep the union or remove it and leniently parse
* strings to the target type.
*/
export type Stringified<T> = T | string
/**
* A set of flags that can be represented as a single enum value or a set of values that are encoded
* as a pipe-separated string
*
* Depending on the target language, code generators can use this hint to generate language specific
* flags enum constructs and the corresponding (de-)serialization code.
*/
export type PipeSeparatedFlags<T> = T | string
Instead of modelling (de-)serialization behavior like this, we should introduce a proper tag to avoid unnecessary complexity (especially for languages that do not support generics).
We currently have some generic marker types defined which are used to provide "behavioral" context to the generators:
Instead of modelling (de-)serialization behavior like this, we should introduce a proper tag to avoid unnecessary complexity (especially for languages that do not support generics).