Bindoj_codec_config.Json_config
This module provides functionalities to configure the JSON shape.
type json_mangling_style = [
|
`default
the default mangling style mangles as the following
type name
snake_case to UpperCamelCase, e.g.
field name
snake_case to lowerCamelCase, e.g.
variant name
Capitalized_snake_case to kebab-case
when a version substring is present
major version + minor version
type name
variant/kind/enum name
field name
major version only
type name
variant/kind/enum name
field name
with patch number
type name
variant/kind/enum name
field name
|
`default_no_preserving_version_substring
the mangling style is almost same as default, but the version substring like `v1_0` is not presrved.
*)|
`no_mangling
do not mangle
*) ]
type json_nested_field_style = [
|
`nested
nested field stay as a nested
*)|
`spreading
nested field's internal fields being spreading; would result in error if the field does not ultimately resolves to a Bindoj_typedesc.Type_desc.type_decl_kind.Record_decl
/ Bindoj_typedesc.Type_desc.type_decl_kind.Variant_decl
kinded Bindoj_typedesc.Type_desc.type_decl
]
type variant_arg_name_style = [
|
`exactly of string
|
`value
"value"
, the default
|
`arg
"arg"
|
`kind_name of json_mangling_style option
if argument is None
, the exact same string of the kind field is used; otherwise, the kind name will be mangled accordingly to the supplied mangling style
]
type Bindoj_base.Typed_type_desc.config +=
| Config_json_name : string -> ('pos, [ `json_name ])
Bindoj_base.Typed_type_desc.config
| Config_json_name_of_variant_arg : variant_arg_name_style -> ([< `variant_constructor
| `type_decl ],
[ `json_name_of_variant_arg ])
Bindoj_base.Typed_type_desc.config
| Config_json_variant_style : json_variant_style -> ([ `variant_constructor ],
[ `json_variant_style ])
Bindoj_base.Typed_type_desc.config
| Config_json_variant_discriminator : string -> ([ `type_decl ],
[ `json_variant_discriminator ])
Bindoj_base.Typed_type_desc.config
| Config_json_tuple_style : json_tuple_style -> ([< `variant_constructor
| `coretype ],
[ `json_tuple_style ])
Bindoj_base.Typed_type_desc.config
| Config_json_nested_field_style : json_nested_field_style -> ([< `record_field
| `variant_tuple_argument ],
[ `json_nested_field_style ])
Bindoj_base.Typed_type_desc.config
| Config_json_mangling_style : json_mangling_style -> ('pos,
[ `json_mangling_style ])
Bindoj_base.Typed_type_desc.config
| Config_json_custom_encoder : string -> ([ `coretype ],
[ `json_custom_encoder ])
Bindoj_base.Typed_type_desc.config
| Config_json_custom_decoder : string -> ([ `coretype ],
[ `json_custom_decoder ])
Bindoj_base.Typed_type_desc.config
| Config_json_custom_shape_explanation : Bindoj_runtime.json_shape_explanation ->
([ `coretype ], [ `json_custom_shape_explanation ])
Bindoj_base.Typed_type_desc.config
val name :
string ->
([< Bindoj_base.Typed_type_desc.pos ], [ `json_name ])
Bindoj_base.Typed_type_desc.config
val get_name_opt :
[< Bindoj_base.Typed_type_desc.pos ] Bindoj_base.Typed_type_desc.configs ->
string option
val name_of_variant_arg :
variant_arg_name_style ->
([< `variant_constructor | `type_decl ], [ `json_name_of_variant_arg ])
Bindoj_base.Typed_type_desc.config
val get_name_of_variant_arg_opt :
[< `variant_constructor | `type_decl ] Bindoj_base.Typed_type_desc.configs ->
variant_arg_name_style option
val default_name_of_variant_arg : variant_arg_name_style
default : `value
. The default field name for the argument of a variant constructor. Use Json_config.name_of_variant_arg
for variant_constructor .. (`tuple_like ..)
to override.
val default_variant_style : json_variant_style
val variant_style :
json_variant_style ->
([ `variant_constructor ], [ `json_variant_style ])
Bindoj_base.Typed_type_desc.config
val get_variant_style :
[ `variant_constructor ] Bindoj_base.Typed_type_desc.configs ->
json_variant_style
val variant_discriminator :
string ->
([ `type_decl ], [ `json_variant_discriminator ])
Bindoj_base.Typed_type_desc.config
val get_variant_discriminator :
[ `type_decl ] Bindoj_base.Typed_type_desc.configs ->
string
val default_tuple_style : json_tuple_style
val tuple_style :
json_tuple_style ->
([< `variant_constructor | `coretype ], [ `json_tuple_style ])
Bindoj_base.Typed_type_desc.config
val get_tuple_style :
[< `coretype | `variant_constructor ] Bindoj_base.Typed_type_desc.configs ->
json_tuple_style
val default_nested_field_style : json_nested_field_style
default : `nested
val nested_field_style :
json_nested_field_style ->
([< `record_field | `variant_tuple_argument ], [ `json_nested_field_style ])
Bindoj_base.Typed_type_desc.config
val get_nested_field_style :
[< `record_field | `variant_tuple_argument ]
Bindoj_base.Typed_type_desc.configs ->
json_nested_field_style
val default_mangling_style : json_mangling_style
default : `default true
val mangling_style :
json_mangling_style ->
([< Bindoj_base.Typed_type_desc.pos ], [ `json_mangling_style ])
Bindoj_base.Typed_type_desc.config
val no_mangling :
([< Bindoj_base.Typed_type_desc.pos ], [ `json_mangling_style ])
Bindoj_base.Typed_type_desc.config
val default_mangling :
([< Bindoj_base.Typed_type_desc.pos ], [ `json_mangling_style ])
Bindoj_base.Typed_type_desc.config
val default_mangling_no_preserving_version_substring :
([< Bindoj_base.Typed_type_desc.pos ], [ `json_mangling_style ])
Bindoj_base.Typed_type_desc.config
val get_mangling_style_opt :
[< Bindoj_base.Typed_type_desc.pos ] Bindoj_base.Typed_type_desc.configs ->
json_mangling_style option
val mangled :
[ `type_name | `field_name | `discriminator_value | `string_enum_case ] ->
json_mangling_style ->
string ->
string
val get_mangled_name_of_type :
?inherited:json_mangling_style ->
Bindoj_base.Typed_type_desc.type_decl ->
string * json_mangling_style
val get_mangled_name_of_field :
?inherited:json_mangling_style ->
Bindoj_base.Typed_type_desc.record_field ->
string * json_mangling_style
val get_mangled_name_of_discriminator' :
?inherited:json_mangling_style ->
[ `variant_constructor ] Bindoj_base.Typed_type_desc.configs ->
string ->
string * json_mangling_style
val get_mangled_name_of_discriminator :
?inherited:json_mangling_style ->
Bindoj_base.Typed_type_desc.variant_constructor ->
string * json_mangling_style
val get_mangled_name_of_discriminator_field' :
?inherited:json_mangling_style ->
[ `type_decl ] Bindoj_base.Typed_type_desc.configs ->
string
val get_mangled_name_of_discriminator_field :
?inherited:json_mangling_style ->
Bindoj_base.Typed_type_desc.type_decl ->
string
val get_mangled_name_of_variant_arg' :
?inherited:json_mangling_style ->
[ `type_decl ] Bindoj_base.Typed_type_desc.configs ->
[ `variant_constructor ] Bindoj_base.Typed_type_desc.configs ->
string ->
string
val get_mangled_name_of_variant_arg :
?inherited:json_mangling_style ->
[ `type_decl ] Bindoj_base.Typed_type_desc.configs ->
Bindoj_base.Typed_type_desc.variant_constructor ->
string
val get_mangled_name_of_string_enum_case :
?inherited:json_mangling_style ->
Bindoj_base.Typed_type_desc.Coretype.string_enum_case ->
string
val custom_encoder :
string ->
([ `coretype ], [ `json_custom_encoder ]) Bindoj_base.Typed_type_desc.config
val get_custom_encoder :
[ `coretype ] Bindoj_base.Typed_type_desc.configs ->
string option
val custom_decoder :
string ->
([ `coretype ], [ `json_custom_decoder ]) Bindoj_base.Typed_type_desc.config
val get_custom_decoder :
[ `coretype ] Bindoj_base.Typed_type_desc.configs ->
string option
val custom_shape_explanation :
Bindoj_runtime.json_shape_explanation ->
([ `coretype ], [ `json_custom_shape_explanation ])
Bindoj_base.Typed_type_desc.config
val get_custom_shape_explanation :
[ `coretype ] Bindoj_base.Typed_type_desc.configs ->
Bindoj_runtime.json_shape_explanation option
val check_field_name_collision : Bindoj_base.Typed_type_desc.type_decl -> bool