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
There are few alternatives to consider for naming inlined type definitions in generated code.
🗺️ Template for Rust modules that declares all the modules generated based on given type definitions.This also includes inline type definitions(anonymous type definition) that doesn't have a name.(e.g. address: { type: string }) Naming for these types is based on a counter starting with AnonymousType1. I have selected this name to imply that these are type definitions that weren't named in schema file, but I am open to other suggestions for naming these types.
Some alternatives,
Name these types as InlinedType*.
Problem: If we use this approach which is similar to current implementation (AnonymousType*). Then there is a question of collision when user has the same name for a different type definition.
Solution: We can use a different module where all the generated inlined types live.
Make a code generation constraint as open content in schema that allows naming these types (e.g. address: { $codegen_type_name: address_string, type: string } )
Problem: Requires user to name all their inlined types.
Solution: We can combine this solution with above naming appraoch and make $codegen_type_name optional.
There are few alternatives to consider for naming inlined type definitions in generated code.
InlinedType*
.AnonymousType*
). Then there is a question of collision when user has the same name for a different type definition.address_string
, type: string } )$codegen_type_name
optional.Originally posted by @desaikd in #61 (comment)
The text was updated successfully, but these errors were encountered: