From f9a9660ac73e91ff2a19602029d0aba77c5635b8 Mon Sep 17 00:00:00 2001 From: Andrey Konstantinov Date: Thu, 26 Mar 2026 20:49:33 +0000 Subject: [PATCH 01/47] remove aksama dependency --- .gitignore | 1 + Cargo.lock | 86 - reflectapi-cli/Cargo.toml | 1 - .../clients/rust/generated/src/generated.rs | 1 - .../clients/typescript/generated.ts | 4 +- ...tests__basic__reflectapi_deprecated-2.snap | 1 - ...tests__basic__reflectapi_deprecated-3.snap | 4 +- ...__basic__reflectapi_enum_documented-2.snap | 1 - ...__basic__reflectapi_enum_documented-3.snap | 4 +- ...__reflectapi_enum_with_skip_variant-2.snap | 2 - ...__reflectapi_enum_with_skip_variant-3.snap | 4 +- ...basic__reflectapi_struct_documented-2.snap | 1 - ...basic__reflectapi_struct_documented-3.snap | 4 +- ...sts__basic__reflectapi_struct_empty-2.snap | 1 - ...sts__basic__reflectapi_struct_empty-3.snap | 4 +- ...s__basic__reflectapi_struct_newtype-2.snap | 1 - ...s__basic__reflectapi_struct_newtype-3.snap | 4 +- ...s__basic__reflectapi_struct_newtype-5.snap | 8 +- ...i_struct_one_basic_field_static_str-2.snap | 1 - ...i_struct_one_basic_field_static_str-3.snap | 4 +- ...ctapi_struct_one_basic_field_string-2.snap | 1 - ...ctapi_struct_one_basic_field_string-3.snap | 4 +- ..._basic_field_string_reflectapi_both-2.snap | 1 - ..._basic_field_string_reflectapi_both-3.snap | 4 +- ...ield_string_reflectapi_both_equally-2.snap | 1 - ...ield_string_reflectapi_both_equally-3.snap | 6 +- ...eld_string_reflectapi_both_equally2-2.snap | 1 - ...eld_string_reflectapi_both_equally2-3.snap | 4 +- ...ing_reflectapi_both_with_attributes-2.snap | 2 - ...ing_reflectapi_both_with_attributes-3.snap | 6 +- ...flectapi_struct_one_basic_field_u32-2.snap | 1 - ...flectapi_struct_one_basic_field_u32-3.snap | 4 +- ...ts__basic__reflectapi_struct_option-2.snap | 1 - ...ts__basic__reflectapi_struct_option-3.snap | 4 +- ...sts__basic__reflectapi_struct_tuple-2.snap | 1 - ...sts__basic__reflectapi_struct_tuple-3.snap | 4 +- ..._basic__reflectapi_struct_unit_type-2.snap | 1 - ..._basic__reflectapi_struct_unit_type-3.snap | 4 +- ..._basic__reflectapi_struct_unit_type-5.snap | 8 +- ...tapi_struct_with_additional_derives-2.snap | 1 - ...tapi_struct_with_additional_derives-3.snap | 4 +- ...ruct_with_all_primitive_type_fields-2.snap | 1 - ...ruct_with_all_primitive_type_fields-3.snap | 4 +- ...__basic__reflectapi_struct_with_arc-2.snap | 1 - ...__basic__reflectapi_struct_with_arc-3.snap | 4 +- ...ectapi_struct_with_arc_pointer_only-2.snap | 1 - ...ectapi_struct_with_arc_pointer_only-3.snap | 4 +- ...__reflectapi_struct_with_attributes-5.snap | 8 +- ...i_struct_with_attributes_input_only-2.snap | 1 - ...i_struct_with_attributes_input_only-3.snap | 4 +- ..._struct_with_attributes_output_only-2.snap | 1 - ..._struct_with_attributes_output_only-3.snap | 4 +- ...pi_struct_with_attributes_type_only-5.snap | 8 +- ...with_external_generic_type_fallback-2.snap | 1 - ...with_external_generic_type_fallback-3.snap | 1 - ...ectapi_struct_with_fixed_size_array-2.snap | 1 - ...ectapi_struct_with_fixed_size_array-3.snap | 4 +- ...sic__reflectapi_struct_with_hashmap-2.snap | 1 - ...sic__reflectapi_struct_with_hashmap-3.snap | 4 +- ...eflectapi_struct_with_hashset_field-2.snap | 1 - ...eflectapi_struct_with_hashset_field-3.snap | 4 +- ...i_struct_with_hashset_field_generic-2.snap | 1 - ...i_struct_with_hashset_field_generic-3.snap | 4 +- ...asic__reflectapi_struct_with_nested-2.snap | 1 - ...asic__reflectapi_struct_with_nested-3.snap | 4 +- ...lectapi_struct_with_nested_external-2.snap | 2 - ...lectapi_struct_with_nested_external-3.snap | 4 +- ...reflectapi_struct_with_self_via_arc-2.snap | 1 - ...reflectapi_struct_with_self_via_arc-3.snap | 4 +- ...__reflectapi_struct_with_skip_field-2.snap | 1 - ...__reflectapi_struct_with_skip_field-3.snap | 4 +- ...ectapi_struct_with_skip_field_input-2.snap | 2 - ...ectapi_struct_with_skip_field_input-3.snap | 4 +- ...ctapi_struct_with_skip_field_output-2.snap | 2 - ...ctapi_struct_with_skip_field_output-3.snap | 4 +- ...lectapi_struct_with_transform_array-2.snap | 1 - ...lectapi_struct_with_transform_array-3.snap | 4 +- ...flectapi_struct_with_transform_both-2.snap | 1 - ...flectapi_struct_with_transform_both-3.snap | 4 +- ...tapi_struct_with_transform_fallback-2.snap | 1 - ...tapi_struct_with_transform_fallback-3.snap | 4 +- ...ruct_with_transform_fallback_nested-2.snap | 1 - ...ruct_with_transform_fallback_nested-3.snap | 4 +- ...lectapi_struct_with_transform_input-2.snap | 2 - ...lectapi_struct_with_transform_input-3.snap | 4 +- ...ectapi_struct_with_transform_output-2.snap | 2 - ...ectapi_struct_with_transform_output-3.snap | 4 +- ...basic__reflectapi_struct_with_tuple-2.snap | 1 - ...basic__reflectapi_struct_with_tuple-3.snap | 4 +- ...sic__reflectapi_struct_with_tuple12-2.snap | 1 - ...sic__reflectapi_struct_with_tuple12-3.snap | 4 +- ...__basic__reflectapi_struct_with_vec-2.snap | 1 - ...__basic__reflectapi_struct_with_vec-3.snap | 4 +- ...reflectapi_struct_with_vec_external-2.snap | 2 - ...reflectapi_struct_with_vec_external-3.snap | 4 +- ...__reflectapi_struct_with_vec_nested-2.snap | 2 - ...__reflectapi_struct_with_vec_nested-3.snap | 4 +- ...sic__reflectapi_struct_with_vec_two-2.snap | 1 - ...sic__reflectapi_struct_with_vec_two-3.snap | 4 +- ...reflectapi_demo__tests__enums__enum-2.snap | 1 - ...reflectapi_demo__tests__enums__enum-3.snap | 4 +- ...tapi_demo__tests__enums__enum_empty-2.snap | 1 - ...tapi_demo__tests__enums__enum_empty-3.snap | 4 +- ...demo__tests__enums__enum_rename_num-2.snap | 1 - ...demo__tests__enums__enum_rename_num-3.snap | 4 +- ...variant_and_fields_and_named_fields-2.snap | 1 - ...variant_and_fields_and_named_fields-3.snap | 4 +- ...num_with_discriminant_ignored_input-2.snap | 1 - ...num_with_discriminant_ignored_input-3.snap | 4 +- ...um_with_discriminant_ignored_output-2.snap | 1 - ...um_with_discriminant_ignored_output-3.snap | 4 +- ...enums__enum_with_discriminant_input-2.snap | 1 - ...enums__enum_with_discriminant_input-3.snap | 4 +- ...nums__enum_with_discriminant_output-2.snap | 1 - ...nums__enum_with_discriminant_output-3.snap | 4 +- ..._enum_with_empty_variant_and_fields-2.snap | 1 - ..._enum_with_empty_variant_and_fields-3.snap | 4 +- ...emo__tests__enums__enum_with_fields-2.snap | 1 - ...emo__tests__enums__enum_with_fields-3.snap | 4 +- ...o__tests__enums__enum_with_generics-2.snap | 1 - ...o__tests__enums__enum_with_generics-3.snap | 4 +- ...nums__enum_with_generics_and_fields-2.snap | 1 - ...nums__enum_with_generics_and_fields-3.snap | 4 +- ...enerics_and_fields_and_named_fields-2.snap | 1 - ...enerics_and_fields_and_named_fields-3.snap | 4 +- ...lly_tagged_enum_with_tuple_variants-2.snap | 1 - ...lly_tagged_enum_with_tuple_variants-3.snap | 3 +- ...ally_tagged_enum_with_unit_variants-2.snap | 1 - ...ally_tagged_enum_with_unit_variants-3.snap | 4 +- ...ics__struct_with_circular_reference-2.snap | 1 - ...ics__struct_with_circular_reference-3.snap | 4 +- ...uct_with_circular_reference_generic-2.snap | 1 - ...uct_with_circular_reference_generic-3.snap | 4 +- ...h_circular_reference_generic_parent-2.snap | 1 - ...h_circular_reference_generic_parent-3.snap | 4 +- ...cular_reference_generic_without_box-2.snap | 3 +- ...cular_reference_generic_without_box-3.snap | 4 +- ...eference_generic_without_box_parent-2.snap | 3 +- ...eference_generic_without_box_parent-3.snap | 4 +- ...generic_without_box_parent_specific-2.snap | 1 - ...generic_without_box_parent_specific-3.snap | 4 +- ...__struct_with_nested_generic_struct-2.snap | 1 - ...__struct_with_nested_generic_struct-3.snap | 4 +- ...ct_with_nested_generic_struct_twice-2.snap | 1 - ...ct_with_nested_generic_struct_twice-3.snap | 4 +- ...enerics__struct_with_simple_generic-2.snap | 1 - ...enerics__struct_with_simple_generic-3.snap | 4 +- ...__generics__struct_with_vec_generic-2.snap | 1 - ...__generics__struct_with_vec_generic-3.snap | 4 +- ...cs__struct_with_vec_generic_generic-2.snap | 1 - ...cs__struct_with_vec_generic_generic-3.snap | 4 +- ...ct_with_vec_generic_generic_generic-2.snap | 1 - ...ct_with_vec_generic_generic_generic-3.snap | 4 +- ...tests__namespace__conflicting_names-2.snap | 1 - ...amespace__generic_and_type_conflict-2.snap | 2 - ...amespace__generic_and_type_conflict-3.snap | 2 - ...adj_repr_enum_with_untagged_variant-2.snap | 1 - ...adj_repr_enum_with_untagged_variant-3.snap | 4 +- ...ectapi_demo__tests__serde__datetime-2.snap | 2 - ...ectapi_demo__tests__serde__datetime-3.snap | 4 +- ...e__empty_variants_adjacently_tagged-2.snap | 1 - ...e__empty_variants_adjacently_tagged-3.snap | 4 +- ...e__empty_variants_externally_tagged-2.snap | 1 - ...e__empty_variants_externally_tagged-3.snap | 4 +- ...e__empty_variants_internally_tagged-2.snap | 1 - ...e__empty_variants_internally_tagged-3.snap | 4 +- ...sts__serde__empty_variants_untagged-2.snap | 1 - ...sts__serde__empty_variants_untagged-3.snap | 4 +- ...api_demo__tests__serde__enum_rename-2.snap | 1 - ...api_demo__tests__serde__enum_rename-3.snap | 4 +- ...demo__tests__serde__enum_rename_all-2.snap | 1 - ...demo__tests__serde__enum_rename_all-3.snap | 4 +- ...__serde__enum_rename_all_on_variant-2.snap | 1 - ...__serde__enum_rename_all_on_variant-3.snap | 4 +- ...s__serde__enum_rename_variant_field-2.snap | 1 - ...s__serde__enum_rename_variant_field-3.snap | 4 +- ...ectapi_demo__tests__serde__enum_tag-2.snap | 1 - ...ectapi_demo__tests__serde__enum_tag-3.snap | 4 +- ...emo__tests__serde__enum_tag_content-2.snap | 1 - ...emo__tests__serde__enum_tag_content-3.snap | 4 +- ..._serde__enum_tag_content_rename_all-2.snap | 1 - ..._serde__enum_tag_content_rename_all-3.snap | 4 +- ...i_demo__tests__serde__enum_untagged-2.snap | 1 - ...i_demo__tests__serde__enum_untagged-3.snap | 4 +- ..._tests__serde__enum_with_field_skip-2.snap | 1 - ..._tests__serde__enum_with_field_skip-3.snap | 4 +- ...__enum_with_rename_to_invalid_chars-2.snap | 1 - ...__enum_with_rename_to_invalid_chars-3.snap | 4 +- ...__enum_with_rename_to_invalid_chars-5.snap | 9 +- ...sts__serde__enum_with_variant_other-2.snap | 2 - ...sts__serde__enum_with_variant_other-3.snap | 4 +- ...ests__serde__enum_with_variant_skip-2.snap | 1 - ...ests__serde__enum_with_variant_skip-3.snap | 4 +- ..._enum_with_variant_skip_deserialize-2.snap | 2 - ..._enum_with_variant_skip_deserialize-3.snap | 4 +- ...e__enum_with_variant_skip_serialize-2.snap | 2 - ...e__enum_with_variant_skip_serialize-3.snap | 4 +- ...__serde__enum_with_variant_untagged-2.snap | 1 - ...__serde__enum_with_variant_untagged-3.snap | 4 +- ..._demo__tests__serde__external_impls-2.snap | 1 - ..._demo__tests__serde__external_impls-3.snap | 4 +- ...s__serde__flatten_internally_tagged-2.snap | 1 - ...s__serde__flatten_internally_tagged-3.snap | 4 +- ...pi_demo__tests__serde__flatten_unit-2.snap | 1 - ...pi_demo__tests__serde__flatten_unit-3.snap | 4 +- ...de__generic_struct_repr_transparent-5.snap | 8 +- ..._repr_transparent_partially_generic-5.snap | 8 +- ...tapi_demo__tests__serde__kebab_case-2.snap | 1 - ...tapi_demo__tests__serde__kebab_case-3.snap | 4 +- ...rde__nested_internally_tagged_enums-2.snap | 1 - ...rde__nested_internally_tagged_enums-3.snap | 4 +- ...ted_internally_tagged_enums_minimal-2.snap | 1 - ...ted_internally_tagged_enums_minimal-3.snap | 4 +- ..._newtype_variants_adjacently_tagged-2.snap | 1 - ..._newtype_variants_adjacently_tagged-3.snap | 4 +- ..._newtype_variants_externally_tagged-2.snap | 1 - ..._newtype_variants_externally_tagged-3.snap | 4 +- ..._newtype_variants_internally_tagged-2.snap | 1 - ..._newtype_variants_internally_tagged-3.snap | 4 +- ...api_demo__tests__serde__struct_from-2.snap | 1 - ...api_demo__tests__serde__struct_from-3.snap | 4 +- ...api_demo__tests__serde__struct_into-2.snap | 1 - ...api_demo__tests__serde__struct_into-3.snap | 4 +- ...i_demo__tests__serde__struct_rename-2.snap | 1 - ...i_demo__tests__serde__struct_rename-3.snap | 4 +- ...mo__tests__serde__struct_rename_all-2.snap | 1 - ...mo__tests__serde__struct_rename_all-3.snap | 4 +- ...erde__struct_rename_all_differently-2.snap | 2 - ...erde__struct_rename_all_differently-3.snap | 4 +- ...erde__struct_rename_all_pascal_case-2.snap | 1 - ...erde__struct_rename_all_pascal_case-3.snap | 4 +- ...s__serde__struct_rename_differently-2.snap | 1 - ...s__serde__struct_rename_differently-3.snap | 4 +- ...__tests__serde__struct_rename_field-2.snap | 2 - ...__tests__serde__struct_rename_field-3.snap | 4 +- ...repr_transparent_generic_inner_type-2.snap | 1 - ...repr_transparent_generic_inner_type-3.snap | 4 +- ...demo__tests__serde__struct_try_from-2.snap | 1 - ...demo__tests__serde__struct_try_from-3.snap | 4 +- ...__tests__serde__struct_with_flatten-2.snap | 1 - ...__tests__serde__struct_with_flatten-3.snap | 4 +- ...serde__struct_with_flatten_optional-2.snap | 1 - ...serde__struct_with_flatten_optional-3.snap | 4 +- ..._with_flatten_optional_and_required-2.snap | 1 - ..._with_flatten_optional_and_required-3.snap | 4 +- ...struct_with_rename_to_invalid_chars-2.snap | 1 - ...struct_with_rename_to_invalid_chars-3.snap | 4 +- ...e__struct_with_rename_to_kebab_case-2.snap | 1 - ...e__struct_with_rename_to_kebab_case-3.snap | 4 +- ...s__serde__struct_with_serde_default-2.snap | 2 - ...s__serde__struct_with_serde_default-3.snap | 4 +- ...ests__serde__struct_with_serde_skip-2.snap | 1 - ...ests__serde__struct_with_serde_skip-3.snap | 4 +- ..._struct_with_serde_skip_deserialize-2.snap | 2 - ..._struct_with_serde_skip_deserialize-3.snap | 4 +- ...e__struct_with_serde_skip_serialize-2.snap | 2 - ...e__struct_with_serde_skip_serialize-3.snap | 4 +- ...struct_with_serde_skip_serialize_if-2.snap | 2 - ...struct_with_serde_skip_serialize_if-3.snap | 4 +- ...erde__struct_with_serde_transparent-5.snap | 8 +- ...ectapi_demo__tests__serde__timezone-2.snap | 1 - ...ectapi_demo__tests__serde__timezone-3.snap | 1 - ...api_demo__tests__serde__unit_struct-2.snap | 1 - ...api_demo__tests__serde__unit_struct-3.snap | 4 +- ...api_demo__tests__serde__unit_struct-5.snap | 8 +- ...mo__tests__serde__unit_tuple_struct-2.snap | 1 - ...mo__tests__serde__unit_tuple_struct-3.snap | 4 +- ...mo__tests__serde__unit_tuple_struct-5.snap | 8 +- reflectapi/Cargo.toml | 3 +- reflectapi/src/codegen/python.rs | 2053 ++++++++++------- reflectapi/src/codegen/rust.rs | 422 ++-- reflectapi/src/codegen/typescript.rs | 282 +-- 272 files changed, 1811 insertions(+), 1773 deletions(-) diff --git a/.gitignore b/.gitignore index 6f41d0cc..f08aa97a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target docs/book +.vscode/settings.json diff --git a/Cargo.lock b/Cargo.lock index 756dd0ec..80f12f03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,50 +141,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" -[[package]] -name = "askama" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b79091df18a97caea757e28cd2d5fda49c6cd4bd01ddffd7ff01ace0c0ad2c28" -dependencies = [ - "askama_derive", - "askama_escape", - "humansize", - "num-traits", - "percent-encoding", -] - -[[package]] -name = "askama_derive" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19fe8d6cb13c4714962c072ea496f3392015f0989b1a2847bb4b2d9effd71d83" -dependencies = [ - "askama_parser", - "basic-toml", - "mime", - "mime_guess", - "proc-macro2", - "quote", - "serde", - "syn 2.0.106", -] - -[[package]] -name = "askama_escape" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341" - -[[package]] -name = "askama_parser" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acb1161c6b64d1c3d83108213c2a2533a342ac225aabd0bda218278c2ddb00c0" -dependencies = [ - "nom", -] - [[package]] name = "async-trait" version = "0.1.89" @@ -289,15 +245,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "basic-toml" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" -dependencies = [ - "serde", -] - [[package]] name = "bit-set" version = "0.8.0" @@ -926,15 +873,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "humansize" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" -dependencies = [ - "libm", -] - [[package]] name = "hyper" version = "1.7.0" @@ -1225,12 +1163,6 @@ version = "0.2.175" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" -[[package]] -name = "libm" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" - [[package]] name = "libredox" version = "0.1.9" @@ -1316,12 +1248,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.8.9" @@ -1377,16 +1303,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "num-conv" version = "0.1.0" @@ -1714,7 +1630,6 @@ name = "reflectapi" version = "0.16.8" dependencies = [ "anyhow", - "askama", "axum", "bytes", "check_keyword", @@ -1741,7 +1656,6 @@ name = "reflectapi-cli" version = "0.16.8" dependencies = [ "anyhow", - "askama", "clap", "clap_derive", "reflectapi", diff --git a/reflectapi-cli/Cargo.toml b/reflectapi-cli/Cargo.toml index c1a1fc57..264a0439 100644 --- a/reflectapi-cli/Cargo.toml +++ b/reflectapi-cli/Cargo.toml @@ -27,7 +27,6 @@ rouille = "3" clap = { version = "4.5.3", features = ["derive"] } clap_derive = "4.5.3" -askama = "0.12.1" anyhow = "1.0.81" serde_json = "1.0.114" diff --git a/reflectapi-demo/clients/rust/generated/src/generated.rs b/reflectapi-demo/clients/rust/generated/src/generated.rs index 2fdf2db4..0e2e1f31 100644 --- a/reflectapi-demo/clients/rust/generated/src/generated.rs +++ b/reflectapi-demo/clients/rust/generated/src/generated.rs @@ -218,7 +218,6 @@ pub mod interface { } } pub mod types { - pub mod myapi { #[derive(Debug, serde::Deserialize, serde::Serialize)] diff --git a/reflectapi-demo/clients/typescript/generated.ts b/reflectapi-demo/clients/typescript/generated.ts index a83c1b9e..48c1f537 100644 --- a/reflectapi-demo/clients/typescript/generated.ts +++ b/reflectapi-demo/clients/typescript/generated.ts @@ -250,9 +250,7 @@ class ClientInstance { } type UnionToIntersection = ( - U extends any - ? (k: U) => unknown - : never + U extends any ? (k: U) => unknown : never ) extends (k: infer I) => void ? I : never; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap index 7e8c893c..ee5f07e0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap index 13bc4884..2ba3e1fa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < StructWithDeprecatedField > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap index 73a2cee5..0c60e3f9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap index 60cd75cf..c21d4305 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumDocumented:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap index 031e108b..f9cbea5d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap @@ -35,14 +35,12 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { export namespace input { export type TestEnumWithSkipVariant = "A" | "I"; } - export namespace output { export type TestEnumWithSkipVariant = "A" | "O"; } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap index 609bbd3a..dcfe2c4a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithSkipVariant > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap index 7146ac03..9d11ef49 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap index 41f92391..fc61c444 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructDocumented > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap index 4d0a5287..5462397a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap index 353e34c6..fd92b737 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructEmpty > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap index 2d2138fb..47a89000 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap index 824e6281..850517b0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructNewtype > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap index 9a3cc970..f332ce80 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[str] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_model=data, response_model=str, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[str] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_model=data, response_model=str, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap index eacbb4ed..4cd72b27 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap index 587a7c27..35ef3a91 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_output_rust_code::()" -snapshot_kind: text +expression: "super :: into_output_rust_code :: < TestStructOneBasicFieldStaticStr > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap index 9459c5f1..ffabf2ec 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap index 8d961a48..8e877e9e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructOneBasicFieldString > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap index 6d0e5f4b..74bee317 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap index ee6e1774..c1ffc4d3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructOneBasicFieldStringReflectBoth > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap index 7fe1f8a1..197da752 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap index bbcbe6e9..8122e8f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructOneBasicFieldStringReflectBothEqually >\n()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,7 +33,7 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStringReflectBothEqually, headers: reflectapi::Empty) + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::basic::TestStructOneBasicFieldStringReflectBothEqually, headers: reflectapi::Empty) -> Result>{ reflectapi::rt::__request_impl( &self.client, @@ -49,7 +48,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap index 4cfc3eb3..2e791642 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap index e5da25fa..bdace3be 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestStructOneBasicFieldStringReflectBothEqually > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap index 7eb0f0ba..f531d413 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { _f: number /* i32 */; } } - export namespace output { export interface TestStructOneBasicFieldStringReflectBothDifferently { _f: number /* u32 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap index 7b8655a6..557a1898 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: <\nTestStructOneBasicFieldStringReflectBothDifferently > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -34,7 +33,7 @@ pub mod interface { Ok(Self { client, base_url }) } - pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::basic::input::TestStructOneBasicFieldStringReflectBothDifferently, headers: reflectapi::Empty) + pub async fn inout_test(&self, input: super::types::reflectapi_demo::tests::basic::input::TestStructOneBasicFieldStringReflectBothDifferently, headers: reflectapi::Empty) -> Result>{ reflectapi::rt::__request_impl( &self.client, @@ -49,7 +48,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap index 2011e6ce..d9949203 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap index c04de76e..cd62a2ba 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructOneBasicFieldU32 > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap index 592b8a3f..4470b6d7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap index bbf3bc36..f72b4d14 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructOption > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap index 66f7b5c7..a42d5ecc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap index 28f7d9e2..ce894de2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructTuple > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap index ca003442..2a7c7350 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap index 79e558f7..7b2e9d8a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructUnitType > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap index f71bd148..c6118833 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[None] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_model=data, response_model=None, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[None] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_model=data, response_model=None, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap index 29daacc4..321e8ec2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap index e47b41d6..995683e8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap index 8f68b3cc..9b4106cc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap index b6b5be3b..c16c7848 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithAllPrimitiveTypeFields > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap index e1c1e224..64f1d015 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap index 5ea60c39..f8787671 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithArc > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap index 2f612c93..67d57a6f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap index ecf28aae..16d30e81 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithArcPointerOnly > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap index 42fb6a07..406c057d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[int] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_data=data, response_model=int, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[int] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_data=data, response_model=int, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap index 93b031fc..5ad58a18 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap index 1db60fee..2e408ade 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithAttributesInputOnly > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap index d155d78e..e68cc50d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap index 70155ac7..075c2162 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithAttributesOutputOnly > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -53,7 +52,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap index 20547d53..88f5657a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[str] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_data=data, response_model=str, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[str] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_data=data, response_model=str, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap index f74d5a9b..0a3ccdbc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-3.snap index 6bb5c167..52ec81e0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-3.snap @@ -54,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap index c0467e14..13ca76f3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap index 22daae5a..6afe1709 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithFixedSizeArray > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap index 829106bd..b8ef9662 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap index 681e47ec..e51bc84c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithHashMap > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap index 2c4f6f94..db66e9c4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap index cb2c6913..a8d62808 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithHashSetField > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap index fee6d3e0..da8c2758 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap index d1b19b3a..a873f7d1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::>()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithHashSetFieldGeneric:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -59,7 +58,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap index a88890a0..7a04fbd3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap index 462118d8..cfe2f37c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithNested > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap index 2f3c32b1..7f918f6f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -43,7 +42,6 @@ export namespace reflectapi_demo { _f: reflectapi_demo.tests.test_lib.TestStructNested; } } - export namespace test_lib { export interface TestStructNested { _f: string; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap index 754813f5..0be0f064 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithNestedExternal > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap index f64577ec..aa400c67 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap index 99b8af06..cdfda325 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSelfViaArc > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap index 52e5ed2d..8b1b3949 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap index cc33fef8..21ca4169 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSkipField > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap index 8e2e3133..aa5ebf6a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap @@ -35,14 +35,12 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { export namespace input { export interface TestStructWithSkipFieldInput {} } - export namespace output { export interface TestStructWithSkipFieldInput { _f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap index 9f042d8e..e24444d9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSkipFieldInput > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap index 05ed8c74..9c5658f1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } - export namespace output { export interface TestStructWithSkipFieldOutput {} } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap index cfb50f9b..77e8ec3b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSkipFieldOutput > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap index 085ab1f0..3ed1bd9d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap index 123380cd..dc55a443 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTransformArray > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap index 6fd77c8e..abacc009 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap index 4f118b7d..3984898f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTransformBoth > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap index 25a4e8fe..f6cbd3d2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap index d629000c..c1b68ba2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTransformFallback > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap index 6528f9c3..23409b75 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap index 3a55ce12..182b6ff8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTransformFallbackNested > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap index 8555a765..507571fc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } - export namespace output { export interface TestStructWithTransformInput { _f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap index 05bf8b2a..90460d4f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTransformInput > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap index 58a5fadf..35e7ff4b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } - export namespace output { export interface TestStructWithTransformOutput { _f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap index bd1e81b6..b5842ee3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTransformOutput > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap index 9212ae0d..309af969 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap index d978e073..bb3c76b5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTuple > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap index 1f13c6aa..97f799b3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap index f58d93f4..a8bf5e6f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithTuple12 > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap index f2c6b429..a47d4fe2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap index 59493894..35722718 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithVec > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap index 9a2e89ef..6b139484 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -40,7 +39,6 @@ export namespace reflectapi_demo { _f: Array; } } - export namespace test_lib { export interface TestStructNested { _f: string; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap index c05ed3e5..11d14638 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithVecExternal > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap index 0aebaea1..a7d0f52a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -40,7 +39,6 @@ export namespace reflectapi_demo { _f: Array>; } } - export namespace test_lib { export interface TestStructNested { _f: string; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap index 0df11eaf..b3452c12 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithVecNested > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap index 6709d083..704697e6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap index 825154ef..96c0983f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/basic.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithVecTwo > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap index 8f512421..d89ab669 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap index 6a88129a..30c935ec 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnum > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap index 9c7b4fb1..fef585cf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap index cfe649c0..99b850f9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumEmpty > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap index a2d33efc..c18473b4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap index e752db3f..e9fe0dd1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Nums > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap index 571dc171..64873227 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap index 87e70978..f5ebafd9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestEnumWithBasicVariantAndFieldsAndNamedFields > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap index 9cf83303..5ee29c34 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap index 422ba201..8fd35ff4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumWithDiscriminantIgnored > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap index c659d5ac..725e0861 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap index 1b0e35c0..2eed9c2c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_output_rust_code::()" -snapshot_kind: text +expression: "super :: into_output_rust_code :: < TestEnumWithDiscriminantIgnored > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap index 32a53360..708295eb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap index f50b24a9..93f03530 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumWithDiscriminant > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap index 8b2c39ae..51dab210 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap index 8891a8eb..4aedd4ae 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_output_rust_code::()" -snapshot_kind: text +expression: "super :: into_output_rust_code :: < TestEnumWithDiscriminant > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap index 3b76e37b..eed75cde 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap index 1712c21c..930dcff1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumWithEmptyVariantAndFields > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap index 8d820945..0235bd03 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap index 2d22f43b..cb95b8ab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumWithFields > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap index e5c67b28..71893a54 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap index a75bc0a5..574c2826 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumWithGenerics:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap index 97692607..7b100c9d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap index 634a4efa..0ca5ab25 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestEnumWithGenericsAndFields:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap index 5763a1e6..777acde0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap index d84ae88b..a31a746e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestEnumWithGenericsAndFieldsAndNamedFields:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap index e733a731..42692317 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-3.snap index 481de001..b268e49e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-3.snap @@ -1,6 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_rust_code::()" +expression: "super :: into_rust_code :: < E > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -54,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap index 2772fe60..e63d661f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-3.snap index 33155e4c..31fab3d3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/enums.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < A > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap index ddc08b5d..29d1675a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap index c2358414..6c1bc983 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructWithCircularReference > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap index 65274429..70e63eb7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap index 9c23b164..b9e928de 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestStructWithCircularReferenceGeneric:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap index b766bbcf..6e8af7f4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap index c1f4714e..e88ad88b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestStructWithCircularReferenceGenericParent:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap index 62242037..e51689d3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap @@ -1,6 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super :: into_input_typescript_code :: <\nTestStructWithCircularReferenceGenericWithoutBox::<\nTestStructWithCircularReferenceGenericWithoutBox,\nTestStructWithCircularReferenceGenericWithoutBox, >\n> ()" +expression: "super :: into_input_typescript_code :: <\nTestStructWithCircularReferenceGenericWithoutBox::<\nTestStructWithCircularReferenceGenericWithoutBox,\nTestStructWithCircularReferenceGenericWithoutBox, > > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -41,7 +41,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap index 68739f03..fb259197 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::,\n TestStructWithCircularReferenceGenericWithoutBox>>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestStructWithCircularReferenceGenericWithoutBox::<\nTestStructWithCircularReferenceGenericWithoutBox,\nTestStructWithCircularReferenceGenericWithoutBox, > > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap index 62d30ee7..d787d84e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap @@ -1,6 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super :: into_input_typescript_code :: <\nTestStructWithCircularReferenceGenericWithoutBoxParent::<\nTestStructWithCircularReferenceGenericWithoutBoxParent,\nTestStructWithCircularReferenceGenericWithoutBoxParent, >\n> ()" +expression: "super :: into_input_typescript_code :: <\nTestStructWithCircularReferenceGenericWithoutBoxParent::<\nTestStructWithCircularReferenceGenericWithoutBoxParent,\nTestStructWithCircularReferenceGenericWithoutBoxParent, > > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -41,7 +41,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap index dc0760d8..8711ed7b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::,\n TestStructWithCircularReferenceGenericWithoutBoxParent>>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestStructWithCircularReferenceGenericWithoutBoxParent::<\nTestStructWithCircularReferenceGenericWithoutBoxParent,\nTestStructWithCircularReferenceGenericWithoutBoxParent, > > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap index 5a35c83a..cf132ee3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap index 56d949a4..a94b3d77 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestStructWithCircularReferenceGenericWithoutBoxParentSpecific > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap index b9b64891..2c06b140 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap index 925f7f5c..83ab6e32 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructWithNestedGenericStruct > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap index fe57144d..7d98ac6b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap index 67fb7214..3aa89247 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructWithNestedGenericStructTwice > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap index dd709c67..d2de121a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap index 91754009..454dc5e9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructWithSimpleGeneric:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap index 045b047c..b4d1df8a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap index 9ee16585..6dca708c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructWithVecGeneric:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap index e3e18385..02bf27c9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap index 6febf588..70d73284 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: < TestStructWithVecGenericGeneric:: > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -54,7 +53,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap index 6f0b1430..72676b8b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap @@ -34,7 +34,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap index 8195eb55..b5508c5d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super::into_input_rust_code::>>()" -snapshot_kind: text +expression: "super :: into_input_rust_code :: <\nTestStructWithVecGenericGenericGeneric::> > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -52,7 +51,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap index 0c0f49ca..eb123790 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap @@ -28,7 +28,6 @@ export namespace __definition { export namespace foos { export interface Foo {} } - export namespace reflectapi { /** * Struct object with no fields diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap index eb874bcc..29c55740 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap @@ -22,7 +22,6 @@ export namespace __definition { } } export type T = I; - export namespace reflectapi { /** * Struct object with no fields @@ -34,7 +33,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace namespace { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap index e625b480..8fce2d95 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/namespace.rs expression: rust -snapshot_kind: text --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -57,7 +56,6 @@ pub mod interface { pub mod types { pub type T = I; - pub mod reflectapi_demo { pub mod tests { pub mod namespace { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap index b9173123..4dfbcb0f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap index fe63bb47..86ca82f8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap index 91e3e017..f3a29a9b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -48,7 +47,6 @@ export namespace reflectapi_demo { } } } - export namespace std { export namespace time { /** diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap index 82b32b5f..6514a9e9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStruct > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap index 63f40bab..b32b6a53 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap index 296aa5b7..489cd44d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEmptyVariantsAdjacentlyTagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap index cefd5f83..7df2e1b9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap index 59301b26..49ec8cec 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEmptyVariantsExternallyTagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap index 92aac684..3b0803ad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap index 76e6ac71..b5b78055 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEmptyVariantsInterallyTagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap index 47a07a94..c45180d3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap index f43bd6c7..e3d4431a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEmptyVariantsUntagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap index 2d379a61..4e1ef829 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap index 0bdbcb12..6afd3963 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumRename > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap index a3209285..fce67c4d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap index cbb1ebce..8123131a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumRenameAll > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap index 937e5588..5d310fb4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap index ee1e66c0..9da2b437 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumRenameAllOnVariant > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap index d768729b..ed272ff7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap index 129dea87..49f20850 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumRenameVariantField > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap index 1838565d..953a73ec 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap index d1867c65..8a1047e0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumTag > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap index 22db705c..01545f20 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap index 4ab107bc..d16877a1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumTagContent > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap index b58f6e88..7c77ac4a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap index b24c6049..363146b4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumTagContentRenameAll > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap index a7a877e4..a9c252a9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap index 4f6f5be0..690bb48f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumUntagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap index 82b81991..b0596d03 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap index cbff5f70..8b2f9a9e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithFieldSkip > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap index 27e9f310..aac5d851 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap index 7aaa3d15..e8ec43ab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithRenameToInvalidChars > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index 508eb129..fd13a06d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -40,7 +40,6 @@ ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants = ReflectapiDem class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars(RootModel[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants]): """Externally tagged enum""" - @model_validator(mode='before') @classmethod def _validate_externally_tagged(cls, data): @@ -75,7 +74,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars] = None, @@ -97,7 +95,7 @@ class AsyncInoutClient: params=params if params else None, json_model=data, response_model=ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars, -) + ) class AsyncClient(AsyncClientBase): @@ -110,6 +108,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -119,7 +118,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars] = None, @@ -141,7 +139,7 @@ class InoutClient: params=params if params else None, json_model=data, response_model=ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars, -) + ) class Client(ClientBase): @@ -154,6 +152,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap index 6df45152..6682bfe7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap @@ -35,14 +35,12 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export type TestEnumWithVariantOther = { type: "V0" }; } - export namespace output { export type TestEnumWithVariantOther = | { type: "V0" } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap index c98749d8..2800190c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithVariantOther > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap index 7dc8d81c..e9bbe858 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap index 002c425e..8d146e1d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithVariantSkip > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap index ce8bc0c1..31bc8e67 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap @@ -35,14 +35,12 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export type TestEnumWithVariantSkipDeserialize = never; } - export namespace output { export type TestEnumWithVariantSkipDeserialize = "_Variant1"; } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap index ec6a214b..6094be35 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithVariantSkipDeserialize > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap index 209d6a21..1fb057ab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap @@ -35,14 +35,12 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export type TestEnumWithVariantSkipSerialize = "Variant1"; } - export namespace output { export type TestEnumWithVariantSkipSerialize = never; } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap index 8507ce01..226325b3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithVariantSkipSerialize > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap index dce10692..c4a440b1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap index 88a7721b..59340730 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestEnumWithVariantUntagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap index 5b7f01e1..988adc1c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap index 7c0eb279..85466a22 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap index 11ff2fe1..9de56b91 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap index d455b97d..cf1cd467 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap index 900babad..26c64c80 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap index ededeca1..c6337f31 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::>()" -snapshot_kind: text +expression: "super :: into_rust_code :: < S > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -61,7 +60,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap index 65dbac3a..b89abf14 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[bytes] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_model=data, response_model=bytes, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[bytes] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_model=data, response_model=bytes, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap index eb868688..11af942f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[dict[str, int]] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_model=data, response_model=dict[str, int], -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[dict[str, int]] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_model=data, response_model=dict[str, int], -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap index 6df8eafa..a308eb91 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap index 9b6689b5..285e0493 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap index 0bea7ce8..d37a9a06 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap index eec41c11..71582322 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap index ff7e9fe3..da2fa8cf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap index 1af7dcb3..4236e107 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap index 4877ee47..a6dc9747 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap index 2c081e62..27f114d5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestNewtypeVariantsAdjacentlyTagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap index f24252fc..ac5338da 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap index 60928008..d2d52b1b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestNewtypeVariantsExternallyTagged > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap index 818298af..1d14449c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap index b0b4da84..d2875d4a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Enum > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap index 1dfe57e6..c2cee6cb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap index cf1fc631..04b39467 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructFromProxy > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap index bb37aafa..ac457765 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap index 64fd50ba..30d3eab4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructIntoProxy > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap index b5059218..36f76a07 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap index 33a55555..bf84bdb5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructRename > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap index 0fd2228f..b116f42b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap index 24146efe..9629ca0a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructRenameAll > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap index 21c5b58a..ae151db1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { field_name: number /* u8 */; } } - export namespace output { export interface TestStructRenameAllDifferently { fieldName: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap index c8b79b27..b675e3d5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructRenameAllDifferently > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap index 863ad32d..aafbe0ae 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap index e1026faa..23146eb9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructRenameAllPascalCase > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap index 6e80e1e8..9f6474af 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap index a2bb77ce..a3093137 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructRenameDifferently > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap index 0321b396..9f765e59 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { fieldName: number /* u8 */; } } - export namespace output { export interface TestStructRenameField { field_name: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap index 8d974921..04baa8d8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructRenameField > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap index 1dd2d581..9597cd2d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap index 360cfdd5..8ee04f83 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < Test > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap index 42219024..1b86ba27 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap index d16fcb1f..a917b455 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructTryFormProxy > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap index 2a8f5d6d..98f17a26 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap index 91ad8d80..e67ff456 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithFlatten > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap index b7a85754..c33cfb6b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap index a2752955..2cdf9bf3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithFlattenOptional > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap index a9cf69cf..8bbc2784 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap index 2590e27f..106deb7a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithFlattenOptionalAndRequired > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap index 0b1b7f28..b1e16fd8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap index 2c20efb7..20885b56 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithRenameToInvalidChars > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap index 042eadaf..592a4ed4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap index ff22224a..a165d910 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithRenameToKebabCase > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap index 5d8d3c1d..a902f818 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { f?: number /* u8 */; } } - export namespace output { export interface TestStructWithSerdeDefault { f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap index debb962c..8dfa7b8d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSerdeDefault > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap index a6467587..a4b4b413 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap index 973dfc79..ad7e27d8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSerdeSkip > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap index fce8259e..396866a4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap @@ -35,14 +35,12 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export interface TestStructWithSerdeSkipDeserialize {} } - export namespace output { export interface TestStructWithSerdeSkipDeserialize { f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap index 53a4b9ef..4c582160 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSerdeSkipDeserialize > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap index ed52289a..6ad0080e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } - export namespace output { export interface TestStructWithSerdeSkipSerialize {} } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap index 13fd8f57..aad6255b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSerdeSkipSerialize > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap index 2a24cfe6..529d764e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap @@ -35,7 +35,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -44,7 +43,6 @@ export namespace reflectapi_demo { f: number /* u8 */ | null; } } - export namespace output { export interface TestStructWithSerdeSkipSerializeIf { f?: number /* u8 */ | null; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap index a9f25cac..05cf6f34 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestStructWithSerdeSkipSerializeIf > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap index cc5d66e3..9bd2c4f9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[int] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_data=data, response_model=int, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[int] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_data=data, response_model=int, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap index d7f04c8d..ade664ab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-3.snap index ef636176..c893f6a9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-3.snap @@ -54,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap index 5a388f22..88d5242e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap index e5c48847..e2df29ea 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestUnitStruct > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap index f9f137ab..1f8b3d23 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[None] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_model=data, response_model=None, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[None] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_model=data, response_model=None, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap index 4d4fa641..d5441ab7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap @@ -32,7 +32,6 @@ export namespace reflectapi { */ export interface Infallible {} } - export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap index 91289318..9b98c3cd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-3.snap @@ -1,7 +1,6 @@ --- source: reflectapi-demo/src/tests/serde.rs -expression: "super::into_rust_code::()" -snapshot_kind: text +expression: "super :: into_rust_code :: < TestUnitTupleStruct > ()" --- // DO NOT MODIFY THIS FILE MANUALLY // This file was generated by reflectapi-cli @@ -55,7 +54,6 @@ pub mod interface { } } pub mod types { - pub mod reflectapi_demo { pub mod tests { pub mod serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap index 48a97ca8..2967b69e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap @@ -31,7 +31,6 @@ class AsyncInoutClient: def __init__(self, client: AsyncClientBase) -> None: self._client = client - async def test( self, data: Optional[None] = None, @@ -53,7 +52,7 @@ class AsyncInoutClient: params=params if params else None, json_model=data, response_model=None, -) + ) class AsyncClient(AsyncClientBase): @@ -66,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -75,7 +75,6 @@ class InoutClient: def __init__(self, client: ClientBase) -> None: self._client = client - def test( self, data: Optional[None] = None, @@ -97,7 +96,7 @@ class InoutClient: params=params if params else None, json_model=data, response_model=None, -) + ) class Client(ClientBase): @@ -110,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) diff --git a/reflectapi/Cargo.toml b/reflectapi/Cargo.toml index c665dffc..6986f5f6 100644 --- a/reflectapi/Cargo.toml +++ b/reflectapi/Cargo.toml @@ -47,7 +47,6 @@ rust_decimal = { version = "1.35.0", optional = true, features = ["serde"] } axum = { version = "0.8.1", optional = true } # optional 3rd party dependencies for enabling codegen -askama = { version = "0.12.1", optional = true } anyhow = { version = "1.0.81", optional = true } indexmap = { version = "2.2.6", optional = true, features = ["serde"] } check_keyword = { version = "0.2.0", optional = true } @@ -77,7 +76,7 @@ rust_decimal = ["dep:rust_decimal"] # based on different web server frameworks axum = ["dep:axum", "builder"] # feature flag for enabling codegen libraries -codegen = ["dep:askama", "dep:anyhow", "dep:indexmap", "dep:check_keyword", "dep:serde_json"] +codegen = ["dep:anyhow", "dep:indexmap", "dep:check_keyword", "dep:serde_json"] rt = ["dep:http", "dep:serde_json", "dep:bytes", "dep:url"] glob = ["reflectapi-schema/glob"] json = ["dep:serde_json"] diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 9e4df705..5e45cb2c 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1,8 +1,5 @@ use std::collections::{BTreeMap, BTreeSet, HashSet, VecDeque}; -use anyhow::Context; -use askama::Template; - use crate::{Schema, TypeReference}; use reflectapi_schema::{Function, Type}; @@ -507,7 +504,7 @@ fn render_struct_with_flatten( generic_params: active_generics, }; - let rendered = struct_template.render()?; + let rendered = struct_template.render(); Ok(rendered) } @@ -787,11 +784,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let file_header = templates::FileHeader { package_name: config.package_name.clone(), }; - generated_code.push( - file_header - .render() - .context("Failed to render file header")?, - ); + generated_code.push(file_header.render()); // Check if we have enums in the schema let all_type_names = schema.consolidate_types(); @@ -1025,11 +1018,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { generate_sync: config.generate_sync, base_url: config.base_url.clone(), }; - generated_code.push( - client_template - .render() - .context("Failed to render client class")?, - ); + generated_code.push(client_template.render()); // Generate nested class structure let nested_classes = generate_nested_class_structure(&rendered_types, &schema); @@ -1098,11 +1087,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let testing_template = templates::TestingModule { types: user_defined_types, }; - generated_code.push( - testing_template - .render() - .context("Failed to render testing module")?, - ); + generated_code.push(testing_template.render()); } let result = generated_code.join("\n\n"); @@ -1429,7 +1414,7 @@ fn render_struct( generic_params: active_generics.clone(), }; - class_template.render().context("Failed to render struct") + Ok(class_template.render()) } fn render_enum_without_factory( @@ -1540,7 +1525,7 @@ fn render_enum_without_factory( variants, }; - let rendered = enum_template.render().context("Failed to render enum")?; + let rendered = enum_template.render(); Ok((rendered, None)) } } @@ -1604,7 +1589,7 @@ fn render_adjacently_tagged_enum_without_factory( is_generic: !generic_params.is_empty(), generic_params: generic_params.clone(), }; - variant_models.push(variant_model.render()?); + variant_models.push(variant_model.render()); union_variants.push(variant_class_name); } Fields::Named(named_fields) => { @@ -1655,7 +1640,7 @@ fn render_adjacently_tagged_enum_without_factory( is_generic: !generic_params.is_empty(), generic_params: generic_params.clone(), }; - variant_models.push(variant_model.render()?); + variant_models.push(variant_model.render()); union_variants.push(variant_class_name); } } @@ -1916,7 +1901,7 @@ fn render_externally_tagged_enum( generic_params: generic_params.clone(), }; - variant_models.push(variant_model.render()?); + variant_models.push(variant_model.render()); let union_member = if !generic_params.is_empty() { format!("{}[{}]", variant_class_name, generic_params.join(", ")) } else { @@ -1999,7 +1984,7 @@ fn render_externally_tagged_enum( generic_params: generic_params.clone(), }; - variant_models.push(variant_model.render()?); + variant_models.push(variant_model.render()); let union_member = if !generic_params.is_empty() { format!("{}[{}]", variant_class_name, generic_params.join(", ")) } else { @@ -2055,9 +2040,7 @@ fn render_externally_tagged_enum( is_generic, generic_params: generic_params.clone(), }; - let enum_code = template - .render() - .context("Failed to render externally tagged enum")?; + let enum_code = template.render(); // Generate factory class for ergonomic instantiation let factory_class_code = generate_externally_tagged_factory_class(enum_def, &enum_name)?; @@ -2466,9 +2449,7 @@ fn render_primitive_enum(enum_def: &reflectapi_schema::Enum) -> anyhow::Result String { } pub mod templates { - use super::*; - - #[derive(Template)] - #[template( - source = r#"''' -Generated Python client for {{ package_name }}. + use std::fmt::Write; -DO NOT MODIFY THIS FILE MANUALLY. -This file is automatically generated by ReflectAPI. -''' - -from __future__ import annotations -"#, - ext = "txt" - )] pub struct FileHeader { pub package_name: String, } - #[derive(Template)] - #[template( - source = r#" -# Standard library imports -{% if has_datetime %}from datetime import datetime{% if has_date %}, date{% endif %}{% if has_timedelta %}, timedelta{% endif %} -{% else if has_date %}from datetime import date{% if has_timedelta %}, timedelta{% endif %} -{% else if has_timedelta %}from datetime import timedelta -{% endif %}{% if has_enums %}from enum import Enum -{% endif %}from typing import Any, Optional, TypeVar, Generic, Union{% if has_annotated %}, Annotated{% endif %}{% if has_literal %}, Literal{% endif %} -{% if has_uuid %}from uuid import UUID -{% endif %}{% if has_warnings %}import warnings -{% endif %} - -# Third-party imports -from pydantic import BaseModel, ConfigDict, Field{% if has_externally_tagged_enums %}, RootModel, model_validator, model_serializer, PrivateAttr{% endif %} - -# Runtime imports -{% if has_async %}{% if has_sync %}from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse{% else %}from reflectapi_runtime import AsyncClientBase, ApiResponse{% endif %}{% else %}{% if has_sync %}from reflectapi_runtime import ClientBase, ApiResponse{% endif %}{% endif %} -{% if has_reflectapi_option %}from reflectapi_runtime import ReflectapiOption -{% endif %}{% if has_reflectapi_empty %}from reflectapi_runtime import ReflectapiEmpty -{% endif %}{% if has_reflectapi_infallible %}from reflectapi_runtime import ReflectapiInfallible -{% endif %}{% if has_testing %}from reflectapi_runtime.testing import MockClient, create_api_response -{% endif %} - -{% for type_var in global_type_vars %}{{ type_var }} = TypeVar('{{ type_var }}') -{% endfor %} -"#, - ext = "txt" - )] + impl FileHeader { + pub fn render(&self) -> String { + format!( + "'''\nGenerated Python client for {}.\n\nDO NOT MODIFY THIS FILE MANUALLY.\nThis file is automatically generated by ReflectAPI.\n'''\n\nfrom __future__ import annotations\n", + self.package_name + ) + } + } + pub struct Imports { pub has_async: bool, pub has_sync: bool, @@ -4578,19 +4516,105 @@ from pydantic import BaseModel, ConfigDict, Field{% if has_externally_tagged_enu pub global_type_vars: Vec, } - #[derive(Template)] - #[template( - source = r#"class {{ name }}(BaseModel{% if is_generic %}, Generic[{% for param in generic_params %}{{ param }}{% if !loop.last %}, {% endif %}{% endfor %}]{% endif %}): -{% if description.is_some() && !description.as_deref().unwrap().is_empty() %} """{{ description.as_deref().unwrap() }}""" -{% else %} """Generated data model.""" -{% endif %} - model_config = ConfigDict(extra="ignore", populate_by_name=True) + impl Imports { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s).unwrap(); + writeln!(s, "# Standard library imports").unwrap(); + if self.has_datetime { + write!(s, "from datetime import datetime").unwrap(); + if self.has_date { + write!(s, ", date").unwrap(); + } + if self.has_timedelta { + write!(s, ", timedelta").unwrap(); + } + writeln!(s).unwrap(); + } else if self.has_date { + write!(s, "from datetime import date").unwrap(); + if self.has_timedelta { + write!(s, ", timedelta").unwrap(); + } + writeln!(s).unwrap(); + } else if self.has_timedelta { + writeln!(s, "from datetime import timedelta").unwrap(); + } + if self.has_enums { + writeln!(s, "from enum import Enum").unwrap(); + } + write!( + s, + "from typing import Any, Optional, TypeVar, Generic, Union" + ) + .unwrap(); + if self.has_annotated { + write!(s, ", Annotated").unwrap(); + } + if self.has_literal { + write!(s, ", Literal").unwrap(); + } + writeln!(s).unwrap(); + if self.has_uuid { + writeln!(s, "from uuid import UUID").unwrap(); + } + if self.has_warnings { + writeln!(s, "import warnings").unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, "# Third-party imports").unwrap(); + write!(s, "from pydantic import BaseModel, ConfigDict, Field").unwrap(); + if self.has_externally_tagged_enums { + write!( + s, + ", RootModel, model_validator, model_serializer, PrivateAttr" + ) + .unwrap(); + } + writeln!(s).unwrap(); + writeln!(s).unwrap(); + writeln!(s, "# Runtime imports").unwrap(); + if self.has_async { + if self.has_sync { + writeln!( + s, + "from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse" + ) + .unwrap(); + } else { + writeln!( + s, + "from reflectapi_runtime import AsyncClientBase, ApiResponse" + ) + .unwrap(); + } + } else if self.has_sync { + writeln!(s, "from reflectapi_runtime import ClientBase, ApiResponse").unwrap(); + } + if self.has_reflectapi_option { + writeln!(s, "from reflectapi_runtime import ReflectapiOption").unwrap(); + } + if self.has_reflectapi_empty { + writeln!(s, "from reflectapi_runtime import ReflectapiEmpty").unwrap(); + } + if self.has_reflectapi_infallible { + writeln!(s, "from reflectapi_runtime import ReflectapiInfallible").unwrap(); + } + if self.has_testing { + writeln!( + s, + "from reflectapi_runtime.testing import MockClient, create_api_response" + ) + .unwrap(); + } + writeln!(s).unwrap(); + for type_var in &self.global_type_vars { + writeln!(s, "{} = TypeVar('{}')", type_var, type_var).unwrap(); + } + writeln!(s).unwrap(); + s + } + } -{% for field in fields %} {{ field.name }}: {{ field.type_annotation }}{% if field.alias.is_some() %} = Field{% if field.default_value.is_some() %}(default={{ field.default_value.as_ref().unwrap() }}, serialization_alias='{{ field.alias.as_deref().unwrap() }}', validation_alias='{{ field.alias.as_deref().unwrap() }}'){% else if field.optional %}(default=None, serialization_alias='{{ field.alias.as_deref().unwrap() }}', validation_alias='{{ field.alias.as_deref().unwrap() }}'){% else %}(serialization_alias='{{ field.alias.as_deref().unwrap() }}', validation_alias='{{ field.alias.as_deref().unwrap() }}'){% endif %}{% else %}{% if field.optional %} = None{% else if field.default_value.is_some() %} = {{ field.default_value.as_ref().unwrap() }}{% endif %}{% endif %} -{% endfor %} -"#, - ext = "txt" - )] pub struct DataClass { pub name: String, pub description: Option, @@ -4600,40 +4624,101 @@ from pydantic import BaseModel, ConfigDict, Field{% if has_externally_tagged_enu pub generic_params: Vec, } - #[derive(Template)] - #[template( - source = r#"class {{ name }}(str, Enum): -{% if description.is_some() && !description.as_deref().unwrap().is_empty() %} """{{ description.as_deref().unwrap() }}""" -{% else %} """Generated enum.""" -{% endif %} + impl DataClass { + pub fn render(&self) -> String { + let mut s = String::new(); + if self.is_generic { + let params = self.generic_params.join(", "); + writeln!(s, "class {}(BaseModel, Generic[{}]):", self.name, params).unwrap(); + } else { + writeln!(s, "class {}(BaseModel):", self.name).unwrap(); + } + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } else { + writeln!(s, " \"\"\"Generated data model.\"\"\"").unwrap(); + } + } else { + writeln!(s, " \"\"\"Generated data model.\"\"\"").unwrap(); + } + writeln!(s).unwrap(); + writeln!( + s, + " model_config = ConfigDict(extra=\"ignore\", populate_by_name=True)" + ) + .unwrap(); + writeln!(s).unwrap(); + for field in &self.fields { + write!(s, " {}: {}", field.name, field.type_annotation).unwrap(); + if let Some(alias) = &field.alias { + write!(s, " = Field").unwrap(); + if let Some(default) = &field.default_value { + write!( + s, + "(default={}, serialization_alias='{}', validation_alias='{}')", + default, alias, alias + ) + .unwrap(); + } else if field.optional { + write!( + s, + "(default=None, serialization_alias='{}', validation_alias='{}')", + alias, alias + ) + .unwrap(); + } else { + write!( + s, + "(serialization_alias='{}', validation_alias='{}')", + alias, alias + ) + .unwrap(); + } + } else if field.optional { + write!(s, " = None").unwrap(); + } else if let Some(default) = &field.default_value { + write!(s, " = {}", default).unwrap(); + } + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + s + } + } -{% if variants.is_empty() %} pass -{% else %}{% for variant in variants %} {{ variant.name }} = "{{ variant.value }}" -{% endfor %}{% endif %} -"#, - ext = "txt" - )] pub struct EnumClass { pub name: String, pub description: Option, pub variants: Vec, } - #[derive(Template)] - #[template( - source = r#"{% if is_int_enum %}from enum import IntEnum{% else %}from enum import Enum{% endif %} - -class {{ name }}({% if is_int_enum %}IntEnum{% else %}Enum{% endif %}): -{% if description.is_some() %} """{{ description.as_deref().unwrap() }}""" + impl EnumClass { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "class {}(str, Enum):", self.name).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } else { + writeln!(s, " \"\"\"Generated enum.\"\"\"").unwrap(); + } + } else { + writeln!(s, " \"\"\"Generated enum.\"\"\"").unwrap(); + } + writeln!(s).unwrap(); + if self.variants.is_empty() { + writeln!(s, " pass").unwrap(); + } else { + for variant in &self.variants { + writeln!(s, " {} = \"{}\"", variant.name, variant.value).unwrap(); + } + } + writeln!(s).unwrap(); + s + } + } -{% endif %}{% for variant in variants %} - {{ variant.name }} = {{ variant.value }} -{% if variant.description.is_some() %} """{{ variant.description.as_deref().unwrap() }}""" -{% endif %} -{% endfor %} -"#, - ext = "txt" - )] pub struct PrimitiveEnumClass { pub name: String, pub description: Option, @@ -4641,32 +4726,34 @@ class {{ name }}({% if is_int_enum %}IntEnum{% else %}Enum{% endif %}): pub is_int_enum: bool, } - #[derive(Template)] - #[template( - source = r#"{% if is_generic %} -class {{ name }}(Generic[{% for param in generic_params %}{{ param }}{% if !loop.last %}, {% endif %}{% endfor %}]): - """{{ description.as_deref().unwrap_or("Generated discriminated union type.") }}""" - - @classmethod - def __class_getitem__(cls, params): - """Enable subscripting for generic discriminated union.""" - if not isinstance(params, tuple): - params = (params,) - if len(params) != {{ generic_params.len() }}: - raise TypeError(f"Expected {{ generic_params.len() }} type parameters, got {len(params)}") - - return Annotated[ - Union[{% for variant in variants %}{{ variant.base_name }}[{% for param in generic_params %}params[{{ loop.index0 }}]{% if !loop.last %}, {% endif %}{% endfor %}]{% if !loop.last %}, {% endif %}{% endfor %}], - Field(discriminator='{{ discriminator_field }}') - ] -{% else %} -class {{ name }}(RootModel): - root: Annotated[Union[{% for variant in variants %}{{ variant.type_annotation }}{% if !loop.last %}, {% endif %}{% endfor %}], Field(discriminator='{{ discriminator_field }}')] -{% endif %} -{% if description.is_some() && !description.as_deref().unwrap_or("").is_empty() && !is_generic %}"""{{ description.as_deref().unwrap() }}"""{% endif %} -"#, - ext = "txt" - )] + impl PrimitiveEnumClass { + pub fn render(&self) -> String { + let mut s = String::new(); + if self.is_int_enum { + writeln!(s, "from enum import IntEnum").unwrap(); + } else { + writeln!(s, "from enum import Enum").unwrap(); + } + writeln!(s).unwrap(); + let base = if self.is_int_enum { "IntEnum" } else { "Enum" }; + writeln!(s, "class {}({}):", self.name, base).unwrap(); + if let Some(desc) = &self.description { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s).unwrap(); + } + for variant in &self.variants { + writeln!(s).unwrap(); + writeln!(s, " {} = {}", variant.name, variant.value).unwrap(); + if let Some(desc) = &variant.description { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + s + } + } + pub struct UnionClass { pub name: String, pub description: Option, @@ -4676,333 +4763,115 @@ class {{ name }}(RootModel): pub generic_params: Vec, } - #[derive(Template)] - #[template( - source = r#"{{ name }} = Union[{% for variant in variants %}{{ variant.type_annotation }}{% if !loop.last %}, {% endif %}{% endfor %}] -{% if description.is_some() && !description.as_deref().unwrap_or("").is_empty() %}"""{{ description.as_deref().unwrap() }}"""{% endif %} -"#, - ext = "txt" - )] + impl UnionClass { + pub fn render(&self) -> String { + let mut s = String::new(); + if self.is_generic { + let params = self.generic_params.join(", "); + writeln!(s).unwrap(); + writeln!(s, "class {}(Generic[{}]):", self.name, params).unwrap(); + let desc = self + .description + .as_deref() + .unwrap_or("Generated discriminated union type."); + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " @classmethod").unwrap(); + writeln!(s, " def __class_getitem__(cls, params):").unwrap(); + writeln!( + s, + " \"\"\"Enable subscripting for generic discriminated union.\"\"\"" + ) + .unwrap(); + writeln!(s, " if not isinstance(params, tuple):").unwrap(); + writeln!(s, " params = (params,)").unwrap(); + writeln!( + s, + " if len(params) != {}:", + self.generic_params.len() + ) + .unwrap(); + writeln!( + s, + " raise TypeError(f\"Expected {} type parameters, got {{len(params)}}\")", + self.generic_params.len() + ) + .unwrap(); + writeln!(s).unwrap(); + // Build the Union expression + let variant_exprs: Vec = self + .variants + .iter() + .map(|v| { + let param_exprs: Vec = (0..self.generic_params.len()) + .map(|i| format!("params[{}]", i)) + .collect(); + format!("{}[{}]", v.base_name, param_exprs.join(", ")) + }) + .collect(); + writeln!(s, " return Annotated[").unwrap(); + writeln!(s, " Union[{}],", variant_exprs.join(", ")).unwrap(); + writeln!( + s, + " Field(discriminator='{}')", + self.discriminator_field + ) + .unwrap(); + writeln!(s, " ]").unwrap(); + } else { + writeln!(s).unwrap(); + writeln!(s, "class {}(RootModel):", self.name).unwrap(); + let type_annotations: Vec<&str> = self + .variants + .iter() + .map(|v| v.type_annotation.as_str()) + .collect(); + writeln!( + s, + " root: Annotated[Union[{}], Field(discriminator='{}')]", + type_annotations.join(", "), + self.discriminator_field + ) + .unwrap(); + } + writeln!(s).unwrap(); + if !self.is_generic { + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + } + } + } + writeln!(s).unwrap(); + s + } + } + pub struct UntaggedUnionClass { pub name: String, pub description: Option, pub variants: Vec, } - #[derive(Template)] - #[template( - source = r#"{% if generate_async %} -{% for group in function_groups %} -class Async{{ group.class_name }}: - """Async client for {{ group.name }} operations.""" - - def __init__(self, client: AsyncClientBase) -> None: - self._client = client -{% for function in group.functions %} - - async def {{ function.name }}( - self, -{%- for param in function.path_params %} - {{ param.name }}: {{ param.type_annotation }}, -{%- endfor %} -{%- if function.has_body %} - data: Optional[{{ function.input_type }}] = None, -{%- endif %} -{%- if function.headers_type.is_some() %} - headers: Optional[{{ function.headers_type.as_deref().unwrap() }}] = None, -{%- endif %} - ) -> ApiResponse[{{ function.output_type }}]: - """{{ function.description.as_deref().unwrap_or("") }}{% if function.has_body || !function.path_params.is_empty() %} - - Args:{% if function.has_body %} - data: Request data for the {{ function.name }} operation.{% endif %}{% if !function.path_params.is_empty() %} -{% for param in function.path_params %} {{ param.name }}: {{ param.description.as_deref().unwrap_or("Path parameter") }} -{% endfor %}{% endif %}{% endif %} - - Returns: - ApiResponse[{{ function.output_type }}]: Response containing {{ function.output_type }} data{% if function.deprecation_note.is_some() %} - - .. deprecated:: - {{ function.deprecation_note.as_deref().unwrap() }}{% endif %} - """ - {% if function.deprecation_note.is_some() %} - warnings.warn( - "{% if function.original_name.is_some() %}{{ function.original_name.as_deref().unwrap() }}{% else %}{{ function.name }}{% endif %} is deprecated{% if !function.deprecation_note.as_deref().unwrap().is_empty() %}: {{ function.deprecation_note.as_deref().unwrap() }}{% endif %}", - DeprecationWarning, - stacklevel=2, - ) - - {% endif -%} - path = "{{ function.path }}" -{% if !function.path_params.is_empty() %} - # Format path parameters using safer string formatting - path_params = { -{% for param in function.path_params %} - "{{ param.raw_name }}": str({{ param.name }}), -{% endfor %} - } - for param_name, param_value in path_params.items(): - path = path.replace("{" + param_name + "}", param_value) -{% endif %} - params: dict[str, Any] = {} - return await self._client._make_request( - "{{ function.method }}", - path, - params=params if params else None, -{% if function.has_body -%} -{% if function.is_input_primitive %} json_data=data, -{% else %} json_model=data, -{% endif -%} -{% endif -%} -{% if function.headers_type.is_some() %} headers_model=headers, -{% endif -%} -{% if function.output_type == "Any" %} response_model=None, -{% else %} response_model={{ function.output_type }}, -{% endif -%} - ) - -{% endfor %} - -{% endfor %} -class {{ async_class_name }}(AsyncClientBase): - """Async client for the API.""" - - def __init__( - self, - base_url: str{% if base_url.is_some() %} = "{{ base_url.as_ref().unwrap() }}"{% endif %}, - **kwargs: Any, - ) -> None: - super().__init__(base_url, **kwargs) -{% for group in function_groups %} - self.{{ group.name }} = Async{{ group.class_name }}(self) -{% endfor %} - -{% for function in top_level_functions %} - async def {{ function.name }}( - self, -{%- for param in function.path_params %} - {{ param.name }}: {{ param.type_annotation }}, -{%- endfor %} -{%- if function.has_body %} - data: Optional[{{ function.input_type }}] = None, -{%- endif %} -{%- if function.headers_type.is_some() %} - headers: Optional[{{ function.headers_type.as_deref().unwrap() }}] = None, -{%- endif %} - ) -> ApiResponse[{{ function.output_type }}]: - """{{ function.description.as_deref().unwrap_or("") }}{% if function.has_body %} - - Args: - data: Request data for the {{ function.name }} operation.{% endif %}{% if !function.path_params.is_empty() %} -{% for param in function.path_params %} {{ param.name }}: {{ param.description.as_deref().unwrap_or("Path parameter") }} -{% endfor %}{% endif %} - - Returns: - ApiResponse[{{ function.output_type }}]: Response containing {{ function.output_type }} data{% if function.deprecation_note.is_some() %} - - .. deprecated:: - {{ function.deprecation_note.as_deref().unwrap() }}{% endif %} - """ - {% if function.deprecation_note.is_some() %} - warnings.warn( - "{{ function.name }} is deprecated{% if !function.deprecation_note.as_deref().unwrap().is_empty() %}: {{ function.deprecation_note.as_deref().unwrap() }}{% endif %}", - DeprecationWarning, - stacklevel=2, - ) - - {% endif -%} - path = "{{ function.path }}" -{% if !function.path_params.is_empty() %} - # Format path parameters using safer string formatting - path_params = { -{% for param in function.path_params %} - "{{ param.name }}": str({{ param.name }}), -{% endfor %} - } - for param_name, param_value in path_params.items(): - path = path.replace("{" + param_name + "}", param_value) -{% endif %} - params: dict[str, Any] = {} - return await self._make_request( - "{{ function.method }}", - path, - params=params if params else None, -{% if function.has_body -%} -{% if function.is_input_primitive %} json_data=data, -{% else %} json_model=data, -{% endif -%} -{% endif -%} -{% if function.headers_type.is_some() %} headers_model=headers, -{% endif -%} -{% if function.output_type == "Any" %} response_model=None, -{% else %} response_model={{ function.output_type }}, -{% endif -%} - ) - -{% endfor %} - -{% endif %} - -{% if generate_sync %} -{% for group in function_groups %} -class {{ group.class_name }}: - """Synchronous client for {{ group.name }} operations.""" - - def __init__(self, client: ClientBase) -> None: - self._client = client -{% for function in group.functions %} - - def {{ function.name }}( - self, -{%- for param in function.path_params %} - {{ param.name }}: {{ param.type_annotation }}, -{%- endfor %} -{%- if function.has_body %} - data: Optional[{{ function.input_type }}] = None, -{%- endif %} -{%- if function.headers_type.is_some() %} - headers: Optional[{{ function.headers_type.as_deref().unwrap() }}] = None, -{%- endif %} - ) -> ApiResponse[{{ function.output_type }}]: - """{{ function.description.as_deref().unwrap_or("") }}{% if function.has_body || !function.path_params.is_empty() %} - - Args:{% if function.has_body %} - data: Request data for the {{ function.name }} operation.{% endif %}{% if !function.path_params.is_empty() %} -{% for param in function.path_params %} {{ param.name }}: {{ param.description.as_deref().unwrap_or("Path parameter") }} -{% endfor %}{% endif %}{% endif %} - - Returns: - ApiResponse[{{ function.output_type }}]: Response containing {{ function.output_type }} data{% if function.deprecation_note.is_some() %} - - .. deprecated:: - {{ function.deprecation_note.as_deref().unwrap() }}{% endif %} - """ - {% if function.deprecation_note.is_some() %} - warnings.warn( - "{% if function.original_name.is_some() %}{{ function.original_name.as_deref().unwrap() }}{% else %}{{ function.name }}{% endif %} is deprecated{% if !function.deprecation_note.as_deref().unwrap().is_empty() %}: {{ function.deprecation_note.as_deref().unwrap() }}{% endif %}", - DeprecationWarning, - stacklevel=2, - ) - - {% endif -%} - path = "{{ function.path }}" -{% if !function.path_params.is_empty() %} - # Format path parameters using safer string formatting - path_params = { -{% for param in function.path_params %} - "{{ param.raw_name }}": str({{ param.name }}), -{% endfor %} - } - for param_name, param_value in path_params.items(): - path = path.replace("{" + param_name + "}", param_value) -{% endif %} - params: dict[str, Any] = {} - return self._client._make_request( - "{{ function.method }}", - path, - params=params if params else None, -{% if function.has_body -%} -{% if function.is_input_primitive %} json_data=data, -{% else %} json_model=data, -{% endif -%} -{% endif -%} -{% if function.headers_type.is_some() %} headers_model=headers, -{% endif -%} -{% if function.output_type == "Any" %} response_model=None, -{% else %} response_model={{ function.output_type }}, -{% endif -%} - ) - -{% endfor %} - -{% endfor %} -class {{ class_name }}(ClientBase): - """Synchronous client for the API.""" - - def __init__( - self, - base_url: str{% if base_url.is_some() %} = "{{ base_url.as_ref().unwrap() }}"{% endif %}, - **kwargs: Any, - ) -> None: - super().__init__(base_url, **kwargs) -{% for group in function_groups %} - self.{{ group.name }} = {{ group.class_name }}(self) -{% endfor %} - -{% for function in top_level_functions %} - def {{ function.name }}( - self, -{%- for param in function.path_params %} - {{ param.name }}: {{ param.type_annotation }}, -{%- endfor %} -{%- if function.has_body %} - data: Optional[{{ function.input_type }}] = None, -{%- endif %} -{%- if function.headers_type.is_some() %} - headers: Optional[{{ function.headers_type.as_deref().unwrap() }}] = None, -{%- endif %} - ) -> ApiResponse[{{ function.output_type }}]: - """{{ function.description.as_deref().unwrap_or("") }}{% if function.has_body %} - - Args: - data: Request data for the {{ function.name }} operation.{% endif %}{% if !function.path_params.is_empty() %} -{% for param in function.path_params %} {{ param.name }}: {{ param.description.as_deref().unwrap_or("Path parameter") }} -{% endfor %}{% endif %} - - Returns: - ApiResponse[{{ function.output_type }}]: Response containing {{ function.output_type }} data{% if function.deprecation_note.is_some() %} - - .. deprecated:: - {{ function.deprecation_note.as_deref().unwrap() }}{% endif %} - """ - {% if function.deprecation_note.is_some() %} - warnings.warn( - "{{ function.name }} is deprecated{% if !function.deprecation_note.as_deref().unwrap().is_empty() %}: {{ function.deprecation_note.as_deref().unwrap() }}{% endif %}", - DeprecationWarning, - stacklevel=2, - ) - {% endif %} - path = "{{ function.path }}" -{% if !function.path_params.is_empty() %} - # Format path parameters using safer string formatting - path_params = { -{% for param in function.path_params %} - "{{ param.name }}": str({{ param.name }}), -{% endfor %} - } - for param_name, param_value in path_params.items(): - path = path.replace("{" + param_name + "}", param_value) -{% endif %} - - params: dict[str, Any] = {} - - return await self._make_request( - "{{ function.method }}", - path, - params=params if params else None, -{% if function.has_body %} -{% if function.is_input_primitive %} - json_data=data, -{% else %} - json_model=data, -{% endif %} -{% endif %} -{% if function.headers_type.is_some() %} - headers_model=headers, -{% endif %} -{% if function.output_type == "Any" %} - response_model=None, -{% else %} - response_model={{ function.output_type }}, -{% endif %} - ) - -{% endfor %} + impl UntaggedUnionClass { + pub fn render(&self) -> String { + let mut s = String::new(); + let type_annotations: Vec<&str> = self + .variants + .iter() + .map(|v| v.type_annotation.as_str()) + .collect(); + writeln!(s, "{} = Union[{}]", self.name, type_annotations.join(", ")).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + } + } + writeln!(s).unwrap(); + s + } + } -{% endif %} -"#, - ext = "txt" - )] pub struct ClientClass { pub class_name: String, pub async_class_name: String, @@ -5013,27 +4882,314 @@ class {{ class_name }}(ClientBase): pub base_url: Option, } - #[derive(Template)] - #[template( - source = r#"# Testing utilities + impl ClientClass { + pub fn render(&self) -> String { + let mut s = String::new(); + + if self.generate_async { + // Async group classes + for group in &self.function_groups { + writeln!(s).unwrap(); + writeln!(s, "class Async{}:", group.class_name).unwrap(); + writeln!( + s, + " \"\"\"Async client for {} operations.\"\"\"", + group.name + ) + .unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " def __init__(self, client: AsyncClientBase) -> None:" + ) + .unwrap(); + writeln!(s, " self._client = client").unwrap(); + + for function in &group.functions { + Self::write_function(&mut s, function, true, true, true); + } + writeln!(s).unwrap(); + } + + // Async client class + writeln!(s).unwrap(); + writeln!(s, "class {}(AsyncClientBase):", self.async_class_name).unwrap(); + writeln!(s, " \"\"\"Async client for the API.\"\"\"").unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def __init__(").unwrap(); + writeln!(s, " self,").unwrap(); + if let Some(base_url) = &self.base_url { + writeln!(s, " base_url: str = \"{}\",", base_url).unwrap(); + } else { + writeln!(s, " base_url: str,").unwrap(); + } + writeln!(s, " **kwargs: Any,").unwrap(); + writeln!(s, " ) -> None:").unwrap(); + writeln!(s, " super().__init__(base_url, **kwargs)").unwrap(); + writeln!(s).unwrap(); + for group in &self.function_groups { + writeln!(s).unwrap(); + writeln!( + s, + " self.{} = Async{}(self)", + group.name, group.class_name + ) + .unwrap(); + } + writeln!(s).unwrap(); + + for function in &self.top_level_functions { + Self::write_function(&mut s, function, true, false, true); + } + writeln!(s).unwrap(); + } -{% for type_name in types %} -def create_{{ type_name.to_lowercase() }}_response(value: {{ type_name }}) -> ApiResponse[{{ type_name }}]: - """Create a mock ApiResponse for {{ type_name }}.""" - return create_api_response(value) + writeln!(s).unwrap(); + + if self.generate_sync { + // Sync group classes + for group in &self.function_groups { + writeln!(s).unwrap(); + writeln!(s, "class {}:", group.class_name).unwrap(); + writeln!( + s, + " \"\"\"Synchronous client for {} operations.\"\"\"", + group.name + ) + .unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def __init__(self, client: ClientBase) -> None:").unwrap(); + writeln!(s, " self._client = client").unwrap(); -{% endfor %} + for function in &group.functions { + Self::write_function(&mut s, function, false, true, true); + } + writeln!(s).unwrap(); + } + + // Sync client class + writeln!(s).unwrap(); + writeln!(s, "class {}(ClientBase):", self.class_name).unwrap(); + writeln!(s, " \"\"\"Synchronous client for the API.\"\"\"").unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def __init__(").unwrap(); + writeln!(s, " self,").unwrap(); + if let Some(base_url) = &self.base_url { + writeln!(s, " base_url: str = \"{}\",", base_url).unwrap(); + } else { + writeln!(s, " base_url: str,").unwrap(); + } + writeln!(s, " **kwargs: Any,").unwrap(); + writeln!(s, " ) -> None:").unwrap(); + writeln!(s, " super().__init__(base_url, **kwargs)").unwrap(); + writeln!(s).unwrap(); + for group in &self.function_groups { + writeln!(s).unwrap(); + writeln!( + s, + " self.{} = {}(self)", + group.name, group.class_name + ) + .unwrap(); + } + writeln!(s).unwrap(); + + for function in &self.top_level_functions { + Self::write_function(&mut s, function, false, false, false); + } + writeln!(s).unwrap(); + } + + writeln!(s).unwrap(); + s + } + + fn write_function( + s: &mut String, + function: &Function, + is_async: bool, + is_group: bool, + use_raw_name_for_path_params: bool, + ) { + writeln!(s).unwrap(); + // Method signature + if is_async { + writeln!(s, " async def {}(", function.name).unwrap(); + } else { + writeln!(s, " def {}(", function.name).unwrap(); + } + writeln!(s, " self,").unwrap(); + for param in &function.path_params { + writeln!(s, " {}: {},", param.name, param.type_annotation).unwrap(); + } + if function.has_body { + writeln!(s, " data: Optional[{}] = None,", function.input_type).unwrap(); + } + if let Some(headers_type) = &function.headers_type { + writeln!(s, " headers: Optional[{}] = None,", headers_type).unwrap(); + } + writeln!(s, " ) -> ApiResponse[{}]:", function.output_type).unwrap(); + + // Docstring + let desc = function.description.as_deref().unwrap_or(""); + write!(s, " \"\"\"{}", desc).unwrap(); + if function.has_body || !function.path_params.is_empty() { + writeln!(s).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " Args:").unwrap(); + if function.has_body { + writeln!( + s, + " data: Request data for the {} operation.", + function.name + ) + .unwrap(); + } + for param in &function.path_params { + let param_desc = param.description.as_deref().unwrap_or("Path parameter"); + writeln!(s, " {}: {}", param.name, param_desc).unwrap(); + } + writeln!(s).unwrap(); + } else { + writeln!(s).unwrap(); + writeln!(s).unwrap(); + } + writeln!(s, " Returns:").unwrap(); + writeln!( + s, + " ApiResponse[{}]: Response containing {} data", + function.output_type, function.output_type + ) + .unwrap(); + if let Some(dep_note) = &function.deprecation_note { + writeln!(s).unwrap(); + writeln!(s, " .. deprecated::").unwrap(); + writeln!(s, " {}", dep_note).unwrap(); + } + writeln!(s, " \"\"\"").unwrap(); + + // Deprecation warning + if let Some(dep_note) = &function.deprecation_note { + writeln!(s).unwrap(); + let warn_name = if is_group { + function.original_name.as_deref().unwrap_or(&function.name) + } else { + &function.name + }; + let warn_msg = if dep_note.is_empty() { + format!("{} is deprecated", warn_name) + } else { + format!("{} is deprecated: {}", warn_name, dep_note) + }; + writeln!(s, " warnings.warn(").unwrap(); + writeln!(s, " \"{}\",", warn_msg).unwrap(); + writeln!(s, " DeprecationWarning,").unwrap(); + writeln!(s, " stacklevel=2,").unwrap(); + writeln!(s, " )").unwrap(); + writeln!(s).unwrap(); + } + + // Path + writeln!(s, " path = \"{}\"", function.path).unwrap(); + + // Path parameters + if !function.path_params.is_empty() { + writeln!( + s, + " # Format path parameters using safer string formatting" + ) + .unwrap(); + writeln!(s, " path_params = {{").unwrap(); + for param in &function.path_params { + let key = if use_raw_name_for_path_params { + ¶m.raw_name + } else { + ¶m.name + }; + writeln!(s, " \"{}\": str({}),", key, param.name).unwrap(); + } + writeln!(s, " }}").unwrap(); + writeln!( + s, + " for param_name, param_value in path_params.items():" + ) + .unwrap(); + writeln!( + s, + " path = path.replace(\"{{\" + param_name + \"}}\", param_value)" + ) + .unwrap(); + } + writeln!(s).unwrap(); + + // Request call + writeln!(s, " params: dict[str, Any] = {{}}").unwrap(); + + let client_prefix = if is_group { "self._client." } else { "self." }; + if is_async { + writeln!(s, " return await {}_make_request(", client_prefix).unwrap(); + } else { + writeln!(s, " return {}_make_request(", client_prefix).unwrap(); + } + writeln!(s, " \"{}\",", function.method).unwrap(); + writeln!(s, " path,").unwrap(); + writeln!(s, " params=params if params else None,").unwrap(); + if function.has_body { + if function.is_input_primitive { + writeln!(s, " json_data=data,").unwrap(); + } else { + writeln!(s, " json_model=data,").unwrap(); + } + } + if function.headers_type.is_some() { + writeln!(s, " headers_model=headers,").unwrap(); + } + if function.output_type == "Any" { + writeln!(s, " response_model=None,").unwrap(); + } else { + writeln!(s, " response_model={},", function.output_type).unwrap(); + } + writeln!(s, " )").unwrap(); + writeln!(s).unwrap(); + } + } -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() -"#, - ext = "txt" - )] pub struct TestingModule { pub types: Vec, } + impl TestingModule { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "# Testing utilities").unwrap(); + writeln!(s).unwrap(); + for type_name in &self.types { + writeln!(s).unwrap(); + writeln!( + s, + "def create_{}_response(value: {}) -> ApiResponse[{}]:", + type_name.to_lowercase(), + type_name, + type_name + ) + .unwrap(); + writeln!( + s, + " \"\"\"Create a mock ApiResponse for {}.\"\"\"", + type_name + ) + .unwrap(); + writeln!(s, " return create_api_response(value)").unwrap(); + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, "def create_mock_client() -> MockClient:").unwrap(); + writeln!(s, " \"\"\"Create a mock client for testing.\"\"\"").unwrap(); + writeln!(s, " return MockClient()").unwrap(); + s + } + } + pub struct Field { pub name: String, pub type_annotation: String, @@ -5096,55 +5252,55 @@ def create_mock_client() -> MockClient: } // Templates for externally tagged enum variants - #[derive(Template)] - #[template( - source = r#"class {{ name }}(BaseModel): -{% if description.is_some() && !description.as_deref().unwrap().is_empty() %} """{{ description.as_deref().unwrap() }}""" -{% else %} """Unit variant for externally tagged enum.""" -{% endif %} - model_config = ConfigDict(extra="ignore") - - def model_dump(self, **kwargs): - """Serialize as just the variant name string for unit variants.""" - return "{{ variant_name }}" - - def model_dump_json(self, **kwargs): - """Serialize as JSON string for unit variants.""" - import json - return json.dumps(self.model_dump(**kwargs)) -"#, - ext = "txt" - )] pub struct UnitVariantClass { pub name: String, pub variant_name: String, pub description: Option, } - #[derive(Template)] - #[template( - source = r#"class {{ name }}(BaseModel): -{% if description.is_some() && !description.as_deref().unwrap().is_empty() %} """{{ description.as_deref().unwrap() }}""" -{% else %} """Tuple variant for externally tagged enum.""" -{% endif %} - - model_config = ConfigDict(extra="ignore") - -{% for field in fields %} {{ field.name }}: {{ field.type_annotation }}{% if field.default_value.is_some() %} = {{ field.default_value.as_ref().unwrap() }}{% else %}{% if field.optional %} = None{% endif %}{% endif %} -{% endfor %} - - def model_dump(self, **kwargs): - """Serialize as externally tagged tuple variant.""" - fields = [{% for field in fields %}self.{{ field.name }}{% if !loop.last %}, {% endif %}{% endfor %}] - return {"{{ variant_name }}": fields} + impl UnitVariantClass { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "class {}(BaseModel):", self.name).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } else { + writeln!( + s, + " \"\"\"Unit variant for externally tagged enum.\"\"\"" + ) + .unwrap(); + } + } else { + writeln!( + s, + " \"\"\"Unit variant for externally tagged enum.\"\"\"" + ) + .unwrap(); + } + writeln!(s, " model_config = ConfigDict(extra=\"ignore\")").unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def model_dump(self, **kwargs):").unwrap(); + writeln!( + s, + " \"\"\"Serialize as just the variant name string for unit variants.\"\"\"" + ) + .unwrap(); + writeln!(s, " return \"{}\"", self.variant_name).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def model_dump_json(self, **kwargs):").unwrap(); + writeln!( + s, + " \"\"\"Serialize as JSON string for unit variants.\"\"\"" + ) + .unwrap(); + writeln!(s, " import json").unwrap(); + writeln!(s, " return json.dumps(self.model_dump(**kwargs))").unwrap(); + s + } + } - def model_dump_json(self, **kwargs): - """Serialize as JSON for externally tagged tuple variant.""" - import json - return json.dumps(self.model_dump(**kwargs)) -"#, - ext = "txt" - )] pub struct TupleVariantClass { pub name: String, pub variant_name: String, @@ -5152,32 +5308,66 @@ def create_mock_client() -> MockClient: pub description: Option, } - #[derive(Template)] - #[template( - source = r#"class {{ name }}(BaseModel): -{% if description.is_some() && !description.as_deref().unwrap().is_empty() %} """{{ description.as_deref().unwrap() }}""" -{% else %} """Struct variant for externally tagged enum.""" -{% endif %} - model_config = ConfigDict(extra="ignore") - -{% for field in fields %} {{ field.name }}: {{ field.type_annotation }}{% if field.default_value.is_some() %} = {{ field.default_value.as_ref().unwrap() }}{% else %}{% if field.optional %} = None{% endif %}{% endif %} -{% endfor %} - - def model_dump(self, **kwargs): - """Serialize as externally tagged struct variant.""" - fields = {} -{% for field in fields %} if hasattr(self, '{{ field.name }}') and self.{{ field.name }} is not None: - fields['{{ field.name }}'] = self.{{ field.name }} -{% endfor %} - return {"{{ variant_name }}": fields} - - def model_dump_json(self, **kwargs): - """Serialize as JSON for externally tagged struct variant.""" - import json - return json.dumps(self.model_dump(**kwargs)) -"#, - ext = "txt" - )] + impl TupleVariantClass { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "class {}(BaseModel):", self.name).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } else { + writeln!( + s, + " \"\"\"Tuple variant for externally tagged enum.\"\"\"" + ) + .unwrap(); + } + } else { + writeln!( + s, + " \"\"\"Tuple variant for externally tagged enum.\"\"\"" + ) + .unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, " model_config = ConfigDict(extra=\"ignore\")").unwrap(); + writeln!(s).unwrap(); + for field in &self.fields { + write!(s, " {}: {}", field.name, field.type_annotation).unwrap(); + if let Some(default) = &field.default_value { + write!(s, " = {}", default).unwrap(); + } else if field.optional { + write!(s, " = None").unwrap(); + } + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, " def model_dump(self, **kwargs):").unwrap(); + writeln!( + s, + " \"\"\"Serialize as externally tagged tuple variant.\"\"\"" + ) + .unwrap(); + let field_refs: Vec = self + .fields + .iter() + .map(|f| format!("self.{}", f.name)) + .collect(); + writeln!(s, " fields = [{}]", field_refs.join(", ")).unwrap(); + writeln!(s, " return {{\"{}\": fields}}", self.variant_name).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def model_dump_json(self, **kwargs):").unwrap(); + writeln!( + s, + " \"\"\"Serialize as JSON for externally tagged tuple variant.\"\"\"" + ) + .unwrap(); + writeln!(s, " import json").unwrap(); + writeln!(s, " return json.dumps(self.model_dump(**kwargs))").unwrap(); + s + } + } + pub struct StructVariantClass { pub name: String, pub variant_name: String, @@ -5185,15 +5375,74 @@ def create_mock_client() -> MockClient: pub description: Option, } - #[derive(Template)] - #[template( - source = r#"{% for variant_def in variant_definitions %}{{ variant_def }} + impl StructVariantClass { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "class {}(BaseModel):", self.name).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } else { + writeln!( + s, + " \"\"\"Struct variant for externally tagged enum.\"\"\"" + ) + .unwrap(); + } + } else { + writeln!( + s, + " \"\"\"Struct variant for externally tagged enum.\"\"\"" + ) + .unwrap(); + } + writeln!(s, " model_config = ConfigDict(extra=\"ignore\")").unwrap(); + writeln!(s).unwrap(); + for field in &self.fields { + write!(s, " {}: {}", field.name, field.type_annotation).unwrap(); + if let Some(default) = &field.default_value { + write!(s, " = {}", default).unwrap(); + } else if field.optional { + write!(s, " = None").unwrap(); + } + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, " def model_dump(self, **kwargs):").unwrap(); + writeln!( + s, + " \"\"\"Serialize as externally tagged struct variant.\"\"\"" + ) + .unwrap(); + writeln!(s, " fields = {{}}").unwrap(); + for field in &self.fields { + writeln!( + s, + " if hasattr(self, '{}') and self.{} is not None:", + field.name, field.name + ) + .unwrap(); + writeln!( + s, + " fields['{}'] = self.{}", + field.name, field.name + ) + .unwrap(); + } + writeln!(s, " return {{\"{}\": fields}}", self.variant_name).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def model_dump_json(self, **kwargs):").unwrap(); + writeln!( + s, + " \"\"\"Serialize as JSON for externally tagged struct variant.\"\"\"" + ) + .unwrap(); + writeln!(s, " import json").unwrap(); + writeln!(s, " return json.dumps(self.model_dump(**kwargs))").unwrap(); + s + } + } -{% endfor %}{{ name }} = Union[{{ union_variant_names|join(", ") }}] -{% if description.is_some() && !description.as_deref().unwrap_or("").is_empty() %}"""{{ description.as_deref().unwrap() }}"""{% endif %} -"#, - ext = "txt" - )] pub struct ExternallyTaggedUnionClass { pub name: String, pub description: Option, @@ -5201,37 +5450,31 @@ def create_mock_client() -> MockClient: pub union_variant_names: Vec, } + impl ExternallyTaggedUnionClass { + pub fn render(&self) -> String { + let mut s = String::new(); + for variant_def in &self.variant_definitions { + writeln!(s, "{}", variant_def).unwrap(); + writeln!(s).unwrap(); + } + writeln!( + s, + "{} = Union[{}]", + self.name, + self.union_variant_names.join(", ") + ) + .unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + } + } + writeln!(s).unwrap(); + s + } + } + // Hybrid enum templates for Pythonic data-carrying enum variants - #[derive(Template)] - #[template( - source = r#"from enum import Enum -from dataclasses import dataclass -from typing import Union, Optional - -{% for data_class in data_classes -%} -{{ data_class }} - -{% endfor -%} -class {{ enum_name }}(str, Enum): - {% if description.is_some() && !description.as_deref().unwrap().is_empty() -%} - """{{ description.as_deref().unwrap() }}""" - {% endif -%} - # Unit variants as enum members -{% for variant in unit_variants %} {{ variant.name }} = "{{ variant.value }}"{% if variant.description.is_some() %} # {{ variant.description.as_deref().unwrap() }}{% endif %} -{% endfor %} - - def model_dump(self): - """Handle serialization for simple enum values.""" - return self.value -{% for method in factory_methods -%} -{{ method }} -{% endfor %} - -# Type annotation for the union -{{ union_name }} = Union[{{ union_members|join(", ") }}] -"#, - ext = "txt" - )] pub struct HybridEnumClass { pub enum_name: String, pub description: Option, @@ -5242,27 +5485,56 @@ class {{ enum_name }}(str, Enum): pub union_name: String, } - #[derive(Template)] - #[template( - source = r#"@dataclass -class {{ name }}: - {% if description.is_some() && !description.as_deref().unwrap().is_empty() %}"""{{ description.as_deref().unwrap() }}""" - {% endif %}{%- for field_type in field_types %} - {{ field_type }} -{%- endfor %} - - def model_dump(self) -> dict: - """Serialize tuple variant as externally tagged.""" - fields = [{% for field in field_names %}self.{{ field }}{% if !loop.last %}, {% endif %}{% endfor %}] - return {"{{ variant_name }}": fields} - - def model_dump_json(self, **kwargs) -> str: - """Serialize as JSON.""" - import json - return json.dumps(self.model_dump()) -"#, - ext = "txt" - )] + impl HybridEnumClass { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "from enum import Enum").unwrap(); + writeln!(s, "from dataclasses import dataclass").unwrap(); + writeln!(s, "from typing import Union, Optional").unwrap(); + writeln!(s).unwrap(); + for data_class in &self.data_classes { + write!(s, "{}", data_class).unwrap(); + writeln!(s).unwrap(); + } + writeln!(s, "class {}(str, Enum):", self.enum_name).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } + } + writeln!(s, " # Unit variants as enum members").unwrap(); + for variant in &self.unit_variants { + write!(s, " {} = \"{}\"", variant.name, variant.value).unwrap(); + if let Some(desc) = &variant.description { + write!(s, " # {}", desc).unwrap(); + } + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, " def model_dump(self):").unwrap(); + writeln!( + s, + " \"\"\"Handle serialization for simple enum values.\"\"\"" + ) + .unwrap(); + writeln!(s, " return self.value").unwrap(); + for method in &self.factory_methods { + write!(s, "{}", method).unwrap(); + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, "# Type annotation for the union").unwrap(); + writeln!( + s, + "{} = Union[{}]", + self.union_name, + self.union_members.join(", ") + ) + .unwrap(); + s + } + } + pub struct TupleVariantDataClass { pub name: String, pub variant_name: String, @@ -5271,31 +5543,42 @@ class {{ name }}: pub description: Option, } - #[derive(Template)] - #[template( - source = r#"@dataclass -class {{ name }}: - {% if description.is_some() && !description.as_deref().unwrap().is_empty() %}"""{{ description.as_deref().unwrap() }}""" - {% endif %}{%- for field_def in field_definitions %} - {{ field_def }} -{%- endfor %} - - def model_dump(self) -> dict: - """Serialize struct variant as externally tagged.""" - result = {} -{%- for field_name in field_names %} - if hasattr(self, '{{ field_name }}') and self.{{ field_name }} is not None: - result['{{ field_name }}'] = self.{{ field_name }} -{%- endfor %} - return {"{{ variant_name }}": result} - - def model_dump_json(self, **kwargs) -> str: - """Serialize as JSON.""" - import json - return json.dumps(self.model_dump()) -"#, - ext = "txt" - )] + impl TupleVariantDataClass { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "@dataclass").unwrap(); + writeln!(s, "class {}:", self.name).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } + } + for field_type in &self.field_types { + writeln!(s, " {}", field_type).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, " def model_dump(self) -> dict:").unwrap(); + writeln!( + s, + " \"\"\"Serialize tuple variant as externally tagged.\"\"\"" + ) + .unwrap(); + let field_refs: Vec = self + .field_names + .iter() + .map(|f| format!("self.{}", f)) + .collect(); + writeln!(s, " fields = [{}]", field_refs.join(", ")).unwrap(); + writeln!(s, " return {{\"{}\": fields}}", self.variant_name).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def model_dump_json(self, **kwargs) -> str:").unwrap(); + writeln!(s, " \"\"\"Serialize as JSON.\"\"\"").unwrap(); + writeln!(s, " import json").unwrap(); + writeln!(s, " return json.dumps(self.model_dump())").unwrap(); + s + } + } + pub struct StructVariantDataClass { pub name: String, pub variant_name: String, @@ -5304,8 +5587,51 @@ class {{ name }}: pub description: Option, } - #[derive(Template)] - #[template(source = r#"{{ method_name }}"#, ext = "txt")] + impl StructVariantDataClass { + pub fn render(&self) -> String { + let mut s = String::new(); + writeln!(s, "@dataclass").unwrap(); + writeln!(s, "class {}:", self.name).unwrap(); + if let Some(desc) = &self.description { + if !desc.is_empty() { + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + } + } + for field_def in &self.field_definitions { + writeln!(s, " {}", field_def).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, " def model_dump(self) -> dict:").unwrap(); + writeln!( + s, + " \"\"\"Serialize struct variant as externally tagged.\"\"\"" + ) + .unwrap(); + writeln!(s, " result = {{}}").unwrap(); + for field_name in &self.field_names { + writeln!( + s, + " if hasattr(self, '{}') and self.{} is not None:", + field_name, field_name + ) + .unwrap(); + writeln!( + s, + " result['{}'] = self.{}", + field_name, field_name + ) + .unwrap(); + } + writeln!(s, " return {{\"{}\": result}}", self.variant_name).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " def model_dump_json(self, **kwargs) -> str:").unwrap(); + writeln!(s, " \"\"\"Serialize as JSON.\"\"\"").unwrap(); + writeln!(s, " import json").unwrap(); + writeln!(s, " return json.dumps(self.model_dump())").unwrap(); + s + } + } + pub struct FactoryMethod { pub method_name: String, pub variant_name: String, @@ -5315,25 +5641,12 @@ class {{ name }}: pub description: Option, } - #[derive(Template)] - #[template( - source = r#"{% if is_generic -%} -# TypeVar definitions for {{ union_name }} -{% for param in generic_params -%} -{{ param }} = TypeVar('{{ param }}') -{% endfor %} - -{% endif -%} -{% for variant_model in variant_models %}{{ variant_model }} - -{% endfor %} -# Discriminated union for {{ union_name }} -{{ union_name }} = Annotated[Union[{{ union_members|join(", ") }}], Field(discriminator='kind')] -{% if description.is_some() -%} -"""{{ description.as_deref().unwrap() }}""" -{% endif %}"#, - ext = "txt" - )] + impl FactoryMethod { + pub fn render(&self) -> String { + self.method_name.clone() + } + } + pub struct DiscriminatedUnionEnum { pub variant_models: Vec, pub union_members: Vec, @@ -5343,49 +5656,36 @@ class {{ name }}: pub generic_params: Vec, } - #[derive(Template)] - #[template( - source = r#"{% for variant_model in variant_models %}{{ variant_model }} - -{% endfor %} -# Externally tagged enum using RootModel -{% if is_single_variant %}{{ name }}Variants = {{ union_variants }} -{% else %}{{ name }}Variants = Union[{{ union_variants }}] -{% endif %} -class {{ name }}(RootModel[{{ name }}Variants]{% if is_generic %}, Generic[{% for param in generic_params %}{{ param }}{% if !loop.last %}, {% endif %}{% endfor %}]{% endif %}): - """{% if description.is_some() %}{{ description.as_deref().unwrap() }}{% else %}Externally tagged enum{% endif %}""" - -{% if is_generic %} @classmethod - def __class_getitem__(cls, params): - return cls -{% endif %} - - @model_validator(mode='before') - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) -{{ instance_validator_cases }} - - # Handle JSON data (for deserialization) -{{ validator_cases }} - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) -{{ dict_validator_cases }} - - raise ValueError(f"Unknown variant for {{ name }}: {data}") - - @model_serializer - def _serialize_externally_tagged(self): -{{ serializer_cases }} + impl DiscriminatedUnionEnum { + pub fn render(&self) -> String { + let mut s = String::new(); + if self.is_generic { + writeln!(s, "# TypeVar definitions for {}", self.union_name).unwrap(); + for param in &self.generic_params { + writeln!(s, "{} = TypeVar('{}')", param, param).unwrap(); + } + writeln!(s).unwrap(); + } + for variant_model in &self.variant_models { + writeln!(s, "{}", variant_model).unwrap(); + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, "# Discriminated union for {}", self.union_name).unwrap(); + writeln!( + s, + "{} = Annotated[Union[{}], Field(discriminator='kind')]", + self.union_name, + self.union_members.join(", ") + ) + .unwrap(); + if let Some(desc) = &self.description { + writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + } + s + } + } - raise ValueError(f"Cannot serialize {{ name }} variant: {type(self.root)}") -"#, - ext = "txt" - )] pub struct ExternallyTaggedEnumRootModel { pub name: String, pub description: Option, @@ -5400,84 +5700,89 @@ class {{ name }}(RootModel[{{ name }}Variants]{% if is_generic %}, Generic[{% fo pub generic_params: Vec, } - #[derive(Template)] - #[template( - source = r#"{% if is_generic %} -# Generic externally tagged enum using Approach B: Generic Variant Models -{% for param in generic_params -%} -{{ param }} = TypeVar('{{ param }}') -{% endfor %} - -# Common non-generic base class with discriminator -class {{ name }}Base(BaseModel): - """Base class for {{ name }} variants with shared discriminator.""" - _kind: str = PrivateAttr() - -{% for variant_model in variant_models %}{{ variant_model }} - -{% endfor %} -# Type alias for parameterized union - users can create specific unions as needed -# Example: {{ name }}[SomeType, AnotherType] = Union[{{ name }}Variant1[SomeType], {{ name }}Variant2[AnotherType]] -class {{ name }}(Generic[{% for param in generic_params %}{{ param }}{% if !loop.last %}, {% endif %}{% endfor %}]): - """{% if description.is_some() %}{{ description.as_deref().unwrap() }}{% else %}Generic externally tagged enum using Approach B{% endif %} - - This is a generic enum where each variant is a separate generic class. - To create a specific instance, use the variant classes directly. - To create a union type, use Union[VariantClass[Type1], OtherVariant[Type2]]. - """ - - @classmethod - def __class_getitem__(cls, params): - """Create documentation about parameterized types.""" - if not isinstance(params, tuple): - params = (params,) - if len(params) != {{ generic_params.len() }}: - raise TypeError(f"Expected {{ generic_params.len() }} type parameters, got {len(params)}") - - # For Approach B, users should create unions directly using variant classes - # This method serves as documentation - variant_examples = [ - {% for variant_info in variant_info_list %}"{{ variant_info.class_name }}[{% for param in generic_params %}{{ param }}{% if !loop.last %}, {% endif %}{% endfor %}]"{% if !loop.last %}, - {% endif %}{% endfor %} - ] - - # Return a helpful hint rather than NotImplementedError - return f"Union[{', '.join(variant_examples)}] # Use this pattern to create specific unions" -{% else %} -# Non-generic externally tagged enum - use existing RootModel approach -{% if is_single_variant %}{{ name }}Variants = {{ union_variants }} -{% else %}{{ name }}Variants = Union[{{ union_variants }}] -{% endif %} -class {{ name }}(RootModel[{{ name }}Variants]): - """{% if description.is_some() %}{{ description.as_deref().unwrap() }}{% else %}Externally tagged enum{% endif %}""" - - @model_validator(mode='before') - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) -{{ instance_validator_cases }} - - # Handle JSON data (for deserialization) -{{ validator_cases }} - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) -{{ dict_validator_cases }} - - raise ValueError(f"Unknown variant for {{ name }}: {data}") - - @model_serializer - def _serialize_externally_tagged(self): -{{ serializer_cases }} - - raise ValueError(f"Cannot serialize {{ name }} variant: {type(self.root)}") -{% endif %} -"#, - ext = "txt" - )] + impl ExternallyTaggedEnumRootModel { + pub fn render(&self) -> String { + let mut s = String::new(); + for variant_model in &self.variant_models { + writeln!(s, "{}", variant_model).unwrap(); + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, "# Externally tagged enum using RootModel").unwrap(); + if self.is_single_variant { + writeln!(s, "{}Variants = {}", self.name, self.union_variants).unwrap(); + } else { + writeln!(s, "{}Variants = Union[{}]", self.name, self.union_variants).unwrap(); + } + writeln!(s).unwrap(); + if self.is_generic { + let params = self.generic_params.join(", "); + writeln!( + s, + "class {}(RootModel[{}Variants], Generic[{}]):", + self.name, self.name, params + ) + .unwrap(); + } else { + writeln!(s, "class {}(RootModel[{}Variants]):", self.name, self.name).unwrap(); + } + let desc = self + .description + .as_deref() + .unwrap_or("Externally tagged enum"); + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s).unwrap(); + if self.is_generic { + writeln!(s, " @classmethod").unwrap(); + writeln!(s, " def __class_getitem__(cls, params):").unwrap(); + writeln!(s, " return cls").unwrap(); + writeln!(s).unwrap(); + } + writeln!(s, " @model_validator(mode='before')").unwrap(); + writeln!(s, " @classmethod").unwrap(); + writeln!(s, " def _validate_externally_tagged(cls, data):").unwrap(); + writeln!( + s, + " # Handle direct variant instances (for programmatic creation)" + ) + .unwrap(); + writeln!(s, "{}", self.instance_validator_cases).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " # Handle JSON data (for deserialization)").unwrap(); + writeln!(s, "{}", self.validator_cases).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " if isinstance(data, dict):").unwrap(); + writeln!(s, " if len(data) != 1:").unwrap(); + writeln!( + s, + " raise ValueError(\"Externally tagged enum must have exactly one key\")" + ) + .unwrap(); + writeln!(s).unwrap(); + writeln!(s, " key, value = next(iter(data.items()))").unwrap(); + writeln!(s, "{}", self.dict_validator_cases).unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " raise ValueError(f\"Unknown variant for {}: {{data}}\")", + self.name + ) + .unwrap(); + writeln!(s).unwrap(); + writeln!(s, " @model_serializer").unwrap(); + writeln!(s, " def _serialize_externally_tagged(self):").unwrap(); + writeln!(s, "{}", self.serializer_cases).unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " raise ValueError(f\"Cannot serialize {} variant: {{type(self.root)}}\")", + self.name + ) + .unwrap(); + s + } + } + pub struct GenericExternallyTaggedEnumApproachB { pub name: String, pub description: Option, @@ -5493,6 +5798,196 @@ class {{ name }}(RootModel[{{ name }}Variants]): pub variant_info_list: Vec, } + impl GenericExternallyTaggedEnumApproachB { + pub fn render(&self) -> String { + let mut s = String::new(); + if self.is_generic { + writeln!(s).unwrap(); + writeln!( + s, + "# Generic externally tagged enum using Approach B: Generic Variant Models" + ) + .unwrap(); + for param in &self.generic_params { + writeln!(s, "{} = TypeVar('{}')", param, param).unwrap(); + } + writeln!(s).unwrap(); + writeln!(s, "# Common non-generic base class with discriminator").unwrap(); + writeln!(s, "class {}Base(BaseModel):", self.name).unwrap(); + writeln!( + s, + " \"\"\"Base class for {} variants with shared discriminator.\"\"\"", + self.name + ) + .unwrap(); + writeln!(s, " _kind: str = PrivateAttr()").unwrap(); + writeln!(s).unwrap(); + for variant_model in &self.variant_models { + writeln!(s, "{}", variant_model).unwrap(); + writeln!(s).unwrap(); + } + writeln!(s).unwrap(); + let params = self.generic_params.join(", "); + writeln!( + s, + "# Type alias for parameterized union - users can create specific unions as needed" + ) + .unwrap(); + writeln!( + s, + "# Example: {}[SomeType, AnotherType] = Union[{}Variant1[SomeType], {}Variant2[AnotherType]]", + self.name, self.name, self.name + ) + .unwrap(); + writeln!(s, "class {}(Generic[{}]):", self.name, params).unwrap(); + let desc = self + .description + .as_deref() + .unwrap_or("Generic externally tagged enum using Approach B"); + writeln!(s, " \"\"\"{}", desc).unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " This is a generic enum where each variant is a separate generic class." + ) + .unwrap(); + writeln!( + s, + " To create a specific instance, use the variant classes directly." + ) + .unwrap(); + writeln!( + s, + " To create a union type, use Union[VariantClass[Type1], OtherVariant[Type2]]." + ) + .unwrap(); + writeln!(s, " \"\"\"").unwrap(); + writeln!(s).unwrap(); + writeln!(s, " @classmethod").unwrap(); + writeln!(s, " def __class_getitem__(cls, params):").unwrap(); + writeln!( + s, + " \"\"\"Create documentation about parameterized types.\"\"\"" + ) + .unwrap(); + writeln!(s, " if not isinstance(params, tuple):").unwrap(); + writeln!(s, " params = (params,)").unwrap(); + writeln!( + s, + " if len(params) != {}:", + self.generic_params.len() + ) + .unwrap(); + writeln!( + s, + " raise TypeError(f\"Expected {} type parameters, got {{len(params)}}\")", + self.generic_params.len() + ) + .unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " # For Approach B, users should create unions directly using variant classes" + ) + .unwrap(); + writeln!(s, " # This method serves as documentation").unwrap(); + writeln!(s, " variant_examples = [").unwrap(); + for (i, variant_info) in self.variant_info_list.iter().enumerate() { + let generic_params_str = self.generic_params.join(", "); + if i < self.variant_info_list.len() - 1 { + writeln!( + s, + " \"{}[{}]\",", + variant_info.class_name, generic_params_str + ) + .unwrap(); + } else { + writeln!( + s, + " \"{}[{}]\"", + variant_info.class_name, generic_params_str + ) + .unwrap(); + } + } + writeln!(s, " ]").unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " # Return a helpful hint rather than NotImplementedError" + ) + .unwrap(); + writeln!( + s, + " return f\"Union[{{', '.join(variant_examples)}}] # Use this pattern to create specific unions\"" + ) + .unwrap(); + } else { + writeln!(s).unwrap(); + writeln!( + s, + "# Non-generic externally tagged enum - use existing RootModel approach" + ) + .unwrap(); + if self.is_single_variant { + writeln!(s, "{}Variants = {}", self.name, self.union_variants).unwrap(); + } else { + writeln!(s, "{}Variants = Union[{}]", self.name, self.union_variants).unwrap(); + } + writeln!(s, "class {}(RootModel[{}Variants]):", self.name, self.name).unwrap(); + let desc = self + .description + .as_deref() + .unwrap_or("Externally tagged enum"); + writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " @model_validator(mode='before')").unwrap(); + writeln!(s, " @classmethod").unwrap(); + writeln!(s, " def _validate_externally_tagged(cls, data):").unwrap(); + writeln!( + s, + " # Handle direct variant instances (for programmatic creation)" + ) + .unwrap(); + writeln!(s, "{}", self.instance_validator_cases).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " # Handle JSON data (for deserialization)").unwrap(); + writeln!(s, "{}", self.validator_cases).unwrap(); + writeln!(s).unwrap(); + writeln!(s, " if isinstance(data, dict):").unwrap(); + writeln!(s, " if len(data) != 1:").unwrap(); + writeln!( + s, + " raise ValueError(\"Externally tagged enum must have exactly one key\")" + ) + .unwrap(); + writeln!(s).unwrap(); + writeln!(s, " key, value = next(iter(data.items()))").unwrap(); + writeln!(s, "{}", self.dict_validator_cases).unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " raise ValueError(f\"Unknown variant for {}: {{data}}\")", + self.name + ) + .unwrap(); + writeln!(s).unwrap(); + writeln!(s, " @model_serializer").unwrap(); + writeln!(s, " def _serialize_externally_tagged(self):").unwrap(); + writeln!(s, "{}", self.serializer_cases).unwrap(); + writeln!(s).unwrap(); + writeln!( + s, + " raise ValueError(f\"Cannot serialize {} variant: {{type(self.root)}}\")", + self.name + ) + .unwrap(); + } + writeln!(s).unwrap(); + s + } + } + #[derive(Clone)] pub struct VariantInfo { pub class_name: String, diff --git a/reflectapi/src/codegen/rust.rs b/reflectapi/src/codegen/rust.rs index 4d4d2a10..c9db0fd1 100644 --- a/reflectapi/src/codegen/rust.rs +++ b/reflectapi/src/codegen/rust.rs @@ -5,7 +5,6 @@ use std::{ }; use anyhow::Context; -use askama::Template; use indexmap::IndexMap; use reflectapi_schema::{Function, TypeReference, Visitor}; @@ -220,11 +219,7 @@ pub fn generate(mut schema: crate::Schema, config: &Config) -> anyhow::Result anyhow::Result anyhow::Result<()> { mod templates { use std::collections::BTreeSet; + use std::fmt::Write; - use askama::Template; use indexmap::IndexMap; - #[derive(Template)] - #[template( - source = "// DO NOT MODIFY THIS FILE MANUALLY -// This file was generated by reflectapi-cli -// -// Schema name: {{ name }} -// {{ description }} - -#![allow(non_camel_case_types)] -#![allow(dead_code)] - -pub use reflectapi::rt::*; -pub use interface::Interface;", - ext = "txt" - )] pub(super) struct __FileHeader { pub name: String, pub description: String, } - #[derive(Template)] - #[template( - source = " -{{ self.render_start() }} -{%- for type in types.iter() %} -{{ type }} -{%- endfor %} -{%- for module in self.submodules_sorted() %} -{{- module }} -{%- endfor %} - -{{ self.render_end() }}", - ext = "txt" - )] + impl __FileHeader { + pub fn render(&self) -> String { + format!( + "// DO NOT MODIFY THIS FILE MANUALLY\n\ + // This file was generated by reflectapi-cli\n\ + //\n\ + // Schema name: {}\n\ + // {}\n\ + \n\ + #![allow(non_camel_case_types)]\n\ + #![allow(dead_code)]\n\ + \n\ + pub use reflectapi::rt::*;\n\ + pub use interface::Interface;", + self.name, self.description + ) + } + } + pub(super) struct __Module { pub name: String, pub types: Vec, @@ -385,45 +364,24 @@ pub use interface::Interface;", self.types.is_empty() && self.submodules.iter().all(|(_, m)| m.is_empty()) } - fn render_start(&self) -> String { - if self.name.is_empty() || self.is_empty() { - "".into() - } else { - format!("pub mod {} {{", self.name) + pub fn render(&self) -> String { + let mut out = String::new(); + if !self.name.is_empty() && !self.is_empty() { + write!(out, "\npub mod {} {{", self.name).unwrap(); } - } - - fn render_end(&self) -> String { - if self.name.is_empty() || self.is_empty() { - "".into() - } else { - "}".into() + for t in &self.types { + write!(out, "\n{t}").unwrap(); + } + for module in self.submodules_sorted() { + out.push_str(&module.render()); } + if !self.name.is_empty() && !self.is_empty() { + write!(out, "\n\n}}").unwrap(); + } + out } } - #[derive(Template)] - #[template( - source = r#" -{{ description }}{{ self.render_attributes_derive() }} -pub struct {{ name }} {{ self.render_brackets().0 }} - {%- for field in fields.iter() %} - {{ field }}, - {%- endfor %} -{{ self.render_brackets().1 }} - -{% if is_error_type %} -impl std::fmt::Display for {{ name }} { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", reflectapi::rt::error_to_string(self)) - } -} - -impl std::error::Error for {{ name }} {} -{% endif %} -"#, - ext = "txt" - )] pub(super) struct __Struct { pub name: String, pub description: String, @@ -449,16 +407,11 @@ impl std::error::Error for {{ name }} {} let mut attrs = self.codegen_config.additional_derives.clone(); attrs.extend(self.base_derives.iter().cloned()); if self.is_input_type || self.is_error_type { - // Need `Serialize` for error types for their generated `Display` implementation. - // for client it is the inverse, input types are outgoing types attrs.insert("serde::Serialize".into()); } - if self.is_output_type { - // for client it is the inverse, output types are incoming types attrs.insert("serde::Deserialize".into()); } - if attrs.is_empty() { "".into() } else { @@ -468,30 +421,39 @@ impl std::error::Error for {{ name }} {} ) } } - } - - #[derive(Template)] - #[template( - source = r#" -{{ description }}{{ self.render_attributes_derive() }} -{{ self.render_attributes() }}pub enum {{ name }} { - {%- for variant in variants.iter() %} - {{ variant }} - {%- endfor %} -} -{% if is_error_type %} -impl std::fmt::Display for {{ name }} { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", reflectapi::rt::error_to_string(self)) + pub fn render(&self) -> String { + let brackets = self.render_brackets(); + let mut out = format!( + "\n{}{}\npub struct {} {}", + self.description, + self.render_attributes_derive(), + self.name, + brackets.0, + ); + for field in &self.fields { + write!(out, "\n {},", field.render()).unwrap(); + } + write!(out, "\n{}", brackets.1).unwrap(); + + if self.is_error_type { + write!( + out, + "\n\nimpl std::fmt::Display for {} {{\n\ + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {{\n\ + write!(f, \"{{}}\", reflectapi::rt::error_to_string(self))\n\ + }}\n\ + }}\n\n\ + impl std::error::Error for {} {{}}\n", + self.name, self.name, + ) + .unwrap(); + } + out.push('\n'); + out + } } -} -impl std::error::Error for {{ name }} {} -{% endif %} -"#, - ext = "txt" - )] pub(super) struct __Enum { pub name: String, pub description: String, @@ -509,12 +471,9 @@ impl std::error::Error for {{ name }} {} let mut attrs = self.codegen_config.additional_derives.clone(); attrs.extend(self.base_derives.iter().cloned()); if self.is_input_type || self.is_error_type { - // Need `Serialize` for error types for their generated `Display` implementation. - // for client it is the inverse, input types are outgoing types attrs.insert("serde::Serialize".into()); } if self.is_output_type { - // for client it is the inverse, output types are incoming types attrs.insert("serde::Deserialize".into()); } if attrs.is_empty() { @@ -548,13 +507,38 @@ impl std::error::Error for {{ name }} {} format!("#[serde({})]\n ", attrs.join(", ")) } } + + pub fn render(&self) -> anyhow::Result { + let mut out = format!( + "\n{}{}\n{}pub enum {} {{", + self.description, + self.render_attributes_derive(), + self.render_attributes(), + self.name, + ); + for variant in &self.variants { + write!(out, "\n {}", variant.render()?).unwrap(); + } + out.push_str("\n}\n"); + + if self.is_error_type { + write!( + out, + "\nimpl std::fmt::Display for {} {{\n\ + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {{\n\ + write!(f, \"{{}}\", reflectapi::rt::error_to_string(self))\n\ + }}\n\ + }}\n\n\ + impl std::error::Error for {} {{}}\n", + self.name, self.name, + ) + .unwrap(); + } + out.push('\n'); + Ok(out) + } } - #[derive(Template)] - #[template( - source = "{{ description }}{{ self.render_attributes() }}{{ self.render_self()? }},", - ext = "txt" - )] pub(super) struct __Variant { pub name: String, pub serde_name: String, @@ -565,6 +549,15 @@ impl std::error::Error for {{ name }} {} } impl __Variant { + pub fn render(&self) -> anyhow::Result { + Ok(format!( + "{}{}{},", + self.description, + self.render_attributes(), + self.render_self()?, + )) + } + fn render_self(&self) -> anyhow::Result { let brakets = self.render_brackets(); let r = format!( @@ -598,7 +591,7 @@ impl std::error::Error for {{ name }} {} fn render_fields(&self) -> anyhow::Result { let mut rendered_fields = Vec::new(); for field in self.fields.iter() { - rendered_fields.push(field.render()?); + rendered_fields.push(field.render()); } if rendered_fields.is_empty() { Ok("".into()) @@ -625,11 +618,7 @@ impl std::error::Error for {{ name }} {} } } - #[derive(Template, Clone)] - #[template( - source = "{{ description }}{{ self.render_attributes() }}{% if !self.is_unnamed() %}{{ self.render_visibility_modifier() }}{{ name }}: {{ type_ }}{% else %}{{ type_ }}{% endif %}", - ext = "txt" - )] + #[derive(Clone)] pub(super) struct __Field { pub name: String, pub serde_name: String, @@ -646,11 +635,11 @@ impl std::error::Error for {{ name }} {} self.name.parse::().is_ok() } - fn render_visibility_modifier(&self) -> String { + fn render_visibility_modifier(&self) -> &'static str { if self.public { - "pub ".into() + "pub " } else { - "".into() + "" } } @@ -663,13 +652,10 @@ impl std::error::Error for {{ name }} {} if self.optional { serde_attrs.push("default = \"Default::default\"".into()); - // this one is important to not serialize undefined values - // as this is the special built-in type which allows to differentiate between undefined and null if self.type_.starts_with("reflectapi::Option<") { serde_attrs .push("skip_serializing_if = \"reflectapi::Option::is_undefined\"".into()); } - // the rest are nice to have, we enumerate only commonly used std types if self.type_.starts_with("std::option::Option<") { serde_attrs .push("skip_serializing_if = \"std::option::Option::is_none\"".into()); @@ -714,37 +700,38 @@ impl std::error::Error for {{ name }} {} out } + + pub fn render(&self) -> String { + if self.is_unnamed() { + format!("{}{}{}", self.description, self.render_attributes(), self.type_) + } else { + format!( + "{}{}{}{}: {}", + self.description, + self.render_attributes(), + self.render_visibility_modifier(), + self.name, + self.type_, + ) + } + } } - #[derive(Template)] - #[template( - source = " -{{ description }}pub type {{ name }} = {{ type_ }};", - ext = "txt" - )] pub(super) struct __Alias { pub name: String, pub description: String, pub type_: String, } - #[derive(Template)] - #[template( - source = " -{{ description }}{{ self.render_attributes_derive() }} -pub struct {{ name }}; - -{% if is_error_type %} -impl std::fmt::Display for {{ name }} { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, \"{{ name }}\") + impl __Alias { + pub fn render(&self) -> String { + format!( + "\n{}pub type {} = {};", + self.description, self.name, self.type_ + ) + } } -} -impl std::error::Error for {{ name }} {} -{% endif %}", - ext = "txt" - )] pub(super) struct __Unit { pub name: String, pub description: String, @@ -760,11 +747,9 @@ impl std::error::Error for {{ name }} {} let mut attrs = self.codegen_config.additional_derives.clone(); attrs.extend(self.base_derives.iter().cloned()); if self.is_input_type { - // for client it is the inverse, input types are outgoing types attrs.insert("serde::Serialize".into()); } if self.is_output_type { - // for client it is the inverse, output types are incoming types attrs.insert("serde::Deserialize".into()); } if attrs.is_empty() { @@ -776,24 +761,32 @@ impl std::error::Error for {{ name }} {} ) } } + + pub fn render(&self) -> String { + let mut out = format!( + "\n{}{}\npub struct {};\n", + self.description, + self.render_attributes_derive(), + self.name, + ); + + if self.is_error_type { + write!( + out, + "\nimpl std::fmt::Display for {} {{\n\ + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {{\n\ + write!(f, \"{}\")\n\ + }}\n\ + }}\n\n\ + impl std::error::Error for {} {{}}\n", + self.name, self.name, self.name, + ) + .unwrap(); + } + out + } } - #[derive(Template)] - #[template( - source = r#" - {%- if let Some(deprecation_note) = deprecation_note -%} - {%- if deprecation_note.is_empty() -%} - #[deprecated] - {%- else -%} - #[deprecated(note = "{{ deprecation_note }}")] - {%- endif -%} - {%- endif -%} - {{description}}{{attributes}}pub async fn {{ name }}(&self, input: {{ input_type }}, headers: {{ input_headers }}) - -> Result<{{ output_type }}, reflectapi::rt::Error<{{ error_type }}, C::Error>> { - reflectapi::rt::__request_impl(&self.client, self.base_url.join("{{ path }}").expect("checked base_url already and path is valid"), input, headers).await - }"#, - ext = "txt" - )] pub(super) struct __FunctionImplementationTemplate { pub name: String, pub description: String, @@ -806,34 +799,75 @@ impl std::error::Error for {{ name }} {} pub error_type: String, } - #[derive(Template)] - #[template( - source = r#" -impl {{ name }} { - pub fn try_new(client: C, base_url: reflectapi::rt::Url) -> std::result::Result { - if base_url.cannot_be_a_base() { - return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + impl __FunctionImplementationTemplate { + pub fn render(&self) -> String { + let mut out = String::new(); + if let Some(deprecation_note) = &self.deprecation_note { + if deprecation_note.is_empty() { + out.push_str(" #[deprecated]"); + } else { + write!(out, " #[deprecated(note = \"{deprecation_note}\")]").unwrap(); + } + } + write!( + out, + " {}{}pub async fn {}(&self, input: {}, headers: {})\n\ + -> Result<{}, reflectapi::rt::Error<{}, C::Error>> {{\n\ + reflectapi::rt::__request_impl(&self.client, self.base_url.join(\"{}\").expect(\"checked base_url already and path is valid\"), input, headers).await\n\ + }}", + self.description, + self.attributes, + self.name, + self.input_type, + self.input_headers, + self.output_type, + self.error_type, + self.path, + ) + .unwrap(); + out } - - Ok(Self { - {%- for field in fields.iter() %} - {{ field.name }}: {{ field.type_ }}::try_new(client.clone(), base_url.clone())?, - {%- endfor %} - client, - base_url, - }) } - {%- for func in functions.iter() %} - {{ func }} - {%- endfor %} -}"#, - ext = "txt" - )] + pub(super) struct __InterfaceImplementationTemplate { pub name: String, pub fields: Vec<__Field>, pub functions: Vec<__FunctionImplementationTemplate>, } + + impl __InterfaceImplementationTemplate { + pub fn render(&self) -> String { + let mut out = format!( + "\nimpl {} {{\n\ + pub fn try_new(client: C, base_url: reflectapi::rt::Url) -> std::result::Result {{\n\ + if base_url.cannot_be_a_base() {{\n\ + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase);\n\ + }}\n\ + \n\ + Ok(Self {{", + self.name, + ); + for field in &self.fields { + write!( + out, + "\n {}: {}::try_new(client.clone(), base_url.clone())?,", + field.name, field.type_ + ) + .unwrap(); + } + out.push_str( + "\n client,\n\ + base_url,\n\ + })\n\ + }" + ); + for func in &self.functions { + write!(out, "\n {}", func.render()).unwrap(); + } + out.push_str("\n}"); + out + } + } } struct __FunctionGroup { @@ -1014,8 +1048,8 @@ fn __interface_types_from_function_group( } let mut result = vec![ - type_template.render().unwrap(), - interface_implementation.render().unwrap(), + type_template.render(), + interface_implementation.render(), ]; for (subgroup_name, subgroup) in group.subgroups.iter() { @@ -1087,9 +1121,7 @@ fn __render_type( codegen_config: struct_def.codegen_config.rust.clone(), base_derives: config.base_derives.clone(), }; - unit_struct_template - .render() - .context("Failed to render template")? + unit_struct_template.render() } else if struct_def.is_alias() { let field_type_ref = struct_def.fields.iter().next().unwrap().type_ref.clone(); let alias_template = templates::__Alias { @@ -1103,9 +1135,7 @@ fn __render_type( Some(type_def), ), }; - alias_template - .render() - .context("Failed to render template")? + alias_template.render() } else { let interface_template = templates::__Struct { name: type_name, @@ -1137,9 +1167,7 @@ fn __render_type( }) .collect::>(), }; - interface_template - .render() - .context("Failed to render template")? + interface_template.render() } } crate::Type::Enum(enum_def) => { @@ -1184,9 +1212,7 @@ fn __render_type( }) .collect::>(), }; - enum_template - .render() - .context("Failed to render template")? + enum_template.render()? } crate::Type::Primitive(_) => { // do nothing, we will use the primitive types as is diff --git a/reflectapi/src/codegen/typescript.rs b/reflectapi/src/codegen/typescript.rs index 471345ef..e173aa21 100644 --- a/reflectapi/src/codegen/typescript.rs +++ b/reflectapi/src/codegen/typescript.rs @@ -6,7 +6,6 @@ use std::{ use super::{format_with, END_BOILERPLATE, START_BOILERPLATE}; use anyhow::Context; -use askama::Template; use indexmap::IndexMap; use reflectapi_schema::Function; @@ -81,11 +80,7 @@ pub fn generate(mut schema: crate::Schema, config: &Config) -> anyhow::Result anyhow::Result anyhow::Result anyhow::Result<()> { } mod templates { - use askama::Template; use indexmap::IndexMap; + use std::fmt::Write; - #[derive(Template)] - #[template( - source = "// DO NOT MODIFY THIS FILE MANUALLY -// This file was generated by reflectapi-cli -// -// Schema name: {{ name }} -// {{ description }} - -export function client(base: string | Client): __definition.Interface { - return __implementation.__client(base) -}", - ext = "txt" - )] pub(super) struct FileHeader { pub name: String, pub description: String, } - #[derive(Template)] - #[template( - source = " -namespace __implementation { - -{{ start_boilerplate }} - -export function __client(base: string | Client): __definition.Interface { - const client_instance = typeof base === 'string' ? new ClientInstance(base) : base; - return { impl: {{ client_impl }} }.impl -} - -{{ end_boilerplate }} - -{{ implemented_functions }} + impl FileHeader { + pub fn render(&self) -> String { + format!( + "// DO NOT MODIFY THIS FILE MANUALLY\n\ + // This file was generated by reflectapi-cli\n\ + //\n\ + // Schema name: {}\n\ + // {}\n\ + \n\ + export function client(base: string | Client): __definition.Interface {{\n\ + return __implementation.__client(base)\n\ + }}", + self.name, self.description + ) + } + } -} -", - ext = "txt" - )] pub(super) struct FileFooter { pub start_boilerplate: &'static str, pub end_boilerplate: &'static str, @@ -256,20 +225,31 @@ export function __client(base: string | Client): __definition.Interface { pub implemented_functions: String, } - #[derive(Template)] - #[template( - source = " -{{ self.render_start() }} -{%- for type in types.iter() %} -{{ type }} -{%- endfor %} -{%- for module in self.submodules_sorted() %} -{{ module }} -{%- endfor %} - -{{ self.render_end() }}", - ext = "txt" - )] + impl FileFooter { + pub fn render(&self) -> String { + format!( + "\nnamespace __implementation {{\n\ + \n\ + {}\n\ + \n\ + export function __client(base: string | Client): __definition.Interface {{\n\ + const client_instance = typeof base === 'string' ? new ClientInstance(base) : base;\n\ + return {{ impl: {} }}.impl\n\ + }}\n\ + \n\ + {}\n\ + \n\ + {}\n\ + \n\ + }}\n", + self.start_boilerplate, + self.client_impl, + self.end_boilerplate, + self.implemented_functions, + ) + } + } + pub(super) struct Module { pub name: String, pub types: Vec, @@ -287,33 +267,26 @@ export function __client(base: string | Client): __definition.Interface { self.types.is_empty() && self.submodules.iter().all(|(_, m)| m.is_empty()) } - fn render_start(&self) -> String { - if self.name.is_empty() || self.is_empty() { - "".into() - } else { - format!("export namespace {} {{", self.name.replace('-', "_")) + pub fn render(&self) -> String { + let mut out = String::new(); + if !self.name.is_empty() && !self.is_empty() { + write!(out, "\nexport namespace {} {{", self.name.replace('-', "_")) + .unwrap(); } - } - - fn render_end(&self) -> String { - if self.name.is_empty() || self.is_empty() { - "".into() - } else { - "}".into() + for t in &self.types { + write!(out, "\n{t}").unwrap(); } + for module in self.submodules_sorted() { + out.push('\n'); + out.push_str(&module.render()); + } + if !self.name.is_empty() && !self.is_empty() { + write!(out, "\n\n}}").unwrap(); + } + out } } - #[derive(Template)] - #[template( - source = " -{{ description }}export {{ self.render_keyword() }} {{ name }} {{ self.render_brackets().0 }} - {%- for field in fields.iter() %} - {{ field }}, - {%- endfor %} -{{ self.render_brackets().1 }}{{ self.render_flattened_types() }}", - ext = "txt" - )] pub(super) struct Interface { pub name: String, pub description: String, @@ -323,11 +296,11 @@ export function __client(base: string | Client): __definition.Interface { } impl Interface { - fn render_keyword(&self) -> String { + fn render_keyword(&self) -> &'static str { if self.is_tuple || !self.flattened_types.is_empty() { - "type".into() + "type" } else { - "interface".into() + "interface" } } @@ -348,25 +321,44 @@ export function __client(base: string | Client): __definition.Interface { format!(" & {}", self.flattened_types.join(" &\n ")) } } + + pub fn render(&self) -> String { + let brackets = self.render_brackets(); + let mut out = format!( + "\n{}export {} {} {}", + self.description, + self.render_keyword(), + self.name, + brackets.0, + ); + for field in &self.fields { + write!(out, "\n {},", field.render()).unwrap(); + } + write!(out, "\n{}{}", brackets.1, self.render_flattened_types()).unwrap(); + out + } } - #[derive(Template)] - #[template( - source = " -{{ description }}export type {{ name }} = - {%- for variant in variants.iter() %} - {{ variant }} - {%- endfor %};", - ext = "txt" - )] pub(super) struct Enum { pub name: String, pub description: String, pub variants: Vec, } - #[derive(Template)] - #[template(source = "{{ description }}| {{ self.render_self()? }}", ext = "txt")] + impl Enum { + pub fn render(&self) -> anyhow::Result { + let mut out = format!( + "\n{}export type {} =", + self.description, self.name, + ); + for variant in &self.variants { + write!(out, "\n {}", variant.render()?).unwrap(); + } + out.push(';'); + Ok(out) + } + } + pub(super) struct Variant { pub name: String, pub description: String, @@ -411,6 +403,10 @@ export function __client(base: string | Client): __definition.Interface { } impl Variant { + pub fn render(&self) -> anyhow::Result { + Ok(format!("{}| {}", self.description, self.render_self()?)) + } + fn field_brackets(&self) -> (String, String) { if self.fields.is_empty() { ("".into(), "".into()) @@ -530,7 +526,7 @@ export function __client(base: string | Client): __definition.Interface { } for field in self.fields.iter() { - rendered_fields.push(field.render()?); + rendered_fields.push(field.render()); } Ok(format!( @@ -544,11 +540,7 @@ export function __client(base: string | Client): __definition.Interface { // TODO The ? is in the wrong place for optional tuple fields. // i.e. syntax is { name?: string } for object-like things but [string?] for array-like things - #[derive(Debug, Template)] - #[template( - source = "{{ description }}{% if !self.is_unnamed() %}{{ self.normalized_name() }}{% if optional %}{{ \"?\" }}{% endif %}: {{ type_ }}{% else %}{{ type_ }}{% endif %}", - ext = "txt" - )] + #[derive(Debug)] pub(super) struct Field { pub name: String, pub description: String, @@ -570,29 +562,33 @@ export function __client(base: string | Client): __definition.Interface { self.name.clone() } } + + pub fn render(&self) -> String { + if self.is_unnamed() { + format!("{}{}", self.description, self.type_) + } else if self.optional { + format!("{}{}?: {}", self.description, self.normalized_name(), self.type_) + } else { + format!("{}{}: {}", self.description, self.normalized_name(), self.type_) + } + } } - #[derive(Template)] - #[template( - source = " -{{ description }}export type {{ name }} = {{ type_ }};", - ext = "txt" - )] pub(super) struct Alias { pub name: String, pub description: String, pub type_: String, } - #[derive(Template)] - #[template( - source = "function {{ name }}(client: Client) { - return (input: {{ input_type }}, headers: {{ input_headers }}, options?: RequestOptions) => __request< - {{ input_type }}, {{ input_headers }}, {{ output_type }}, {{ error_type }} - >(client, '{{ path }}', input, headers, options); -}", - ext = "txt" - )] + impl Alias { + pub fn render(&self) -> String { + format!( + "\n{}export type {} = {};", + self.description, self.name, self.type_ + ) + } + } + pub(super) struct FunctionImplementationTemplate { pub name: String, pub path: String, @@ -602,6 +598,24 @@ export function __client(base: string | Client): __definition.Interface { pub error_type: String, } + impl FunctionImplementationTemplate { + pub fn render(&self) -> String { + format!( + "function {name}(client: Client) {{\n\ + return (input: {input_type}, headers: {input_headers}, options?: RequestOptions) => __request<\n\ + {input_type}, {input_headers}, {output_type}, {error_type}\n\ + >(client, '{path}', input, headers, options);\n\ + }}", + name = self.name, + input_type = self.input_type, + input_headers = self.input_headers, + output_type = self.output_type, + error_type = self.error_type, + path = self.path, + ) + } + } + #[derive(Debug)] pub(super) struct ClientImplementationGroup { pub offset: usize, @@ -824,9 +838,7 @@ fn render_function( output_type, error_type, }; - function_template - .render() - .context("Failed to render template") + Ok(function_template.render()) } fn render_type( @@ -845,9 +857,7 @@ fn render_type( description: doc_to_ts_comments(&struct_def.description, None, 0), type_: type_ref_to_ts_ref(&field_type_ref, schema, implemented_types), }; - alias_template - .render() - .context("Failed to render template")? + alias_template.render() } else { let interface_template = templates::Interface { name: type_name, @@ -876,9 +886,7 @@ fn render_type( }) .collect::>(), }; - interface_template - .render() - .context("Failed to render template")? + interface_template.render() } } crate::Type::Enum(enum_def) => { @@ -906,9 +914,7 @@ fn render_type( }) .collect::>(), }; - enum_template - .render() - .context("Failed to render template")? + enum_template.render()? } crate::Type::Primitive(type_def) => { eprintln!( @@ -923,9 +929,7 @@ fn render_type( type_def.name ), }; - alias_template - .render() - .context("Failed to render template")? + alias_template.render() } }) } From bc6d2738c88ebc4dc5c5d55b4895f9b37a82a54a Mon Sep 17 00:00:00 2001 From: Andrey Konstantinov Date: Thu, 26 Mar 2026 20:49:40 +0000 Subject: [PATCH 02/47] format --- reflectapi/src/codegen/rust.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/reflectapi/src/codegen/rust.rs b/reflectapi/src/codegen/rust.rs index c9db0fd1..6eac26c7 100644 --- a/reflectapi/src/codegen/rust.rs +++ b/reflectapi/src/codegen/rust.rs @@ -703,7 +703,12 @@ mod templates { pub fn render(&self) -> String { if self.is_unnamed() { - format!("{}{}{}", self.description, self.render_attributes(), self.type_) + format!( + "{}{}{}", + self.description, + self.render_attributes(), + self.type_ + ) } else { format!( "{}{}{}{}: {}", @@ -859,7 +864,7 @@ mod templates { "\n client,\n\ base_url,\n\ })\n\ - }" + }", ); for func in &self.functions { write!(out, "\n {}", func.render()).unwrap(); @@ -1047,10 +1052,7 @@ fn __interface_types_from_function_group( interface_implementation.functions.push(func_impl); } - let mut result = vec![ - type_template.render(), - interface_implementation.render(), - ]; + let mut result = vec![type_template.render(), interface_implementation.render()]; for (subgroup_name, subgroup) in group.subgroups.iter() { result.extend(__interface_types_from_function_group( From d67d5098c4f50c936ea2def6831c7a699684c3d4 Mon Sep 17 00:00:00 2001 From: Andrey Konstantinov Date: Fri, 27 Mar 2026 01:55:10 +0000 Subject: [PATCH 03/47] resolve CI issues --- ...tests__basic__reflectapi_deprecated-2.snap | 1 + ...__basic__reflectapi_enum_documented-2.snap | 1 + ...__reflectapi_enum_with_skip_variant-2.snap | 2 + ...basic__reflectapi_struct_documented-2.snap | 1 + ...sts__basic__reflectapi_struct_empty-2.snap | 1 + ...s__basic__reflectapi_struct_newtype-2.snap | 1 + ...i_struct_one_basic_field_static_str-2.snap | 1 + ...ctapi_struct_one_basic_field_string-2.snap | 1 + ..._basic_field_string_reflectapi_both-2.snap | 1 + ...ield_string_reflectapi_both_equally-2.snap | 1 + ...eld_string_reflectapi_both_equally2-2.snap | 1 + ...ing_reflectapi_both_with_attributes-2.snap | 2 + ...flectapi_struct_one_basic_field_u32-2.snap | 1 + ...ts__basic__reflectapi_struct_option-2.snap | 1 + ...sts__basic__reflectapi_struct_tuple-2.snap | 1 + ..._basic__reflectapi_struct_unit_type-2.snap | 1 + ...tapi_struct_with_additional_derives-2.snap | 1 + ...ruct_with_all_primitive_type_fields-2.snap | 1 + ...__basic__reflectapi_struct_with_arc-2.snap | 1 + ...ectapi_struct_with_arc_pointer_only-2.snap | 1 + ...i_struct_with_attributes_input_only-2.snap | 1 + ..._struct_with_attributes_output_only-2.snap | 1 + ...with_external_generic_type_fallback-2.snap | 1 + ...ectapi_struct_with_fixed_size_array-2.snap | 1 + ...sic__reflectapi_struct_with_hashmap-2.snap | 1 + ...eflectapi_struct_with_hashset_field-2.snap | 1 + ...i_struct_with_hashset_field_generic-2.snap | 1 + ...asic__reflectapi_struct_with_nested-2.snap | 1 + ...lectapi_struct_with_nested_external-2.snap | 2 + ...reflectapi_struct_with_self_via_arc-2.snap | 1 + ...__reflectapi_struct_with_skip_field-2.snap | 1 + ...ectapi_struct_with_skip_field_input-2.snap | 2 + ...ctapi_struct_with_skip_field_output-2.snap | 2 + ...lectapi_struct_with_transform_array-2.snap | 1 + ...flectapi_struct_with_transform_both-2.snap | 1 + ...tapi_struct_with_transform_fallback-2.snap | 1 + ...ruct_with_transform_fallback_nested-2.snap | 1 + ...lectapi_struct_with_transform_input-2.snap | 2 + ...ectapi_struct_with_transform_output-2.snap | 2 + ...basic__reflectapi_struct_with_tuple-2.snap | 1 + ...sic__reflectapi_struct_with_tuple12-2.snap | 1 + ...__basic__reflectapi_struct_with_vec-2.snap | 1 + ...reflectapi_struct_with_vec_external-2.snap | 2 + ...__reflectapi_struct_with_vec_nested-2.snap | 2 + ...sic__reflectapi_struct_with_vec_two-2.snap | 1 + ...reflectapi_demo__tests__enums__enum-2.snap | 1 + ...tapi_demo__tests__enums__enum_empty-2.snap | 1 + ...demo__tests__enums__enum_rename_num-2.snap | 1 + ...variant_and_fields_and_named_fields-2.snap | 1 + ...num_with_discriminant_ignored_input-2.snap | 1 + ...um_with_discriminant_ignored_output-2.snap | 1 + ...enums__enum_with_discriminant_input-2.snap | 1 + ...nums__enum_with_discriminant_output-2.snap | 1 + ..._enum_with_empty_variant_and_fields-2.snap | 1 + ...emo__tests__enums__enum_with_fields-2.snap | 1 + ...o__tests__enums__enum_with_generics-2.snap | 1 + ...nums__enum_with_generics_and_fields-2.snap | 1 + ...enerics_and_fields_and_named_fields-2.snap | 1 + ...lly_tagged_enum_with_tuple_variants-2.snap | 1 + ...ally_tagged_enum_with_unit_variants-2.snap | 1 + ...ics__struct_with_circular_reference-2.snap | 1 + ...uct_with_circular_reference_generic-2.snap | 1 + ...h_circular_reference_generic_parent-2.snap | 1 + ...cular_reference_generic_without_box-2.snap | 1 + ...eference_generic_without_box_parent-2.snap | 1 + ...generic_without_box_parent_specific-2.snap | 1 + ...__struct_with_nested_generic_struct-2.snap | 1 + ...ct_with_nested_generic_struct_twice-2.snap | 1 + ...enerics__struct_with_simple_generic-2.snap | 1 + ...__generics__struct_with_vec_generic-2.snap | 1 + ...cs__struct_with_vec_generic_generic-2.snap | 1 + ...ct_with_vec_generic_generic_generic-2.snap | 1 + ...tests__namespace__conflicting_names-2.snap | 1 + ...amespace__generic_and_type_conflict-2.snap | 2 + ...adj_repr_enum_with_untagged_variant-2.snap | 1 + ...ectapi_demo__tests__serde__datetime-2.snap | 2 + ...e__empty_variants_adjacently_tagged-2.snap | 1 + ...e__empty_variants_externally_tagged-2.snap | 1 + ...e__empty_variants_internally_tagged-2.snap | 1 + ...sts__serde__empty_variants_untagged-2.snap | 1 + ...api_demo__tests__serde__enum_rename-2.snap | 1 + ...demo__tests__serde__enum_rename_all-2.snap | 1 + ...__serde__enum_rename_all_on_variant-2.snap | 1 + ...s__serde__enum_rename_variant_field-2.snap | 1 + ...ectapi_demo__tests__serde__enum_tag-2.snap | 1 + ...emo__tests__serde__enum_tag_content-2.snap | 1 + ..._serde__enum_tag_content_rename_all-2.snap | 1 + ...i_demo__tests__serde__enum_untagged-2.snap | 1 + ..._tests__serde__enum_with_field_skip-2.snap | 1 + ...__enum_with_rename_to_invalid_chars-2.snap | 1 + ...sts__serde__enum_with_variant_other-2.snap | 2 + ...ests__serde__enum_with_variant_skip-2.snap | 1 + ..._enum_with_variant_skip_deserialize-2.snap | 2 + ...e__enum_with_variant_skip_serialize-2.snap | 2 + ...__serde__enum_with_variant_untagged-2.snap | 1 + ..._demo__tests__serde__external_impls-2.snap | 1 + ...s__serde__flatten_internally_tagged-2.snap | 1 + ...pi_demo__tests__serde__flatten_unit-2.snap | 1 + ...tapi_demo__tests__serde__kebab_case-2.snap | 1 + ...rde__nested_internally_tagged_enums-2.snap | 1 + ...ted_internally_tagged_enums_minimal-2.snap | 1 + ..._newtype_variants_adjacently_tagged-2.snap | 1 + ..._newtype_variants_externally_tagged-2.snap | 1 + ..._newtype_variants_internally_tagged-2.snap | 1 + ...api_demo__tests__serde__struct_from-2.snap | 1 + ...api_demo__tests__serde__struct_into-2.snap | 1 + ...i_demo__tests__serde__struct_rename-2.snap | 1 + ...mo__tests__serde__struct_rename_all-2.snap | 1 + ...erde__struct_rename_all_differently-2.snap | 2 + ...erde__struct_rename_all_pascal_case-2.snap | 1 + ...s__serde__struct_rename_differently-2.snap | 1 + ...__tests__serde__struct_rename_field-2.snap | 2 + ...repr_transparent_generic_inner_type-2.snap | 1 + ...demo__tests__serde__struct_try_from-2.snap | 1 + ...__tests__serde__struct_with_flatten-2.snap | 1 + ...serde__struct_with_flatten_optional-2.snap | 1 + ..._with_flatten_optional_and_required-2.snap | 1 + ...struct_with_rename_to_invalid_chars-2.snap | 1 + ...e__struct_with_rename_to_kebab_case-2.snap | 1 + ...s__serde__struct_with_serde_default-2.snap | 2 + ...ests__serde__struct_with_serde_skip-2.snap | 1 + ..._struct_with_serde_skip_deserialize-2.snap | 2 + ...e__struct_with_serde_skip_serialize-2.snap | 2 + ...struct_with_serde_skip_serialize_if-2.snap | 2 + ...ectapi_demo__tests__serde__timezone-2.snap | 1 + ...api_demo__tests__serde__unit_struct-2.snap | 1 + ...mo__tests__serde__unit_tuple_struct-2.snap | 1 + reflectapi/src/codegen/python.rs | 112 ++++++++---------- reflectapi/src/codegen/typescript.rs | 22 ++-- 129 files changed, 212 insertions(+), 69 deletions(-) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap index ee5f07e0..7e8c893c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap index 0c60e3f9..73a2cee5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap index f9cbea5d..031e108b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-2.snap @@ -35,12 +35,14 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { export namespace input { export type TestEnumWithSkipVariant = "A" | "I"; } + export namespace output { export type TestEnumWithSkipVariant = "A" | "O"; } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap index 9d11ef49..7146ac03 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap index 5462397a..4d0a5287 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap index 47a89000..2d2138fb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap index 4cd72b27..eacbb4ed 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap index ffabf2ec..9459c5f1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap index 74bee317..6d0e5f4b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap index 197da752..7fe1f8a1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap index 2e791642..4cfc3eb3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap index f531d413..7eb0f0ba 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { _f: number /* i32 */; } } + export namespace output { export interface TestStructOneBasicFieldStringReflectBothDifferently { _f: number /* u32 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap index d9949203..2011e6ce 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap index 4470b6d7..592b8a3f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap index a42d5ecc..66f7b5c7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap index 2a7c7350..ca003442 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap index 321e8ec2..29daacc4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap index 9b4106cc..8f68b3cc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap index 64f1d015..e1c1e224 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap index 67d57a6f..2f612c93 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap index 5ad58a18..93b031fc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap index e68cc50d..d155d78e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap index 0a3ccdbc..f74d5a9b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap index 13ca76f3..c0467e14 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap index b8ef9662..829106bd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap index db66e9c4..2c4f6f94 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap index da8c2758..fee6d3e0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap index 7a04fbd3..a88890a0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap index 7f918f6f..2f3c32b1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -42,6 +43,7 @@ export namespace reflectapi_demo { _f: reflectapi_demo.tests.test_lib.TestStructNested; } } + export namespace test_lib { export interface TestStructNested { _f: string; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap index aa400c67..f64577ec 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap index 8b1b3949..52e5ed2d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap index aa5ebf6a..8e2e3133 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-2.snap @@ -35,12 +35,14 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { export namespace input { export interface TestStructWithSkipFieldInput {} } + export namespace output { export interface TestStructWithSkipFieldInput { _f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap index 9c5658f1..05ed8c74 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } + export namespace output { export interface TestStructWithSkipFieldOutput {} } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap index 3ed1bd9d..085ab1f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap index abacc009..6fd77c8e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap index f6cbd3d2..25a4e8fe 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap index 23409b75..6528f9c3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap index 507571fc..8555a765 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } + export namespace output { export interface TestStructWithTransformInput { _f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap index 35e7ff4b..58a5fadf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } + export namespace output { export interface TestStructWithTransformOutput { _f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap index 309af969..9212ae0d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap index 97f799b3..1f13c6aa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap index a47d4fe2..f2c6b429 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap index 6b139484..9a2e89ef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -39,6 +40,7 @@ export namespace reflectapi_demo { _f: Array; } } + export namespace test_lib { export interface TestStructNested { _f: string; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap index a7d0f52a..0aebaea1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { @@ -39,6 +40,7 @@ export namespace reflectapi_demo { _f: Array>; } } + export namespace test_lib { export interface TestStructNested { _f: string; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap index 704697e6..6709d083 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace basic { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap index d89ab669..8f512421 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap index fef585cf..9c7b4fb1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap index c18473b4..a2d33efc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap index 64873227..571dc171 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap index 5ee29c34..9cf83303 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap index 725e0861..c659d5ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap index 708295eb..32a53360 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap index 51dab210..8b2c39ae 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap index eed75cde..3b76e37b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap index 0235bd03..8d820945 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap index 71893a54..e5c67b28 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap index 7b100c9d..97692607 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap index 777acde0..5763a1e6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap index 42692317..e733a731 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap index e63d661f..2772fe60 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace enums { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap index 29d1675a..ddc08b5d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap index 70e63eb7..65274429 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap index 6e8af7f4..b766bbcf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap index e51689d3..8fc6fb00 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-2.snap @@ -41,6 +41,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap index d787d84e..ac0eecf4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-2.snap @@ -41,6 +41,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap index cf132ee3..5a35c83a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap index 2c06b140..b9b64891 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap index 7d98ac6b..fe57144d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap index d2de121a..dd709c67 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap index b4d1df8a..045b047c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap index 02bf27c9..e3e18385 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap index 72676b8b..6f0b1430 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-2.snap @@ -34,6 +34,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace generics { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap index eb123790..0c0f49ca 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__conflicting_names-2.snap @@ -28,6 +28,7 @@ export namespace __definition { export namespace foos { export interface Foo {} } + export namespace reflectapi { /** * Struct object with no fields diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap index 29c55740..eb874bcc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__namespace__generic_and_type_conflict-2.snap @@ -22,6 +22,7 @@ export namespace __definition { } } export type T = I; + export namespace reflectapi { /** * Struct object with no fields @@ -33,6 +34,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace namespace { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap index 4dfbcb0f..b9173123 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap index f3a29a9b..91e3e017 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -47,6 +48,7 @@ export namespace reflectapi_demo { } } } + export namespace std { export namespace time { /** diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap index b32b6a53..63f40bab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap index 7df2e1b9..cefd5f83 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap index 3b0803ad..92aac684 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap index c45180d3..47a07a94 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap index 4e1ef829..2d379a61 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap index fce67c4d..a3209285 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap index 5d310fb4..937e5588 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap index ed272ff7..d768729b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap index 953a73ec..1838565d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap index 01545f20..22db705c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap index 7c77ac4a..b58f6e88 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap index a9c252a9..a7a877e4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap index b0596d03..82b81991 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap index aac5d851..27e9f310 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap index 6682bfe7..6df45152 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-2.snap @@ -35,12 +35,14 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export type TestEnumWithVariantOther = { type: "V0" }; } + export namespace output { export type TestEnumWithVariantOther = | { type: "V0" } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap index e9bbe858..7dc8d81c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap index 31bc8e67..ce8bc0c1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-2.snap @@ -35,12 +35,14 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export type TestEnumWithVariantSkipDeserialize = never; } + export namespace output { export type TestEnumWithVariantSkipDeserialize = "_Variant1"; } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap index 1fb057ab..209d6a21 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-2.snap @@ -35,12 +35,14 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export type TestEnumWithVariantSkipSerialize = "Variant1"; } + export namespace output { export type TestEnumWithVariantSkipSerialize = never; } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap index c4a440b1..dce10692 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap index 988adc1c..5b7f01e1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap index 9de56b91..11ff2fe1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap index 26c64c80..900babad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap index a308eb91..6df8eafa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap index d37a9a06..0bea7ce8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap index da2fa8cf..ff7e9fe3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap index a6dc9747..4877ee47 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap index ac5338da..f24252fc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap index 1d14449c..818298af 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap index c2cee6cb..1dfe57e6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap index ac457765..bb37aafa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap index 36f76a07..b5059218 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap index b116f42b..0fd2228f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap index ae151db1..21c5b58a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { field_name: number /* u8 */; } } + export namespace output { export interface TestStructRenameAllDifferently { fieldName: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap index aafbe0ae..863ad32d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap index 9f6474af..6e80e1e8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap index 9f765e59..0321b396 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { fieldName: number /* u8 */; } } + export namespace output { export interface TestStructRenameField { field_name: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap index 9597cd2d..1dd2d581 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap index 1b86ba27..42219024 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap index 98f17a26..2a8f5d6d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap index c33cfb6b..b7a85754 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap index 8bbc2784..a9cf69cf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap index b1e16fd8..0b1b7f28 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap index 592a4ed4..042eadaf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap index a902f818..5d8d3c1d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { f?: number /* u8 */; } } + export namespace output { export interface TestStructWithSerdeDefault { f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap index a4b4b413..a6467587 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap index 396866a4..fce8259e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-2.snap @@ -35,12 +35,14 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { export namespace input { export interface TestStructWithSerdeSkipDeserialize {} } + export namespace output { export interface TestStructWithSerdeSkipDeserialize { f: number /* u8 */; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap index 6ad0080e..ed52289a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { _f: number /* u8 */; } } + export namespace output { export interface TestStructWithSerdeSkipSerialize {} } diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap index 529d764e..2a24cfe6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-2.snap @@ -35,6 +35,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { @@ -43,6 +44,7 @@ export namespace reflectapi_demo { f: number /* u8 */ | null; } } + export namespace output { export interface TestStructWithSerdeSkipSerializeIf { f?: number /* u8 */ | null; diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap index ade664ab..d7f04c8d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap index 88d5242e..5a388f22 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap index d5441ab7..4d4fa641 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-2.snap @@ -32,6 +32,7 @@ export namespace reflectapi { */ export interface Infallible {} } + export namespace reflectapi_demo { export namespace tests { export namespace serde { diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 5e45cb2c..ed4e10cf 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -4608,7 +4608,7 @@ pub mod templates { } writeln!(s).unwrap(); for type_var in &self.global_type_vars { - writeln!(s, "{} = TypeVar('{}')", type_var, type_var).unwrap(); + writeln!(s, "{type_var} = TypeVar('{type_var}')").unwrap(); } writeln!(s).unwrap(); s @@ -4635,7 +4635,7 @@ pub mod templates { } if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { writeln!(s, " \"\"\"Generated data model.\"\"\"").unwrap(); } @@ -4656,29 +4656,26 @@ pub mod templates { if let Some(default) = &field.default_value { write!( s, - "(default={}, serialization_alias='{}', validation_alias='{}')", - default, alias, alias + "(default={default}, serialization_alias='{alias}', validation_alias='{alias}')" ) .unwrap(); } else if field.optional { write!( s, - "(default=None, serialization_alias='{}', validation_alias='{}')", - alias, alias + "(default=None, serialization_alias='{alias}', validation_alias='{alias}')" ) .unwrap(); } else { write!( s, - "(serialization_alias='{}', validation_alias='{}')", - alias, alias + "(serialization_alias='{alias}', validation_alias='{alias}')" ) .unwrap(); } } else if field.optional { write!(s, " = None").unwrap(); } else if let Some(default) = &field.default_value { - write!(s, " = {}", default).unwrap(); + write!(s, " = {default}").unwrap(); } writeln!(s).unwrap(); } @@ -4699,7 +4696,7 @@ pub mod templates { writeln!(s, "class {}(str, Enum):", self.name).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { writeln!(s, " \"\"\"Generated enum.\"\"\"").unwrap(); } @@ -4738,14 +4735,14 @@ pub mod templates { let base = if self.is_int_enum { "IntEnum" } else { "Enum" }; writeln!(s, "class {}({}):", self.name, base).unwrap(); if let Some(desc) = &self.description { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); } for variant in &self.variants { writeln!(s).unwrap(); writeln!(s, " {} = {}", variant.name, variant.value).unwrap(); if let Some(desc) = &variant.description { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } writeln!(s).unwrap(); } @@ -4774,7 +4771,7 @@ pub mod templates { .description .as_deref() .unwrap_or("Generated discriminated union type."); - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); writeln!(s, " @classmethod").unwrap(); writeln!(s, " def __class_getitem__(cls, params):").unwrap(); @@ -4804,7 +4801,7 @@ pub mod templates { .iter() .map(|v| { let param_exprs: Vec = (0..self.generic_params.len()) - .map(|i| format!("params[{}]", i)) + .map(|i| format!("params[{i}]")) .collect(); format!("{}[{}]", v.base_name, param_exprs.join(", ")) }) @@ -4838,7 +4835,7 @@ pub mod templates { if !self.is_generic { if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } } } @@ -4864,7 +4861,7 @@ pub mod templates { writeln!(s, "{} = Union[{}]", self.name, type_annotations.join(", ")).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } } writeln!(s).unwrap(); @@ -4919,7 +4916,7 @@ pub mod templates { writeln!(s, " def __init__(").unwrap(); writeln!(s, " self,").unwrap(); if let Some(base_url) = &self.base_url { - writeln!(s, " base_url: str = \"{}\",", base_url).unwrap(); + writeln!(s, " base_url: str = \"{base_url}\",").unwrap(); } else { writeln!(s, " base_url: str,").unwrap(); } @@ -4975,7 +4972,7 @@ pub mod templates { writeln!(s, " def __init__(").unwrap(); writeln!(s, " self,").unwrap(); if let Some(base_url) = &self.base_url { - writeln!(s, " base_url: str = \"{}\",", base_url).unwrap(); + writeln!(s, " base_url: str = \"{base_url}\",").unwrap(); } else { writeln!(s, " base_url: str,").unwrap(); } @@ -5026,13 +5023,13 @@ pub mod templates { writeln!(s, " data: Optional[{}] = None,", function.input_type).unwrap(); } if let Some(headers_type) = &function.headers_type { - writeln!(s, " headers: Optional[{}] = None,", headers_type).unwrap(); + writeln!(s, " headers: Optional[{headers_type}] = None,").unwrap(); } writeln!(s, " ) -> ApiResponse[{}]:", function.output_type).unwrap(); // Docstring let desc = function.description.as_deref().unwrap_or(""); - write!(s, " \"\"\"{}", desc).unwrap(); + write!(s, " \"\"\"{desc}").unwrap(); if function.has_body || !function.path_params.is_empty() { writeln!(s).unwrap(); writeln!(s).unwrap(); @@ -5064,7 +5061,7 @@ pub mod templates { if let Some(dep_note) = &function.deprecation_note { writeln!(s).unwrap(); writeln!(s, " .. deprecated::").unwrap(); - writeln!(s, " {}", dep_note).unwrap(); + writeln!(s, " {dep_note}").unwrap(); } writeln!(s, " \"\"\"").unwrap(); @@ -5077,12 +5074,12 @@ pub mod templates { &function.name }; let warn_msg = if dep_note.is_empty() { - format!("{} is deprecated", warn_name) + format!("{warn_name} is deprecated") } else { - format!("{} is deprecated: {}", warn_name, dep_note) + format!("{warn_name} is deprecated: {dep_note}") }; writeln!(s, " warnings.warn(").unwrap(); - writeln!(s, " \"{}\",", warn_msg).unwrap(); + writeln!(s, " \"{warn_msg}\",").unwrap(); writeln!(s, " DeprecationWarning,").unwrap(); writeln!(s, " stacklevel=2,").unwrap(); writeln!(s, " )").unwrap(); @@ -5127,9 +5124,9 @@ pub mod templates { let client_prefix = if is_group { "self._client." } else { "self." }; if is_async { - writeln!(s, " return await {}_make_request(", client_prefix).unwrap(); + writeln!(s, " return await {client_prefix}_make_request(").unwrap(); } else { - writeln!(s, " return {}_make_request(", client_prefix).unwrap(); + writeln!(s, " return {client_prefix}_make_request(").unwrap(); } writeln!(s, " \"{}\",", function.method).unwrap(); writeln!(s, " path,").unwrap(); @@ -5175,8 +5172,7 @@ pub mod templates { .unwrap(); writeln!( s, - " \"\"\"Create a mock ApiResponse for {}.\"\"\"", - type_name + " \"\"\"Create a mock ApiResponse for {type_name}.\"\"\"" ) .unwrap(); writeln!(s, " return create_api_response(value)").unwrap(); @@ -5264,7 +5260,7 @@ pub mod templates { writeln!(s, "class {}(BaseModel):", self.name).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { writeln!( s, @@ -5314,7 +5310,7 @@ pub mod templates { writeln!(s, "class {}(BaseModel):", self.name).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { writeln!( s, @@ -5335,7 +5331,7 @@ pub mod templates { for field in &self.fields { write!(s, " {}: {}", field.name, field.type_annotation).unwrap(); if let Some(default) = &field.default_value { - write!(s, " = {}", default).unwrap(); + write!(s, " = {default}").unwrap(); } else if field.optional { write!(s, " = None").unwrap(); } @@ -5381,7 +5377,7 @@ pub mod templates { writeln!(s, "class {}(BaseModel):", self.name).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { writeln!( s, @@ -5401,7 +5397,7 @@ pub mod templates { for field in &self.fields { write!(s, " {}: {}", field.name, field.type_annotation).unwrap(); if let Some(default) = &field.default_value { - write!(s, " = {}", default).unwrap(); + write!(s, " = {default}").unwrap(); } else if field.optional { write!(s, " = None").unwrap(); } @@ -5454,7 +5450,7 @@ pub mod templates { pub fn render(&self) -> String { let mut s = String::new(); for variant_def in &self.variant_definitions { - writeln!(s, "{}", variant_def).unwrap(); + writeln!(s, "{variant_def}").unwrap(); writeln!(s).unwrap(); } writeln!( @@ -5466,7 +5462,7 @@ pub mod templates { .unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } } writeln!(s).unwrap(); @@ -5493,20 +5489,20 @@ pub mod templates { writeln!(s, "from typing import Union, Optional").unwrap(); writeln!(s).unwrap(); for data_class in &self.data_classes { - write!(s, "{}", data_class).unwrap(); + write!(s, "{data_class}").unwrap(); writeln!(s).unwrap(); } writeln!(s, "class {}(str, Enum):", self.enum_name).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } } writeln!(s, " # Unit variants as enum members").unwrap(); for variant in &self.unit_variants { write!(s, " {} = \"{}\"", variant.name, variant.value).unwrap(); if let Some(desc) = &variant.description { - write!(s, " # {}", desc).unwrap(); + write!(s, " # {desc}").unwrap(); } writeln!(s).unwrap(); } @@ -5519,7 +5515,7 @@ pub mod templates { .unwrap(); writeln!(s, " return self.value").unwrap(); for method in &self.factory_methods { - write!(s, "{}", method).unwrap(); + write!(s, "{method}").unwrap(); writeln!(s).unwrap(); } writeln!(s).unwrap(); @@ -5550,11 +5546,11 @@ pub mod templates { writeln!(s, "class {}:", self.name).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } } for field_type in &self.field_types { - writeln!(s, " {}", field_type).unwrap(); + writeln!(s, " {field_type}").unwrap(); } writeln!(s).unwrap(); writeln!(s, " def model_dump(self) -> dict:").unwrap(); @@ -5566,7 +5562,7 @@ pub mod templates { let field_refs: Vec = self .field_names .iter() - .map(|f| format!("self.{}", f)) + .map(|f| format!("self.{f}")) .collect(); writeln!(s, " fields = [{}]", field_refs.join(", ")).unwrap(); writeln!(s, " return {{\"{}\": fields}}", self.variant_name).unwrap(); @@ -5594,11 +5590,11 @@ pub mod templates { writeln!(s, "class {}:", self.name).unwrap(); if let Some(desc) = &self.description { if !desc.is_empty() { - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } } for field_def in &self.field_definitions { - writeln!(s, " {}", field_def).unwrap(); + writeln!(s, " {field_def}").unwrap(); } writeln!(s).unwrap(); writeln!(s, " def model_dump(self) -> dict:").unwrap(); @@ -5611,16 +5607,10 @@ pub mod templates { for field_name in &self.field_names { writeln!( s, - " if hasattr(self, '{}') and self.{} is not None:", - field_name, field_name - ) - .unwrap(); - writeln!( - s, - " result['{}'] = self.{}", - field_name, field_name + " if hasattr(self, '{field_name}') and self.{field_name} is not None:" ) .unwrap(); + writeln!(s, " result['{field_name}'] = self.{field_name}").unwrap(); } writeln!(s, " return {{\"{}\": result}}", self.variant_name).unwrap(); writeln!(s).unwrap(); @@ -5662,12 +5652,12 @@ pub mod templates { if self.is_generic { writeln!(s, "# TypeVar definitions for {}", self.union_name).unwrap(); for param in &self.generic_params { - writeln!(s, "{} = TypeVar('{}')", param, param).unwrap(); + writeln!(s, "{param} = TypeVar('{param}')").unwrap(); } writeln!(s).unwrap(); } for variant_model in &self.variant_models { - writeln!(s, "{}", variant_model).unwrap(); + writeln!(s, "{variant_model}").unwrap(); writeln!(s).unwrap(); } writeln!(s).unwrap(); @@ -5680,7 +5670,7 @@ pub mod templates { ) .unwrap(); if let Some(desc) = &self.description { - writeln!(s, "\"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } s } @@ -5704,7 +5694,7 @@ pub mod templates { pub fn render(&self) -> String { let mut s = String::new(); for variant_model in &self.variant_models { - writeln!(s, "{}", variant_model).unwrap(); + writeln!(s, "{variant_model}").unwrap(); writeln!(s).unwrap(); } writeln!(s).unwrap(); @@ -5730,7 +5720,7 @@ pub mod templates { .description .as_deref() .unwrap_or("Externally tagged enum"); - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); if self.is_generic { writeln!(s, " @classmethod").unwrap(); @@ -5809,7 +5799,7 @@ pub mod templates { ) .unwrap(); for param in &self.generic_params { - writeln!(s, "{} = TypeVar('{}')", param, param).unwrap(); + writeln!(s, "{param} = TypeVar('{param}')").unwrap(); } writeln!(s).unwrap(); writeln!(s, "# Common non-generic base class with discriminator").unwrap(); @@ -5823,7 +5813,7 @@ pub mod templates { writeln!(s, " _kind: str = PrivateAttr()").unwrap(); writeln!(s).unwrap(); for variant_model in &self.variant_models { - writeln!(s, "{}", variant_model).unwrap(); + writeln!(s, "{variant_model}").unwrap(); writeln!(s).unwrap(); } writeln!(s).unwrap(); @@ -5844,7 +5834,7 @@ pub mod templates { .description .as_deref() .unwrap_or("Generic externally tagged enum using Approach B"); - writeln!(s, " \"\"\"{}", desc).unwrap(); + writeln!(s, " \"\"\"{desc}").unwrap(); writeln!(s).unwrap(); writeln!( s, @@ -5939,7 +5929,7 @@ pub mod templates { .description .as_deref() .unwrap_or("Externally tagged enum"); - writeln!(s, " \"\"\"{}\"\"\"", desc).unwrap(); + writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); writeln!(s, " @model_validator(mode='before')").unwrap(); writeln!(s, " @classmethod").unwrap(); diff --git a/reflectapi/src/codegen/typescript.rs b/reflectapi/src/codegen/typescript.rs index e173aa21..c396bd33 100644 --- a/reflectapi/src/codegen/typescript.rs +++ b/reflectapi/src/codegen/typescript.rs @@ -270,8 +270,7 @@ mod templates { pub fn render(&self) -> String { let mut out = String::new(); if !self.name.is_empty() && !self.is_empty() { - write!(out, "\nexport namespace {} {{", self.name.replace('-', "_")) - .unwrap(); + write!(out, "\nexport namespace {} {{", self.name.replace('-', "_")).unwrap(); } for t in &self.types { write!(out, "\n{t}").unwrap(); @@ -347,10 +346,7 @@ mod templates { impl Enum { pub fn render(&self) -> anyhow::Result { - let mut out = format!( - "\n{}export type {} =", - self.description, self.name, - ); + let mut out = format!("\n{}export type {} =", self.description, self.name,); for variant in &self.variants { write!(out, "\n {}", variant.render()?).unwrap(); } @@ -567,9 +563,19 @@ mod templates { if self.is_unnamed() { format!("{}{}", self.description, self.type_) } else if self.optional { - format!("{}{}?: {}", self.description, self.normalized_name(), self.type_) + format!( + "{}{}?: {}", + self.description, + self.normalized_name(), + self.type_ + ) } else { - format!("{}{}: {}", self.description, self.normalized_name(), self.type_) + format!( + "{}{}: {}", + self.description, + self.normalized_name(), + self.type_ + ) } } } From a7ea9d98ec6c2ac83ff742e2704ad3ccbd0777a2 Mon Sep 17 00:00:00 2001 From: Andrey Konstantinov Date: Fri, 27 Mar 2026 02:16:08 +0000 Subject: [PATCH 04/47] fix CI issues --- docs/book.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/book.toml b/docs/book.toml index 58a0a67a..ddd306bb 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -5,10 +5,6 @@ src = "src" title = "ReflectAPI Documentation" description = "Code-first Rust web service API declaration and client generation" -[serve] -address = "0.0.0.0" -port = 3000 - [preprocessor.links] [output.html] From 86c00edfb87814472701f739802f965cf024c38a Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Fri, 27 Mar 2026 15:49:26 +1300 Subject: [PATCH 05/47] feat(schema): add semantic IR and symbol ID infrastructure Add SymbolId system, semantic IR types, ID assignment, and normalization pipeline to reflectapi-schema. This provides stable, unique identifiers for all schema symbols and a multi-stage pipeline for transforming raw schemas into validated semantic representations. New modules: - symbol.rs: SymbolId/SymbolKind types with stable identifiers - ids.rs: ensure_symbol_ids() for post-deserialization ID assignment - semantic.rs: Immutable semantic IR (SemanticSchema, SymbolTable, etc.) - normalize.rs: TypeConsolidation, NamingResolution, CircularDependency detection stages, and Normalizer (Schema -> SemanticSchema) Schema type changes: - Added id: SymbolId field to Schema, Function, Primitive, Struct, Field, Enum, Variant (serde skip_serializing, backward compatible) - Manual PartialEq/Hash impls exclude id from comparisons - PartialEq + Eq added to SerializationMode, Copy to SymbolKind Addresses #96, lays groundwork for #123. --- reflectapi-derive/src/derive.rs | 2 + reflectapi-derive/src/tokenizable_schema.rs | 5 + reflectapi-schema/src/ids.rs | 173 +++ reflectapi-schema/src/lib.rs | 124 +- reflectapi-schema/src/normalize.rs | 1533 +++++++++++++++++++ reflectapi-schema/src/semantic.rs | 440 ++++++ reflectapi-schema/src/symbol.rs | 184 +++ reflectapi/src/builder/handler.rs | 1 + reflectapi/src/codegen/openapi.rs | 2 + reflectapi/src/traits.rs | 1 + 10 files changed, 2459 insertions(+), 6 deletions(-) create mode 100644 reflectapi-schema/src/ids.rs create mode 100644 reflectapi-schema/src/normalize.rs create mode 100644 reflectapi-schema/src/semantic.rs create mode 100644 reflectapi-schema/src/symbol.rs diff --git a/reflectapi-derive/src/derive.rs b/reflectapi-derive/src/derive.rs index bace5ff3..9bb83825 100644 --- a/reflectapi-derive/src/derive.rs +++ b/reflectapi-derive/src/derive.rs @@ -170,6 +170,7 @@ fn visit_type(cx: &Context, container: &ast::Container<'_>) -> Type { codegen_config: reflectapi_schema::LanguageSpecificTypeCodegenConfig, ) -> Struct { Struct { + id: Default::default(), name: type_def_name, serde_name, description: type_def_description, @@ -384,6 +385,7 @@ fn visit_variant( }; Variant { + id: Default::default(), name: variant_def_name, serde_name, description: parse_doc_attributes(&variant.original.attrs), diff --git a/reflectapi-derive/src/tokenizable_schema.rs b/reflectapi-derive/src/tokenizable_schema.rs index 69b99ea9..c52674d5 100644 --- a/reflectapi-derive/src/tokenizable_schema.rs +++ b/reflectapi-derive/src/tokenizable_schema.rs @@ -117,6 +117,7 @@ impl ToTokens for TokenizableField<'_> { } tokens.extend(quote::quote! { reflectapi::Field { + id: Default::default(), name: #name.into(), serde_name: #serde_name.into(), description: #description.into(), @@ -168,6 +169,7 @@ impl ToTokens for TokenizableVariant<'_> { let untagged = self.inner.untagged; tokens.extend(quote::quote! { reflectapi::Variant { + id: Default::default(), name: #name.into(), serde_name: #serde_name.into(), description: #description.into(), @@ -239,6 +241,7 @@ impl ToTokens for TokenizableEnum<'_> { TokenizableLanguageSpecificTypeCodegenConfig(&self.inner.codegen_config); tokens.extend(quote::quote! { reflectapi::Enum { + id: Default::default(), name: #name.into(), serde_name: #serde_name.into(), description: #description.into(), @@ -313,6 +316,7 @@ impl ToTokens for TokenizableStruct<'_> { TokenizableLanguageSpecificTypeCodegenConfig(&self.inner.codegen_config); tokens.extend(quote::quote! { reflectapi::Struct { + id: Default::default(), name: #name.into(), serde_name: #serde_name.into(), description: #description.into(), @@ -347,6 +351,7 @@ impl ToTokens for TokenizablePrimitive<'_> { .map(TokenizableTypeReference::new); tokens.extend(quote::quote! { reflectapi::Primitive { + id: Default::default(), name: #name.into(), description: #description.into(), parameters: vec![#(#parameters),*], diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs new file mode 100644 index 00000000..ce74f3a4 --- /dev/null +++ b/reflectapi-schema/src/ids.rs @@ -0,0 +1,173 @@ +/// ID assignment utilities for ensuring unique, stable SymbolIds before normalization +/// +/// This module fixes the core issue where JSON-deserialized schemas have default +/// SymbolIds that cause conflicts during normalization discovery. +use crate::symbol::STDLIB_TYPES; +use crate::{Enum, Schema, Struct, SymbolId, SymbolKind, Type, Typespace}; +use std::collections::HashMap; + +/// Ensure all symbols in the schema have unique, stable IDs based on their canonical names +pub fn ensure_symbol_ids(schema: &mut Schema) { + if schema.id.is_unknown() { + schema.id = SymbolId::new(SymbolKind::Struct, vec![schema.name.clone()]); + } + + let mut seen: HashMap = HashMap::new(); + register_stdlib_types(&mut seen); + + for function in &mut schema.functions { + if function.id.is_unknown() { + function.id = SymbolId::new(SymbolKind::Endpoint, vec![function.name.clone()]); + } + } + + assign_typespace_ids(&mut schema.input_types, &mut seen); + assign_typespace_ids(&mut schema.output_types, &mut seen); +} + +/// Pre-register well-known stdlib types that might be referenced but not always defined +fn register_stdlib_types(seen: &mut HashMap) { + for &(name, kind) in STDLIB_TYPES { + seen.entry(name.to_string()) + .or_insert_with(|| SymbolId::new(kind, split_path(name))); + } +} + +/// Assign IDs to all types in a typespace +fn assign_typespace_ids(typespace: &mut Typespace, seen: &mut HashMap) { + let mut new_typespace = Typespace::new(); + + for ty in typespace.types() { + let mut updated_type = ty.clone(); + let type_name = updated_type.name().to_string(); + assign_type_id(&type_name, &mut updated_type, seen); + new_typespace.insert_type(updated_type); + } + + *typespace = new_typespace; +} + +/// Assign a unique ID to a type and its nested members +fn assign_type_id(fqn: &str, ty: &mut Type, seen: &mut HashMap) { + let id = seen + .entry(fqn.to_string()) + .or_insert_with(|| { + let kind = match ty { + Type::Primitive(_) => SymbolKind::Primitive, + Type::Struct(_) => SymbolKind::Struct, + Type::Enum(_) => SymbolKind::Enum, + }; + SymbolId::new(kind, split_path(fqn)) + }) + .clone(); + + match ty { + Type::Primitive(p) => { + if p.id.is_unknown() { + p.id = id; + } + } + Type::Struct(s) => { + if s.id.is_unknown() { + s.id = id.clone(); + } + assign_struct_member_ids(s, &id); + } + Type::Enum(e) => { + if e.id.is_unknown() { + e.id = id.clone(); + } + assign_enum_member_ids(e, &id); + } + } +} + +/// Assign IDs to struct fields +fn assign_struct_member_ids(s: &mut Struct, owner: &SymbolId) { + match &mut s.fields { + crate::Fields::Named(fields) => { + for field in fields { + if field.id.is_unknown() { + let mut path = owner.path.clone(); + path.push(field.name.clone()); + field.id = SymbolId::new(SymbolKind::Field, path); + } + } + } + crate::Fields::Unnamed(fields) => { + for (i, field) in fields.iter_mut().enumerate() { + if field.id.is_unknown() { + let mut path = owner.path.clone(); + path.push(format!("arg{i}")); + field.id = SymbolId::new(SymbolKind::Field, path); + } + } + } + crate::Fields::None => {} + } +} + +/// Assign IDs to enum variants and their fields +fn assign_enum_member_ids(e: &mut Enum, owner: &SymbolId) { + for variant in &mut e.variants { + if variant.id.is_unknown() { + let mut path = owner.path.clone(); + path.push(variant.name.clone()); + variant.id = SymbolId::new(SymbolKind::Variant, path); + } + + match &mut variant.fields { + crate::Fields::Named(fields) => { + for field in fields { + if field.id.is_unknown() { + let mut path = variant.id.path.clone(); + path.push(field.name.clone()); + field.id = SymbolId::new(SymbolKind::Field, path); + } + } + } + crate::Fields::Unnamed(fields) => { + for (i, field) in fields.iter_mut().enumerate() { + if field.id.is_unknown() { + let mut path = variant.id.path.clone(); + path.push(format!("arg{i}")); + field.id = SymbolId::new(SymbolKind::Field, path); + } + } + } + crate::Fields::None => {} + } + } +} + +/// Split a fully-qualified name into path components +fn split_path(fqn: &str) -> Vec { + fqn.split("::").map(|s| s.to_string()).collect() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_split_path() { + assert_eq!( + split_path("std::option::Option"), + vec!["std", "option", "Option"] + ); + assert_eq!( + split_path("myapi::proto::Headers"), + vec!["myapi", "proto", "Headers"] + ); + assert_eq!(split_path("SimpleType"), vec!["SimpleType"]); + } + + #[test] + fn test_is_unknown() { + let unknown = SymbolId::default(); + assert!(unknown.is_unknown()); + + let known = SymbolId::new(SymbolKind::Struct, vec!["MyType".to_string()]); + assert!(!known.is_unknown()); + } +} diff --git a/reflectapi-schema/src/lib.rs b/reflectapi-schema/src/lib.rs index 63c23749..bb8423c9 100644 --- a/reflectapi-schema/src/lib.rs +++ b/reflectapi-schema/src/lib.rs @@ -1,11 +1,22 @@ mod codegen; +mod ids; mod internal; +mod normalize; mod rename; +mod semantic; mod subst; +mod symbol; mod visit; pub use self::codegen::*; +pub use self::ids::ensure_symbol_ids; +pub use self::normalize::{ + CircularDependencyResolutionStage, NamingResolutionStage, NormalizationError, + NormalizationPipeline, NormalizationStage, Normalizer, TypeConsolidationStage, +}; +pub use self::semantic::*; pub use self::subst::{mk_subst, Instantiate, Substitute}; +pub use self::symbol::{SymbolId, SymbolKind, STDLIB_TYPES, STDLIB_TYPE_PREFIXES}; pub use self::visit::{VisitMut, Visitor}; #[cfg(feature = "glob")] @@ -24,6 +35,9 @@ use std::{ #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct Schema { + #[serde(skip_serializing, default)] + pub id: SymbolId, + pub name: String, #[serde(skip_serializing_if = "String::is_empty", default)] @@ -48,6 +62,7 @@ impl Default for Schema { impl Schema { pub fn new() -> Self { Schema { + id: SymbolId::default(), name: String::new(), description: String::new(), functions: Vec::new(), @@ -86,6 +101,7 @@ impl Schema { pub fn extend(&mut self, other: Self) { let Self { + id: _, functions, input_types, output_types, @@ -404,6 +420,9 @@ impl Typespace { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct Function { + #[serde(skip_serializing, default)] + pub id: SymbolId, + /// Includes entity and action, for example: users.login pub name: String, /// URL mounting path, for example: /api/v1 @@ -449,7 +468,9 @@ pub struct Function { impl Function { pub fn new(name: String) -> Self { + let id = SymbolId::endpoint_id(vec![name.clone()]); Function { + id, name, deprecation_note: Default::default(), path: Default::default(), @@ -505,7 +526,7 @@ impl Function { } } -#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)] +#[derive(Debug, Default, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case")] pub enum SerializationMode { #[default] @@ -724,8 +745,11 @@ impl Type { } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq, Hash)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq)] pub struct Primitive { + #[serde(skip_serializing, default)] + pub id: SymbolId, + pub name: String, #[serde(skip_serializing_if = "String::is_empty", default)] pub description: String, @@ -746,7 +770,9 @@ impl Primitive { parameters: Vec, fallback: Option, ) -> Self { + let id = SymbolId::new(SymbolKind::Primitive, vec![name.clone()]); Primitive { + id, name, description, parameters, @@ -827,14 +853,35 @@ impl Primitive { } } +impl PartialEq for Primitive { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + && self.description == other.description + && self.parameters == other.parameters + && self.fallback == other.fallback + } +} + +impl std::hash::Hash for Primitive { + fn hash(&self, state: &mut H) { + self.name.hash(state); + self.description.hash(state); + self.parameters.hash(state); + self.fallback.hash(state); + } +} + impl From for Type { fn from(val: Primitive) -> Self { Type::Primitive(val) } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq)] pub struct Struct { + #[serde(skip_serializing, default)] + pub id: SymbolId, + /// Name of a struct, should be a valid Rust struct name identifier pub name: String, @@ -863,8 +910,11 @@ pub struct Struct { impl Struct { pub fn new(name: impl Into) -> Self { + let name = name.into(); + let id = SymbolId::struct_id(vec![name.clone()]); Struct { - name: name.into(), + id, + name, serde_name: Default::default(), description: Default::default(), parameters: Default::default(), @@ -934,6 +984,18 @@ impl Struct { } } +impl PartialEq for Struct { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + && self.serde_name == other.serde_name + && self.description == other.description + && self.parameters == other.parameters + && self.fields == other.fields + && self.transparent == other.transparent + && self.codegen_config == other.codegen_config + } +} + impl From for Type { fn from(val: Struct) -> Self { Type::Struct(val) @@ -1015,6 +1077,9 @@ impl IntoIterator for Fields { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq)] pub struct Field { + #[serde(skip_serializing, default)] + pub id: SymbolId, + /// Field name, should be a valid Rust field name identifier pub name: String, /// If a serialized name is not a valid Rust field name identifier @@ -1068,6 +1133,7 @@ impl PartialEq for Field { fn eq( &self, Self { + id: _, name, serde_name, description, @@ -1090,9 +1156,23 @@ impl PartialEq for Field { } } +impl std::hash::Hash for Field { + fn hash(&self, state: &mut H) { + self.name.hash(state); + self.serde_name.hash(state); + self.description.hash(state); + self.deprecation_note.hash(state); + self.type_ref.hash(state); + self.required.hash(state); + self.flattened.hash(state); + self.transform_callback.hash(state); + } +} + impl Field { pub fn new(name: String, type_ref: TypeReference) -> Self { Field { + id: SymbolId::default(), name, type_ref, serde_name: Default::default(), @@ -1167,8 +1247,11 @@ fn is_default(t: &T) -> bool { *t == Default::default() } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq)] pub struct Enum { + #[serde(skip_serializing, default)] + pub id: SymbolId, + pub name: String, #[serde(skip_serializing_if = "String::is_empty", default)] pub serde_name: String, @@ -1191,7 +1274,9 @@ pub struct Enum { impl Enum { pub fn new(name: String) -> Self { + let id = SymbolId::enum_id(vec![name.clone()]); Enum { + id, name, serde_name: Default::default(), description: Default::default(), @@ -1231,14 +1316,29 @@ impl Enum { } } +impl PartialEq for Enum { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + && self.serde_name == other.serde_name + && self.description == other.description + && self.parameters == other.parameters + && self.representation == other.representation + && self.variants == other.variants + && self.codegen_config == other.codegen_config + } +} + impl From for Type { fn from(val: Enum) -> Self { Type::Enum(val) } } -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq)] pub struct Variant { + #[serde(skip_serializing, default)] + pub id: SymbolId, + pub name: String, #[serde(skip_serializing_if = "String::is_empty", default)] pub serde_name: String, @@ -1257,6 +1357,7 @@ pub struct Variant { impl Variant { pub fn new(name: String) -> Self { Variant { + id: SymbolId::default(), name, serde_name: String::new(), description: String::new(), @@ -1295,6 +1396,17 @@ impl Variant { } } +impl PartialEq for Variant { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + && self.serde_name == other.serde_name + && self.description == other.description + && self.fields == other.fields + && self.discriminant == other.discriminant + && self.untagged == other.untagged + } +} + #[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq, Hash, Default)] #[serde(rename_all = "snake_case")] pub enum Representation { diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs new file mode 100644 index 00000000..6f6ff717 --- /dev/null +++ b/reflectapi-schema/src/normalize.rs @@ -0,0 +1,1533 @@ +/// Normalization pipeline for transforming raw schemas into semantic IRs +/// +/// This module provides the core normalization passes that transform +/// the raw reflectapi_schema types into validated, immutable semantic +/// representations with deterministic ordering and resolved dependencies. +use crate::symbol::{STDLIB_TYPES, STDLIB_TYPE_PREFIXES}; +use crate::{ + Enum, Field, FieldStyle, Fields, Function, Primitive, ResolvedTypeReference, Schema, + SemanticEnum, SemanticField, SemanticFunction, SemanticPrimitive, SemanticSchema, + SemanticStruct, SemanticType, SemanticTypeParameter, SemanticVariant, Struct, SymbolId, + SymbolInfo, SymbolKind, SymbolTable, Type, TypeReference, Variant, +}; +use std::collections::{BTreeMap, BTreeSet, HashMap}; + +/// Trait for individual normalization stages in the pipeline +pub trait NormalizationStage { + fn name(&self) -> &'static str; + fn transform(&self, schema: &mut Schema) -> Result<(), Vec>; +} + +/// Normalization pipeline that applies multiple stages in sequence +#[derive(Default)] +pub struct NormalizationPipeline { + stages: Vec>, +} + +impl NormalizationPipeline { + pub fn new() -> Self { + Self { stages: Vec::new() } + } + + pub fn add_stage(mut self, stage: S) -> Self { + self.stages.push(Box::new(stage)); + self + } + + pub fn run(&self, schema: &mut Schema) -> Result<(), Vec> { + for stage in &self.stages { + stage.transform(schema)?; + } + Ok(()) + } + + /// Create the standard normalization pipeline + pub fn standard() -> Self { + Self::new() + .add_stage(TypeConsolidationStage) + .add_stage(NamingResolutionStage) + .add_stage(CircularDependencyResolutionStage::new()) + } +} + +// --------------------------------------------------------------------------- +// Stage 1: Type Consolidation +// --------------------------------------------------------------------------- + +/// Merges input_types and output_types into a single unified types collection. +/// Handles naming conflicts by renaming types with prefixes. +pub struct TypeConsolidationStage; + +impl NormalizationStage for TypeConsolidationStage { + fn name(&self) -> &'static str { + "TypeConsolidation" + } + + fn transform(&self, schema: &mut Schema) -> Result<(), Vec> { + use crate::Typespace; + + let mut consolidated = Typespace::new(); + let mut name_conflicts = HashMap::new(); + + let mut input_type_names = HashMap::new(); + let mut output_type_names = HashMap::new(); + + for ty in schema.input_types.types() { + let simple_name = extract_simple_name(ty.name()); + input_type_names.insert(simple_name.clone(), ty.clone()); + + if output_type_names.contains_key(&simple_name) { + name_conflicts.insert(simple_name, true); + } + } + + for ty in schema.output_types.types() { + let simple_name = extract_simple_name(ty.name()); + output_type_names.insert(simple_name.clone(), ty.clone()); + + if input_type_names.contains_key(&simple_name) { + name_conflicts.insert(simple_name, true); + } + } + + for ty in schema.input_types.types() { + let simple_name = extract_simple_name(ty.name()); + let mut new_type = ty.clone(); + + if name_conflicts.contains_key(&simple_name) { + let new_name = format!("input.{simple_name}"); + rename_type(&mut new_type, &new_name); + } + + consolidated.insert_type(new_type); + } + + for ty in schema.output_types.types() { + let simple_name = extract_simple_name(ty.name()); + let mut new_type = ty.clone(); + + if name_conflicts.contains_key(&simple_name) { + let new_name = format!("output.{simple_name}"); + rename_type(&mut new_type, &new_name); + consolidated.insert_type(new_type); + } else if !input_type_names.contains_key(&simple_name) { + consolidated.insert_type(new_type); + } + } + + schema.input_types = consolidated; + schema.output_types = Typespace::new(); + + Ok(()) + } +} + +fn extract_simple_name(qualified_name: &str) -> String { + qualified_name + .split("::") + .last() + .unwrap_or(qualified_name) + .to_string() +} + +fn rename_type(ty: &mut Type, new_name: &str) { + match ty { + Type::Struct(s) => s.name = new_name.to_string(), + Type::Enum(e) => e.name = new_name.to_string(), + Type::Primitive(p) => p.name = new_name.to_string(), + } +} + +// --------------------------------------------------------------------------- +// Stage 2: Naming Resolution +// --------------------------------------------------------------------------- + +/// Sanitizes type names by stripping module paths and handling naming conflicts. +pub struct NamingResolutionStage; + +impl NormalizationStage for NamingResolutionStage { + fn name(&self) -> &'static str { + "NamingResolution" + } + + fn transform(&self, schema: &mut Schema) -> Result<(), Vec> { + let mut name_usage = HashMap::new(); + let mut name_conflicts = HashMap::new(); + + for ty in schema.input_types.types() { + let qualified_name = ty.name().to_string(); + let simple_name = extract_simple_name(&qualified_name); + + if let Some(existing) = name_usage.get(&simple_name) { + if existing != &qualified_name { + name_conflicts.insert(simple_name.clone(), true); + } + } else { + name_usage.insert(simple_name, qualified_name); + } + } + + let types_to_update: Vec<_> = schema.input_types.types().cloned().collect(); + schema.input_types = crate::Typespace::new(); + + for mut ty in types_to_update { + let qualified_name = ty.name().to_string(); + let simple_name = extract_simple_name(&qualified_name); + + let resolved_name = if name_conflicts.contains_key(&simple_name) { + generate_unique_name(&qualified_name) + } else { + simple_name + }; + + rename_type(&mut ty, &resolved_name); + schema.input_types.insert_type(ty); + } + + update_type_references_in_schema(schema, &name_usage, &name_conflicts); + + Ok(()) + } +} + +fn generate_unique_name(qualified_name: &str) -> String { + let parts: Vec<&str> = qualified_name.split("::").collect(); + if parts.len() < 2 { + return qualified_name.to_string(); + } + + let type_name = parts.last().unwrap(); + let module_parts: Vec<&str> = parts[..parts.len() - 1].to_vec(); + + let module_prefix = module_parts + .iter() + .rev() + .find(|&part| *part != "model" && *part != "proto" && !part.is_empty()) + .unwrap_or(&module_parts[0]); + + let capitalized_prefix = capitalize_first_letter(module_prefix); + format!("{capitalized_prefix}{type_name}") +} + +fn capitalize_first_letter(s: &str) -> String { + let mut chars = s.chars(); + match chars.next() { + None => String::new(), + Some(first) => first.to_uppercase().collect::() + chars.as_str(), + } +} + +fn update_type_references_in_schema( + schema: &mut Schema, + name_usage: &HashMap, + name_conflicts: &HashMap, +) { + let mut name_mapping = HashMap::new(); + + for (simple_name, qualified_name) in name_usage { + let resolved_name = if name_conflicts.contains_key(simple_name) { + generate_unique_name(qualified_name) + } else { + simple_name.clone() + }; + name_mapping.insert(qualified_name.clone(), resolved_name); + } + + for function in &mut schema.functions { + update_type_reference_in_option(&mut function.input_type, &name_mapping); + update_type_reference_in_option(&mut function.input_headers, &name_mapping); + update_type_reference_in_option(&mut function.output_type, &name_mapping); + update_type_reference_in_option(&mut function.error_type, &name_mapping); + } + + let types_to_update: Vec<_> = schema.input_types.types().cloned().collect(); + schema.input_types = crate::Typespace::new(); + + for mut ty in types_to_update { + update_type_references_in_type(&mut ty, &name_mapping); + schema.input_types.insert_type(ty); + } +} + +fn update_type_reference( + type_ref: &mut crate::TypeReference, + name_mapping: &HashMap, +) { + if let Some(new_name) = name_mapping.get(&type_ref.name) { + type_ref.name.clone_from(new_name); + } + + for arg in &mut type_ref.arguments { + update_type_reference(arg, name_mapping); + } +} + +fn update_type_reference_in_option( + type_ref_opt: &mut Option, + name_mapping: &HashMap, +) { + if let Some(type_ref) = type_ref_opt { + update_type_reference(type_ref, name_mapping); + } +} + +fn update_type_references_in_type(ty: &mut crate::Type, name_mapping: &HashMap) { + match ty { + crate::Type::Struct(s) => match &mut s.fields { + crate::Fields::Named(fields) | crate::Fields::Unnamed(fields) => { + for field in fields { + update_type_reference(&mut field.type_ref, name_mapping); + } + } + crate::Fields::None => {} + }, + crate::Type::Enum(e) => { + for variant in &mut e.variants { + match &mut variant.fields { + crate::Fields::Named(fields) | crate::Fields::Unnamed(fields) => { + for field in fields { + update_type_reference(&mut field.type_ref, name_mapping); + } + } + crate::Fields::None => {} + } + } + } + crate::Type::Primitive(p) => { + if let Some(fallback) = &mut p.fallback { + update_type_reference(fallback, name_mapping); + } + } + } +} + +// --------------------------------------------------------------------------- +// Stage 3: Circular Dependency Resolution +// --------------------------------------------------------------------------- + +/// Detects and resolves circular dependencies using Tarjan's SCC algorithm +/// and configurable resolution strategies. +pub struct CircularDependencyResolutionStage { + strategy: ResolutionStrategy, +} + +#[derive(Debug, Clone, Default)] +pub enum ResolutionStrategy { + /// Try boxing first, then forward declarations + #[default] + Intelligent, + /// Always use Box for self-references + Boxing, + /// Always use forward declarations + ForwardDeclarations, + /// Make circular references optional + OptionalBreaking, + /// Use reference counting for complex cycles + ReferenceCounted, +} + +impl CircularDependencyResolutionStage { + pub fn new() -> Self { + Self { + strategy: ResolutionStrategy::default(), + } + } + + pub fn with_strategy(strategy: ResolutionStrategy) -> Self { + Self { strategy } + } +} + +impl Default for CircularDependencyResolutionStage { + fn default() -> Self { + Self::new() + } +} + +impl NormalizationStage for CircularDependencyResolutionStage { + fn name(&self) -> &'static str { + "CircularDependencyResolution" + } + + fn transform(&self, schema: &mut Schema) -> Result<(), Vec> { + let cycles = self.detect_circular_dependencies(schema)?; + + if cycles.is_empty() { + return Ok(()); + } + + for cycle in cycles { + self.resolve_cycle(schema, &cycle)?; + } + + Ok(()) + } +} + +impl CircularDependencyResolutionStage { + fn detect_circular_dependencies( + &self, + schema: &Schema, + ) -> Result>, Vec> { + let mut dependencies: HashMap> = HashMap::new(); + + for ty in schema + .input_types + .types() + .chain(schema.output_types.types()) + { + let type_name = ty.name().to_string(); + let mut deps = BTreeSet::new(); + self.collect_type_dependencies(ty, &mut deps); + dependencies.insert(type_name, deps); + } + + let scc_cycles = self.find_strongly_connected_components(&dependencies); + + let mut cycles = Vec::new(); + for component in scc_cycles { + if component.len() > 1 + || (component.len() == 1 + && dependencies + .get(&component[0]) + .is_some_and(|deps| deps.contains(&component[0]))) + { + cycles.push(component); + } + } + + Ok(cycles) + } + + fn collect_type_dependencies(&self, ty: &Type, deps: &mut BTreeSet) { + match ty { + Type::Struct(s) => { + for field in s.fields() { + self.collect_type_ref_dependencies(&field.type_ref, deps); + } + } + Type::Enum(e) => { + for variant in e.variants() { + for field in variant.fields() { + self.collect_type_ref_dependencies(&field.type_ref, deps); + } + } + } + Type::Primitive(p) => { + if let Some(fallback) = &p.fallback { + self.collect_type_ref_dependencies(fallback, deps); + } + } + } + } + + fn collect_type_ref_dependencies(&self, type_ref: &TypeReference, deps: &mut BTreeSet) { + if !self.is_stdlib_type(&type_ref.name) && !self.is_generic_parameter(&type_ref.name) { + deps.insert(type_ref.name.clone()); + } + + for arg in &type_ref.arguments { + self.collect_type_ref_dependencies(arg, deps); + } + } + + fn is_stdlib_type(&self, name: &str) -> bool { + // Check exact matches from the canonical list + if STDLIB_TYPES.iter().any(|&(n, _)| n == name) { + return true; + } + // Fall back to prefix matching for types not explicitly listed + STDLIB_TYPE_PREFIXES + .iter() + .any(|prefix| name.starts_with(prefix)) + } + + fn is_generic_parameter(&self, name: &str) -> bool { + name.len() <= 2 && name.chars().all(|c| c.is_ascii_uppercase()) + } + + fn find_strongly_connected_components( + &self, + dependencies: &HashMap>, + ) -> Vec> { + let mut index = 0; + let mut stack = Vec::new(); + let mut indices: HashMap = HashMap::new(); + let mut lowlinks: HashMap = HashMap::new(); + let mut on_stack: HashMap = HashMap::new(); + let mut components = Vec::new(); + + for node in dependencies.keys() { + if !indices.contains_key(node) { + self.strongconnect( + node, + dependencies, + &mut index, + &mut stack, + &mut indices, + &mut lowlinks, + &mut on_stack, + &mut components, + ); + } + } + + components + } + + #[allow(clippy::too_many_arguments, clippy::only_used_in_recursion)] + fn strongconnect( + &self, + node: &str, + dependencies: &HashMap>, + index: &mut usize, + stack: &mut Vec, + indices: &mut HashMap, + lowlinks: &mut HashMap, + on_stack: &mut HashMap, + components: &mut Vec>, + ) { + indices.insert(node.to_string(), *index); + lowlinks.insert(node.to_string(), *index); + *index += 1; + stack.push(node.to_string()); + on_stack.insert(node.to_string(), true); + + if let Some(deps) = dependencies.get(node) { + for neighbor in deps { + if !indices.contains_key(neighbor) { + self.strongconnect( + neighbor, + dependencies, + index, + stack, + indices, + lowlinks, + on_stack, + components, + ); + lowlinks.insert(node.to_string(), lowlinks[node].min(lowlinks[neighbor])); + } else if *on_stack.get(neighbor).unwrap_or(&false) { + lowlinks.insert(node.to_string(), lowlinks[node].min(indices[neighbor])); + } + } + } + + if lowlinks[node] == indices[node] { + let mut component = Vec::new(); + loop { + let w = stack.pop().unwrap(); + on_stack.insert(w.clone(), false); + component.push(w.clone()); + if w == node { + break; + } + } + if !component.is_empty() { + components.push(component); + } + } + } + + fn resolve_cycle( + &self, + schema: &mut Schema, + cycle: &[String], + ) -> Result<(), Vec> { + match self.strategy { + ResolutionStrategy::Intelligent => { + if cycle.len() == 1 { + self.apply_boxing_strategy(schema, cycle) + } else { + self.apply_forward_declaration_strategy(schema, cycle) + } + } + ResolutionStrategy::Boxing => self.apply_boxing_strategy(schema, cycle), + ResolutionStrategy::ForwardDeclarations => { + self.apply_forward_declaration_strategy(schema, cycle) + } + ResolutionStrategy::OptionalBreaking => { + self.apply_optional_breaking_strategy(schema, cycle) + } + ResolutionStrategy::ReferenceCounted => { + self.apply_reference_counting_strategy(schema, cycle) + } + } + } + + fn apply_boxing_strategy( + &self, + _schema: &mut Schema, + _cycle: &[String], + ) -> Result<(), Vec> { + // TODO: Implement actual type reference wrapping in Box + Ok(()) + } + + fn apply_forward_declaration_strategy( + &self, + _schema: &mut Schema, + _cycle: &[String], + ) -> Result<(), Vec> { + // TODO: Implement forward declarations by creating type aliases + Ok(()) + } + + fn apply_optional_breaking_strategy( + &self, + _schema: &mut Schema, + _cycle: &[String], + ) -> Result<(), Vec> { + // TODO: Make certain fields optional to break cycles + Ok(()) + } + + fn apply_reference_counting_strategy( + &self, + _schema: &mut Schema, + _cycle: &[String], + ) -> Result<(), Vec> { + // TODO: Wrap cycle references in Rc> + Ok(()) + } +} + +// --------------------------------------------------------------------------- +// Error types +// --------------------------------------------------------------------------- + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum NormalizationError { + UnresolvedReference { + name: String, + referrer: SymbolId, + }, + CircularDependency { + cycle: Vec, + }, + ConflictingDefinition { + symbol: SymbolId, + existing: String, + new: String, + }, + InvalidGenericParameter { + type_name: String, + parameter: String, + reason: String, + }, + ValidationError { + symbol: SymbolId, + message: String, + }, +} + +impl std::fmt::Display for NormalizationError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + NormalizationError::UnresolvedReference { name, referrer } => { + write!( + f, + "Unresolved type reference '{name}' in symbol {referrer:?}" + ) + } + NormalizationError::CircularDependency { cycle } => { + write!(f, "Circular dependency detected: {cycle:?}") + } + NormalizationError::ConflictingDefinition { + symbol, + existing, + new, + } => { + write!( + f, + "Conflicting definition for symbol {symbol:?}: existing '{existing}', new '{new}'" + ) + } + NormalizationError::InvalidGenericParameter { + type_name, + parameter, + reason, + } => { + write!( + f, + "Invalid generic parameter '{parameter}' in type '{type_name}': {reason}" + ) + } + NormalizationError::ValidationError { symbol, message } => { + write!(f, "Validation error for symbol {symbol:?}: {message}") + } + } + } +} + +impl std::error::Error for NormalizationError {} + +// --------------------------------------------------------------------------- +// Normalizer: main pipeline converting Schema -> SemanticSchema +// --------------------------------------------------------------------------- + +#[derive(Debug)] +struct NormalizationContext { + symbol_table: SymbolTable, + raw_types: HashMap, + raw_functions: HashMap, + resolution_cache: HashMap, + generic_scope: BTreeSet, + errors: Vec, +} + +impl Default for NormalizationContext { + fn default() -> Self { + Self::new() + } +} + +impl NormalizationContext { + fn new() -> Self { + Self { + symbol_table: SymbolTable::new(), + raw_types: HashMap::new(), + raw_functions: HashMap::new(), + resolution_cache: HashMap::new(), + generic_scope: BTreeSet::new(), + errors: Vec::new(), + } + } + + fn has_errors(&self) -> bool { + !self.errors.is_empty() + } + + fn take_errors(&mut self) -> Vec { + std::mem::take(&mut self.errors) + } +} + +/// Main normalizer that converts a raw Schema into a SemanticSchema +pub struct Normalizer { + context: NormalizationContext, +} + +impl Normalizer { + pub fn new() -> Self { + Self { + context: NormalizationContext::new(), + } + } + + /// Normalize a raw schema into a semantic schema + pub fn normalize( + mut self, + mut schema: Schema, + ) -> Result> { + // Phase 0: Ensure all symbols have unique, stable IDs + crate::ids::ensure_symbol_ids(&mut schema); + + // Phase 1: Symbol Discovery + self.discover_symbols(&schema)?; + + // Phase 2: Type Resolution + self.resolve_types()?; + + // Phase 3: Dependency Analysis + self.analyze_dependencies()?; + + // Phase 4: Semantic Validation + self.validate_semantics()?; + + // Phase 5: IR Construction + self.build_semantic_ir(schema) + } + + fn discover_symbols(&mut self, schema: &Schema) -> Result<(), Vec> { + let schema_info = SymbolInfo { + id: schema.id.clone(), + name: schema.name.clone(), + path: vec![schema.name.clone()], + kind: SymbolKind::Struct, + resolved: false, + dependencies: BTreeSet::new(), + }; + self.context.symbol_table.register(schema_info); + + for function in &schema.functions { + let function_info = SymbolInfo { + id: function.id.clone(), + name: function.name.clone(), + path: function.path.split('/').map(|s| s.to_string()).collect(), + kind: SymbolKind::Endpoint, + resolved: false, + dependencies: BTreeSet::new(), + }; + self.context.symbol_table.register(function_info); + self.context + .raw_functions + .insert(function.id.clone(), function.clone()); + } + + self.discover_types_from_typespace(&schema.input_types); + self.discover_types_from_typespace(&schema.output_types); + + if self.context.has_errors() { + return Err(self.context.take_errors()); + } + + Ok(()) + } + + fn discover_types_from_typespace(&mut self, typespace: &crate::Typespace) { + for ty in typespace.types() { + self.discover_type_symbols(ty); + } + } + + fn discover_type_symbols(&mut self, ty: &Type) { + let (id, name, kind) = match ty { + Type::Primitive(p) => (p.id.clone(), p.name.clone(), SymbolKind::Primitive), + Type::Struct(s) => (s.id.clone(), s.name.clone(), SymbolKind::Struct), + Type::Enum(e) => (e.id.clone(), e.name.clone(), SymbolKind::Enum), + }; + + let path = id.path.clone(); + + let symbol_info = SymbolInfo { + id: id.clone(), + name, + path, + kind, + resolved: false, + dependencies: BTreeSet::new(), + }; + + self.context.symbol_table.register(symbol_info); + self.context.raw_types.insert(id, ty.clone()); + + match ty { + Type::Struct(s) => self.discover_struct_symbols(s), + Type::Enum(e) => self.discover_enum_symbols(e), + Type::Primitive(_) => {} + } + } + + fn discover_struct_symbols(&mut self, strukt: &Struct) { + for field in strukt.fields() { + let field_info = SymbolInfo { + id: field.id.clone(), + name: field.name.clone(), + path: vec![strukt.name.clone(), field.name.clone()], + kind: SymbolKind::Field, + resolved: false, + dependencies: BTreeSet::new(), + }; + self.context.symbol_table.register(field_info); + } + } + + fn discover_enum_symbols(&mut self, enm: &Enum) { + for variant in enm.variants() { + let variant_info = SymbolInfo { + id: variant.id.clone(), + name: variant.name.clone(), + path: vec![enm.name.clone(), variant.name.clone()], + kind: SymbolKind::Variant, + resolved: false, + dependencies: BTreeSet::new(), + }; + self.context.symbol_table.register(variant_info); + + for field in variant.fields() { + let field_info = SymbolInfo { + id: field.id.clone(), + name: field.name.clone(), + path: vec![enm.name.clone(), variant.name.clone(), field.name.clone()], + kind: SymbolKind::Field, + resolved: false, + dependencies: BTreeSet::new(), + }; + self.context.symbol_table.register(field_info); + } + } + } + + fn resolve_types(&mut self) -> Result<(), Vec> { + for symbol_info in self.context.symbol_table.symbols.values() { + self.context + .resolution_cache + .insert(symbol_info.name.clone(), symbol_info.id.clone()); + + let qualified_name = symbol_info.id.qualified_name(); + if qualified_name != symbol_info.name { + self.context + .resolution_cache + .insert(qualified_name, symbol_info.id.clone()); + } + } + + self.add_stdlib_types_to_cache(); + + for (function_id, function) in &self.context.raw_functions.clone() { + self.resolve_function_references(function_id, function); + } + + for (type_id, ty) in &self.context.raw_types.clone() { + self.resolve_type_references(type_id, ty); + } + + if self.context.has_errors() { + return Err(self.context.take_errors()); + } + + Ok(()) + } + + fn resolve_function_references(&mut self, function_id: &SymbolId, function: &Function) { + if let Some(input_type) = &function.input_type { + self.resolve_single_reference(function_id, input_type); + } + if let Some(input_headers) = &function.input_headers { + self.resolve_single_reference(function_id, input_headers); + } + if let Some(output_type) = &function.output_type { + self.resolve_single_reference(function_id, output_type); + } + if let Some(error_type) = &function.error_type { + self.resolve_single_reference(function_id, error_type); + } + } + + fn resolve_type_references(&mut self, type_id: &SymbolId, ty: &Type) { + let generic_params: BTreeSet = ty.parameters().map(|p| p.name.clone()).collect(); + self.context.generic_scope.extend(generic_params.clone()); + + match ty { + Type::Struct(s) => { + for field in s.fields() { + self.resolve_field_references(type_id, field); + } + } + Type::Enum(e) => { + for variant in e.variants() { + for field in variant.fields() { + self.resolve_field_references(type_id, field); + } + } + } + Type::Primitive(p) => { + if let Some(fallback) = &p.fallback { + self.resolve_single_reference(type_id, fallback); + } + } + } + + for param in generic_params { + self.context.generic_scope.remove(¶m); + } + } + + fn resolve_field_references(&mut self, owner_id: &SymbolId, field: &Field) { + self.resolve_single_reference(owner_id, &field.type_ref); + } + + fn add_stdlib_types_to_cache(&mut self) { + for &(name, kind) in STDLIB_TYPES { + let path = name.split("::").map(|s| s.to_string()).collect(); + let symbol_id = SymbolId::new(kind, path); + self.context + .resolution_cache + .insert(name.to_string(), symbol_id); + } + } + + fn resolve_single_reference(&mut self, referrer: &SymbolId, type_ref: &TypeReference) { + if self.context.generic_scope.contains(&type_ref.name) { + for arg in &type_ref.arguments { + self.resolve_single_reference(referrer, arg); + } + return; + } + + if let Some(target_id) = self.resolve_global_type_reference(&type_ref.name) { + self.context + .symbol_table + .add_dependency(referrer.clone(), target_id); + } + // Unresolved references are silently ignored for now - + // they'll be handled as placeholders in IR building + + for arg in &type_ref.arguments { + self.resolve_single_reference(referrer, arg); + } + } + + fn resolve_global_type_reference(&self, name: &str) -> Option { + self.context.resolution_cache.get(name).cloned() + } + + fn analyze_dependencies(&mut self) -> Result<(), Vec> { + match self.context.symbol_table.topological_sort() { + Ok(_) => Ok(()), + Err(_cycle) => { + // Cycles may be expected after CircularDependencyResolutionStage + Ok(()) + } + } + } + + fn validate_semantics(&mut self) -> Result<(), Vec> { + // TODO: Add semantic validation passes + if self.context.has_errors() { + return Err(self.context.take_errors()); + } + Ok(()) + } + + fn build_semantic_ir(self, schema: Schema) -> Result> { + let mut semantic_types = BTreeMap::new(); + let mut semantic_functions = BTreeMap::new(); + + let sorted_symbols = match self.context.symbol_table.topological_sort() { + Ok(sorted) => sorted, + Err(_cycle) => self.context.symbol_table.symbols.keys().cloned().collect(), + }; + + for symbol_id in sorted_symbols { + if let Some(raw_type) = self.context.raw_types.get(&symbol_id) { + let semantic_type = self.build_semantic_type(raw_type)?; + semantic_types.insert(symbol_id, semantic_type); + } + } + + for (function_id, raw_function) in &self.context.raw_functions { + let semantic_function = self.build_semantic_function(raw_function)?; + semantic_functions.insert(function_id.clone(), semantic_function); + } + + Ok(SemanticSchema { + id: schema.id, + name: schema.name, + description: schema.description, + functions: semantic_functions, + types: semantic_types, + symbol_table: self.context.symbol_table, + }) + } + + fn build_semantic_type( + &self, + raw_type: &Type, + ) -> Result> { + match raw_type { + Type::Primitive(p) => Ok(SemanticType::Primitive(self.build_semantic_primitive(p)?)), + Type::Struct(s) => Ok(SemanticType::Struct(self.build_semantic_struct(s)?)), + Type::Enum(e) => Ok(SemanticType::Enum(self.build_semantic_enum(e)?)), + } + } + + fn build_semantic_primitive( + &self, + primitive: &Primitive, + ) -> Result> { + let fallback = primitive + .fallback + .as_ref() + .and_then(|tr| self.resolve_global_type_reference(&tr.name)); + + Ok(SemanticPrimitive { + id: primitive.id.clone(), + name: primitive.name.clone(), + description: primitive.description.clone(), + parameters: primitive + .parameters + .iter() + .map(|p| SemanticTypeParameter { + name: p.name.clone(), + description: p.description.clone(), + bounds: vec![], + default: None, + }) + .collect(), + fallback, + }) + } + + fn build_semantic_struct( + &self, + strukt: &Struct, + ) -> Result> { + let mut fields = BTreeMap::new(); + + for field in strukt.fields() { + let semantic_field = self.build_semantic_field(field)?; + fields.insert(field.id.clone(), semantic_field); + } + + Ok(SemanticStruct { + id: strukt.id.clone(), + name: strukt.name.clone(), + serde_name: strukt.serde_name.clone(), + description: strukt.description.clone(), + parameters: strukt + .parameters + .iter() + .map(|p| SemanticTypeParameter { + name: p.name.clone(), + description: p.description.clone(), + bounds: vec![], + default: None, + }) + .collect(), + fields, + transparent: strukt.transparent, + is_tuple: strukt.is_tuple(), + is_unit: strukt.is_unit(), + codegen_config: strukt.codegen_config.clone(), + }) + } + + fn build_semantic_enum(&self, enm: &Enum) -> Result> { + let mut variants = BTreeMap::new(); + + for variant in enm.variants() { + let semantic_variant = self.build_semantic_variant(variant)?; + variants.insert(variant.id.clone(), semantic_variant); + } + + Ok(SemanticEnum { + id: enm.id.clone(), + name: enm.name.clone(), + serde_name: enm.serde_name.clone(), + description: enm.description.clone(), + parameters: enm + .parameters + .iter() + .map(|p| SemanticTypeParameter { + name: p.name.clone(), + description: p.description.clone(), + bounds: vec![], + default: None, + }) + .collect(), + variants, + representation: enm.representation.clone(), + codegen_config: enm.codegen_config.clone(), + }) + } + + fn build_semantic_field( + &self, + field: &Field, + ) -> Result> { + let resolved_type_ref = self.build_resolved_type_reference(&field.type_ref)?; + + Ok(SemanticField { + id: field.id.clone(), + name: field.name.clone(), + serde_name: field.serde_name.clone(), + description: field.description.clone(), + deprecation_note: field.deprecation_note.clone(), + type_ref: resolved_type_ref, + required: field.required, + flattened: field.flattened, + transform_callback: field.transform_callback.clone(), + }) + } + + fn build_semantic_variant( + &self, + variant: &Variant, + ) -> Result> { + let mut fields = BTreeMap::new(); + + for field in variant.fields() { + let semantic_field = self.build_semantic_field(field)?; + fields.insert(field.id.clone(), semantic_field); + } + + let field_style = match &variant.fields { + Fields::Named(_) => FieldStyle::Named, + Fields::Unnamed(_) => FieldStyle::Unnamed, + Fields::None => FieldStyle::Unit, + }; + + Ok(SemanticVariant { + id: variant.id.clone(), + name: variant.name.clone(), + serde_name: variant.serde_name.clone(), + description: variant.description.clone(), + fields, + discriminant: variant.discriminant, + untagged: variant.untagged, + field_style, + }) + } + + fn build_semantic_function( + &self, + function: &Function, + ) -> Result> { + let input_type = function + .input_type + .as_ref() + .and_then(|tr| self.resolve_global_type_reference(&tr.name)); + let input_headers = function + .input_headers + .as_ref() + .and_then(|tr| self.resolve_global_type_reference(&tr.name)); + let output_type = function + .output_type + .as_ref() + .and_then(|tr| self.resolve_global_type_reference(&tr.name)); + let error_type = function + .error_type + .as_ref() + .and_then(|tr| self.resolve_global_type_reference(&tr.name)); + + Ok(SemanticFunction { + id: function.id.clone(), + name: function.name.clone(), + path: function.path.clone(), + description: function.description.clone(), + deprecation_note: function.deprecation_note.clone(), + input_type, + input_headers, + output_type, + error_type, + serialization: function.serialization.clone(), + readonly: function.readonly, + tags: function.tags.clone(), + }) + } + + fn build_resolved_type_reference( + &self, + type_ref: &TypeReference, + ) -> Result> { + let is_likely_generic = !type_ref.name.contains("::"); + + let target = if let Some(target) = self.resolve_global_type_reference(&type_ref.name) { + target + } else if is_likely_generic { + SymbolId::new(SymbolKind::TypeAlias, vec![type_ref.name.clone()]) + } else { + SymbolId::new(SymbolKind::Struct, vec![type_ref.name.replace("::", "_")]) + }; + + let mut resolved_args = Vec::new(); + for arg in &type_ref.arguments { + resolved_args.push(self.build_resolved_type_reference(arg)?); + } + + Ok(ResolvedTypeReference::new( + target, + resolved_args, + type_ref.name.clone(), + )) + } +} + +impl Default for Normalizer { + fn default() -> Self { + Self::new() + } +} + +// --------------------------------------------------------------------------- +// Tests +// --------------------------------------------------------------------------- + +#[cfg(test)] +mod tests { + use super::*; + use crate::{Fields, Function, Representation, Schema, Struct, TypeReference, Typespace}; + + #[test] + fn test_basic_normalization() { + let mut schema = Schema::new(); + schema.name = "TestSchema".to_string(); + + let user_struct = Struct::new("User"); + let user_type = Type::Struct(user_struct); + + let mut input_types = Typespace::new(); + input_types.insert_type(user_type); + schema.input_types = input_types; + + let normalizer = Normalizer::new(); + let result = normalizer.normalize(schema); + + assert!( + result.is_ok(), + "Normalization should succeed for simple schema" + ); + + let semantic_schema = result.unwrap(); + assert_eq!(semantic_schema.name, "TestSchema"); + assert_eq!(semantic_schema.types.len(), 1); + } + + #[test] + fn test_unresolved_reference_handled_gracefully() { + let mut schema = Schema::new(); + schema.name = "TestSchema".to_string(); + + let mut function = Function::new("test_function".to_string()); + function.input_type = Some(TypeReference::new("NonExistentType", vec![])); + schema.functions.push(function); + + let normalizer = Normalizer::new(); + let result = normalizer.normalize(schema); + + assert!( + result.is_ok(), + "Normalization should handle unresolved references gracefully" + ); + + let semantic_schema = result.unwrap(); + assert!(!semantic_schema.functions.is_empty()); + } + + #[test] + fn test_normalize_with_functions_and_types() { + let mut schema = Schema::new(); + schema.name = "API".to_string(); + + // Add types + let mut user_struct = Struct::new("api::User"); + user_struct.fields = Fields::Named(vec![ + Field::new("name".into(), "std::string::String".into()), + Field::new("age".into(), "u32".into()), + ]); + schema.input_types.insert_type(user_struct.into()); + + let mut error_enum = Enum::new("api::Error".into()); + error_enum.representation = Representation::Internal { tag: "type".into() }; + error_enum.variants = vec![ + Variant::new("NotFound".into()), + Variant::new("Forbidden".into()), + ]; + schema.output_types.insert_type(error_enum.into()); + + // Add a function referencing both types + let mut function = Function::new("get_user".into()); + function.input_type = Some(TypeReference::new("api::User", vec![])); + function.error_type = Some(TypeReference::new("api::Error", vec![])); + schema.functions.push(function); + + let normalizer = Normalizer::new(); + let result = normalizer.normalize(schema); + assert!(result.is_ok(), "Normalization failed: {:?}", result.err()); + + let semantic = result.unwrap(); + assert_eq!(semantic.types.len(), 2); + assert_eq!(semantic.functions.len(), 1); + + // Verify the function has resolved type references + let func = semantic.functions.values().next().unwrap(); + assert!(func.input_type.is_some()); + assert!(func.error_type.is_some()); + } + + #[test] + fn test_normalize_function_with_input_headers() { + let mut schema = Schema::new(); + schema.name = "API".to_string(); + + let headers_struct = Struct::new("Headers"); + schema.input_types.insert_type(headers_struct.into()); + + let body_struct = Struct::new("Body"); + schema.input_types.insert_type(body_struct.into()); + + let mut function = Function::new("do_thing".into()); + function.input_type = Some(TypeReference::new("Body", vec![])); + function.input_headers = Some(TypeReference::new("Headers", vec![])); + schema.functions.push(function); + + let normalizer = Normalizer::new(); + let semantic = normalizer.normalize(schema).unwrap(); + + let func = semantic.functions.values().next().unwrap(); + assert!(func.input_type.is_some()); + assert!(func.input_headers.is_some()); + } + + #[test] + fn test_type_consolidation_shared_name() { + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + // Same simple name in both typespaces triggers conflict renaming + let input_struct = Struct::new("Shared"); + let output_struct = Struct::new("Shared"); + schema.input_types.insert_type(input_struct.into()); + schema.output_types.insert_type(output_struct.into()); + + let stage = TypeConsolidationStage; + stage.transform(&mut schema).unwrap(); + + // Both get prefixed since they share a simple name + let type_names: Vec<_> = schema + .input_types + .types() + .map(|t| t.name().to_string()) + .collect(); + assert!( + type_names.contains(&"input.Shared".to_string()), + "Expected input.Shared, got: {type_names:?}" + ); + assert!( + type_names.contains(&"output.Shared".to_string()), + "Expected output.Shared, got: {type_names:?}" + ); + assert!(schema.output_types.is_empty()); + } + + #[test] + fn test_type_consolidation_conflict_renaming() { + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + // Different types sharing simple name get renamed + let mut input_struct = Struct::new("Foo"); + input_struct.description = "input version".into(); + let mut output_struct = Struct::new("Foo"); + output_struct.description = "output version".into(); + // Make them different so they're not deduplicated + output_struct.fields = Fields::Named(vec![Field::new("x".into(), "u32".into())]); + + schema.input_types.insert_type(input_struct.into()); + schema.output_types.insert_type(output_struct.into()); + + let stage = TypeConsolidationStage; + stage.transform(&mut schema).unwrap(); + + let type_names: Vec<_> = schema + .input_types + .types() + .map(|t| t.name().to_string()) + .collect(); + assert!( + type_names.contains(&"input.Foo".to_string()) + || type_names.contains(&"output.Foo".to_string()), + "Expected conflict renaming, got: {type_names:?}" + ); + } + + #[test] + fn test_ensure_symbol_ids_idempotent() { + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + let mut user_struct = Struct::new("User"); + user_struct.fields = Fields::Named(vec![Field::new("id".into(), "u64".into())]); + schema.input_types.insert_type(user_struct.into()); + + // Run twice + crate::ensure_symbol_ids(&mut schema); + let ids_first: Vec<_> = schema + .input_types + .types() + .map(|t| match t { + Type::Struct(s) => s.id.clone(), + _ => unreachable!(), + }) + .collect(); + + crate::ensure_symbol_ids(&mut schema); + let ids_second: Vec<_> = schema + .input_types + .types() + .map(|t| match t { + Type::Struct(s) => s.id.clone(), + _ => unreachable!(), + }) + .collect(); + + assert_eq!( + ids_first, ids_second, + "ensure_symbol_ids should be idempotent" + ); + } + + #[test] + fn test_ensure_symbol_ids_enum_variants_and_fields() { + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + let mut enm = Enum::new("Status".into()); + let mut variant = Variant::new("Active".into()); + variant.fields = Fields::Named(vec![Field::new( + "since".into(), + "std::string::String".into(), + )]); + enm.variants = vec![variant, Variant::new("Inactive".into())]; + schema.input_types.insert_type(enm.into()); + + crate::ensure_symbol_ids(&mut schema); + + let enm = schema + .input_types + .get_type("Status") + .unwrap() + .as_enum() + .unwrap(); + assert!(!enm.id.is_unknown(), "Enum should have a non-unknown id"); + + for variant in &enm.variants { + assert!( + !variant.id.is_unknown(), + "Variant '{}' should have a non-unknown id", + variant.name + ); + for field in variant.fields() { + assert!( + !field.id.is_unknown(), + "Field '{}' in variant '{}' should have a non-unknown id", + field.name, + variant.name + ); + } + } + + // Check paths are structured correctly + let active = &enm.variants[0]; + assert_eq!(active.id.path.last().unwrap(), "Active"); + let since_field = active.fields().next().unwrap(); + assert!( + since_field.id.path.contains(&"Active".to_string()), + "Field path should include parent variant: {:?}", + since_field.id.path + ); + } + + #[test] + fn test_circular_dependency_detection() { + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + // Node { children: Vec } - self-referential + let mut node_struct = Struct::new("Node"); + node_struct.fields = Fields::Named(vec![Field::new( + "children".into(), + TypeReference::new("std::vec::Vec", vec![TypeReference::new("Node", vec![])]), + )]); + schema.input_types.insert_type(node_struct.into()); + + let stage = CircularDependencyResolutionStage::new(); + // Should detect the cycle but not fail (strategies are stubs) + let result = stage.transform(&mut schema); + assert!(result.is_ok()); + } + + #[test] + fn test_empty_schema_normalization() { + let schema = Schema::new(); + let normalizer = Normalizer::new(); + let result = normalizer.normalize(schema); + assert!(result.is_ok()); + + let semantic = result.unwrap(); + assert!(semantic.types.is_empty()); + assert!(semantic.functions.is_empty()); + } +} diff --git a/reflectapi-schema/src/semantic.rs b/reflectapi-schema/src/semantic.rs new file mode 100644 index 00000000..db2e50f3 --- /dev/null +++ b/reflectapi-schema/src/semantic.rs @@ -0,0 +1,440 @@ +/// Semantic Intermediate Representation for ReflectAPI +/// +/// This module provides immutable, semantically-validated representations +/// of API schemas that have been processed through the normalization pipeline. +/// Unlike the raw schema types, these representations are guaranteed to be: +/// - Fully resolved (no dangling references) +/// - Semantically consistent (no conflicting definitions) +/// - Deterministically ordered (BTreeMap/BTreeSet for stable output) +use crate::SymbolId; +use std::collections::{BTreeMap, BTreeSet}; + +/// Semantic schema with fully resolved types and deterministic ordering +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticSchema { + pub id: SymbolId, + pub name: String, + pub description: String, + + /// Functions ordered by SymbolId for deterministic output + pub functions: BTreeMap, + + /// All type definitions ordered by SymbolId + pub types: BTreeMap, + + /// Symbol table for efficient lookups + pub symbol_table: SymbolTable, +} + +/// Fully resolved function definition +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticFunction { + pub id: SymbolId, + pub name: String, + pub path: String, + pub description: String, + pub deprecation_note: Option, + + /// Resolved type references (no dangling pointers) + pub input_type: Option, + pub input_headers: Option, + pub output_type: Option, + pub error_type: Option, + + pub serialization: Vec, + pub readonly: bool, + pub tags: BTreeSet, +} + +/// Resolved type definition with semantic validation +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum SemanticType { + Primitive(SemanticPrimitive), + Struct(SemanticStruct), + Enum(SemanticEnum), +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticPrimitive { + pub id: SymbolId, + pub name: String, + pub description: String, + + /// Resolved generic parameters + pub parameters: Vec, + + /// Resolved fallback type reference + pub fallback: Option, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticStruct { + pub id: SymbolId, + pub name: String, + pub serde_name: String, + pub description: String, + + /// Resolved generic parameters + pub parameters: Vec, + + /// Fields ordered deterministically + pub fields: BTreeMap, + + /// Semantic properties + pub transparent: bool, + pub is_tuple: bool, + pub is_unit: bool, + + /// Language-specific configuration + pub codegen_config: crate::LanguageSpecificTypeCodegenConfig, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticEnum { + pub id: SymbolId, + pub name: String, + pub serde_name: String, + pub description: String, + + /// Resolved generic parameters + pub parameters: Vec, + + /// Variants ordered deterministically + pub variants: BTreeMap, + + /// Serde representation strategy + pub representation: crate::Representation, + + /// Language-specific configuration + pub codegen_config: crate::LanguageSpecificTypeCodegenConfig, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticField { + pub id: SymbolId, + pub name: String, + pub serde_name: String, + pub description: String, + pub deprecation_note: Option, + + /// Resolved type reference + pub type_ref: ResolvedTypeReference, + + /// Field properties + pub required: bool, + pub flattened: bool, + + /// Transform callback for custom processing + pub transform_callback: String, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticVariant { + pub id: SymbolId, + pub name: String, + pub serde_name: String, + pub description: String, + + /// Fields ordered deterministically + pub fields: BTreeMap, + + /// Variant properties + pub discriminant: Option, + pub untagged: bool, + pub field_style: FieldStyle, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum FieldStyle { + Named, + Unnamed, + Unit, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SemanticTypeParameter { + pub name: String, + pub description: String, + + /// Constraints on the type parameter + pub bounds: Vec, + pub default: Option, +} + +/// Resolved type reference with guaranteed validity +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ResolvedTypeReference { + /// Target symbol (guaranteed to exist in symbol table) + pub target: SymbolId, + + /// Resolved generic arguments + pub arguments: Vec, + + /// Original type reference for debugging + pub original_name: String, +} + +/// Symbol table for efficient lookups and validation +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SymbolTable { + /// Map from SymbolId to symbol information + pub symbols: BTreeMap, + + /// Map from name path to SymbolId for lookups + name_to_id: BTreeMap, SymbolId>, + + /// Dependencies between symbols + pub dependencies: BTreeMap>, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SymbolInfo { + pub id: SymbolId, + pub name: String, + pub path: Vec, + pub kind: crate::SymbolKind, + + /// Whether this symbol is fully resolved + pub resolved: bool, + + /// Dependencies of this symbol + pub dependencies: BTreeSet, +} + +impl SymbolTable { + pub fn new() -> Self { + Self { + symbols: BTreeMap::new(), + name_to_id: BTreeMap::new(), + dependencies: BTreeMap::new(), + } + } + + /// Register a new symbol in the table + pub fn register(&mut self, symbol: SymbolInfo) { + let id = symbol.id.clone(); + let path = symbol.path.clone(); + + self.symbols.insert(id.clone(), symbol); + self.name_to_id.insert(path, id); + } + + /// Lookup symbol by ID + pub fn get(&self, id: &SymbolId) -> Option<&SymbolInfo> { + self.symbols.get(id) + } + + /// Lookup symbol by name path + pub fn get_by_path(&self, path: &[String]) -> Option<&SymbolInfo> { + self.name_to_id + .get(path) + .and_then(|id| self.symbols.get(id)) + } + + /// Get all symbols of a specific kind + pub fn get_by_kind<'a>( + &'a self, + kind: &'a crate::SymbolKind, + ) -> impl Iterator + 'a { + self.symbols.values().filter(move |info| &info.kind == kind) + } + + /// Add dependency relationship + pub fn add_dependency(&mut self, dependent: SymbolId, dependency: SymbolId) { + self.dependencies + .entry(dependent.clone()) + .or_default() + .insert(dependency.clone()); + + // Update symbol info + if let Some(symbol) = self.symbols.get_mut(&dependent) { + symbol.dependencies.insert(dependency); + } + } + + /// Get dependencies of a symbol + pub fn get_dependencies(&self, id: &SymbolId) -> Option<&BTreeSet> { + self.dependencies.get(id) + } + + /// Topological sort for dependency resolution + pub fn topological_sort(&self) -> Result, Vec> { + let mut visited = BTreeSet::new(); + let mut temp_visited = BTreeSet::new(); + let mut result = Vec::new(); + + for id in self.symbols.keys() { + if !visited.contains(id) { + self.visit_topological(id, &mut visited, &mut temp_visited, &mut result)?; + } + } + + Ok(result) + } + + fn visit_topological( + &self, + id: &SymbolId, + visited: &mut BTreeSet, + temp_visited: &mut BTreeSet, + result: &mut Vec, + ) -> Result<(), Vec> { + if temp_visited.contains(id) { + return Err(vec![id.clone()]); + } + + if visited.contains(id) { + return Ok(()); + } + + temp_visited.insert(id.clone()); + + if let Some(dependencies) = self.dependencies.get(id) { + for dep in dependencies { + self.visit_topological(dep, visited, temp_visited, result)?; + } + } + + temp_visited.remove(id); + visited.insert(id.clone()); + result.push(id.clone()); + + Ok(()) + } +} + +impl Default for SymbolTable { + fn default() -> Self { + Self::new() + } +} + +impl SemanticType { + pub fn id(&self) -> &SymbolId { + match self { + SemanticType::Primitive(p) => &p.id, + SemanticType::Struct(s) => &s.id, + SemanticType::Enum(e) => &e.id, + } + } + + pub fn name(&self) -> &str { + match self { + SemanticType::Primitive(p) => &p.name, + SemanticType::Struct(s) => &s.name, + SemanticType::Enum(e) => &e.name, + } + } +} + +impl ResolvedTypeReference { + /// Create a new resolved type reference + pub fn new( + target: SymbolId, + arguments: Vec, + original_name: String, + ) -> Self { + Self { + target, + arguments, + original_name, + } + } + + /// Check if this is a primitive type reference + pub fn is_primitive(&self, symbol_table: &SymbolTable) -> bool { + symbol_table + .get(&self.target) + .map(|info| matches!(info.kind, crate::SymbolKind::Primitive)) + .unwrap_or(false) + } + + /// Check if this is a generic type (has arguments) + pub fn is_generic(&self) -> bool { + !self.arguments.is_empty() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::{SymbolId, SymbolKind}; + + #[test] + fn test_symbol_table_basic_operations() { + let mut table = SymbolTable::new(); + + let user_id = SymbolId::struct_id(vec!["User".to_string()]); + let user_info = SymbolInfo { + id: user_id.clone(), + name: "User".to_string(), + path: vec!["User".to_string()], + kind: SymbolKind::Struct, + resolved: true, + dependencies: BTreeSet::new(), + }; + + table.register(user_info); + + assert!(table.get(&user_id).is_some()); + assert!(table.get_by_path(&["User".to_string()]).is_some()); + + let structs: Vec<_> = table.get_by_kind(&SymbolKind::Struct).collect(); + assert_eq!(structs.len(), 1); + } + + #[test] + fn test_symbol_table_dependencies() { + let mut table = SymbolTable::new(); + + let user_id = SymbolId::struct_id(vec!["User".to_string()]); + let post_id = SymbolId::struct_id(vec!["Post".to_string()]); + + table.register(SymbolInfo { + id: user_id.clone(), + name: "User".to_string(), + path: vec!["User".to_string()], + kind: SymbolKind::Struct, + resolved: true, + dependencies: BTreeSet::new(), + }); + + table.register(SymbolInfo { + id: post_id.clone(), + name: "Post".to_string(), + path: vec!["Post".to_string()], + kind: SymbolKind::Struct, + resolved: true, + dependencies: BTreeSet::new(), + }); + + table.add_dependency(post_id.clone(), user_id.clone()); + + let deps = table.get_dependencies(&post_id).unwrap(); + assert!(deps.contains(&user_id)); + + let sorted = table.topological_sort().unwrap(); + let user_pos = sorted.iter().position(|id| id == &user_id).unwrap(); + let post_pos = sorted.iter().position(|id| id == &post_id).unwrap(); + assert!( + user_pos < post_pos, + "User should come before Post in topological order" + ); + } + + #[test] + fn test_resolved_type_reference() { + let string_id = SymbolId::new(SymbolKind::Primitive, vec!["String".to_string()]); + let vec_id = SymbolId::new(SymbolKind::Struct, vec!["Vec".to_string()]); + + let string_ref = + ResolvedTypeReference::new(string_id.clone(), vec![], "String".to_string()); + + let vec_string_ref = + ResolvedTypeReference::new(vec_id, vec![string_ref], "Vec".to_string()); + + assert!(!vec_string_ref.arguments.is_empty()); + assert!(vec_string_ref.is_generic()); + assert_eq!(vec_string_ref.arguments[0].target, string_id); + } +} diff --git a/reflectapi-schema/src/symbol.rs b/reflectapi-schema/src/symbol.rs new file mode 100644 index 00000000..d7e40d19 --- /dev/null +++ b/reflectapi-schema/src/symbol.rs @@ -0,0 +1,184 @@ +/// Stable, unique identifier for symbols that persists across all pipeline stages +#[derive( + Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize, +)] +pub struct SymbolId { + pub kind: SymbolKind, + pub path: Vec, + pub disambiguator: u32, +} + +#[derive( + Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize, +)] +pub enum SymbolKind { + Struct, + Enum, + TypeAlias, + Endpoint, + Variant, + Field, + Primitive, +} + +/// Well-known stdlib and common crate types used in ReflectAPI schemas. +/// Each entry is (fully-qualified name, SymbolKind). +pub const STDLIB_TYPES: &[(&str, SymbolKind)] = &[ + ("std::option::Option", SymbolKind::Enum), + ("std::vec::Vec", SymbolKind::Primitive), + ("std::collections::HashMap", SymbolKind::Primitive), + ("std::collections::BTreeMap", SymbolKind::Primitive), + ("std::string::String", SymbolKind::Primitive), + ("std::tuple::Tuple0", SymbolKind::Primitive), + ("std::boxed::Box", SymbolKind::Primitive), + ("std::rc::Rc", SymbolKind::Primitive), + ("std::sync::Arc", SymbolKind::Primitive), + ("i32", SymbolKind::Primitive), + ("u32", SymbolKind::Primitive), + ("i64", SymbolKind::Primitive), + ("u64", SymbolKind::Primitive), + ("f32", SymbolKind::Primitive), + ("f64", SymbolKind::Primitive), + ("bool", SymbolKind::Primitive), + ("u8", SymbolKind::Primitive), + ("i8", SymbolKind::Primitive), + ("chrono::Utc", SymbolKind::Primitive), + ("chrono::FixedOffset", SymbolKind::Primitive), + ("chrono::DateTime", SymbolKind::Primitive), + ("uuid::Uuid", SymbolKind::Primitive), + ("url::Url", SymbolKind::Primitive), + ("serde_json::Value", SymbolKind::Primitive), +]; + +/// Prefixes that identify well-known stdlib and common crate types. +/// Used for broad matching when exact name lookup is not sufficient +/// (e.g., types not explicitly listed in STDLIB_TYPES). +pub const STDLIB_TYPE_PREFIXES: &[&str] = &["std::", "chrono::", "uuid::"]; + +impl Default for SymbolId { + fn default() -> Self { + Self { + kind: SymbolKind::Struct, + path: vec!["unknown".to_string()], + disambiguator: 0, + } + } +} + +impl SymbolId { + /// Create a new symbol ID with path and kind + pub fn new(kind: SymbolKind, path: Vec) -> Self { + Self { + kind, + path, + disambiguator: 0, + } + } + + /// Create a new symbol ID with disambiguation + pub fn with_disambiguator(kind: SymbolKind, path: Vec, disambiguator: u32) -> Self { + Self { + kind, + path, + disambiguator, + } + } + + /// Check if this is an unknown/default symbol ID + pub fn is_unknown(&self) -> bool { + self.path.len() == 1 && self.path[0] == "unknown" + } + + /// Create a symbol ID for a struct + pub fn struct_id(path: Vec) -> Self { + Self::new(SymbolKind::Struct, path) + } + + /// Create a symbol ID for an enum + pub fn enum_id(path: Vec) -> Self { + Self::new(SymbolKind::Enum, path) + } + + /// Create a symbol ID for an endpoint/function + pub fn endpoint_id(path: Vec) -> Self { + Self::new(SymbolKind::Endpoint, path) + } + + /// Create a symbol ID for a variant + pub fn variant_id(enum_path: Vec, variant_name: String) -> Self { + let mut path = enum_path; + path.push(variant_name); + Self::new(SymbolKind::Variant, path) + } + + /// Create a symbol ID for a field + pub fn field_id(parent_path: Vec, field_name: String) -> Self { + let mut path = parent_path; + path.push(field_name); + Self::new(SymbolKind::Field, path) + } + + /// Get the simple name (last component of path) + pub fn name(&self) -> Option<&str> { + self.path.last().map(|s| s.as_str()) + } + + /// Get the qualified name as a "::" separated string + pub fn qualified_name(&self) -> String { + self.path.join("::") + } + + /// Check if this is the same symbol (ignoring disambiguator) + pub fn same_symbol(&self, other: &SymbolId) -> bool { + self.kind == other.kind && self.path == other.path + } +} + +impl std::fmt::Display for SymbolId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}({})", self.kind, self.qualified_name())?; + if self.disambiguator > 0 { + write!(f, "#{}", self.disambiguator)?; + } + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_symbol_id_creation() { + let struct_id = SymbolId::struct_id(vec!["api".to_string(), "User".to_string()]); + assert_eq!(struct_id.kind, SymbolKind::Struct); + assert_eq!(struct_id.path, vec!["api", "User"]); + assert_eq!(struct_id.disambiguator, 0); + assert_eq!(struct_id.name(), Some("User")); + assert_eq!(struct_id.qualified_name(), "api::User"); + } + + #[test] + fn test_symbol_id_display() { + let struct_id = SymbolId::struct_id(vec!["api".to_string(), "User".to_string()]); + assert_eq!(format!("{struct_id}"), "Struct(api::User)"); + + let disambiguated = SymbolId::with_disambiguator( + SymbolKind::Struct, + vec!["api".to_string(), "User".to_string()], + 1, + ); + assert_eq!(format!("{disambiguated}"), "Struct(api::User)#1"); + } + + #[test] + fn test_same_symbol() { + let id1 = SymbolId::struct_id(vec!["api".to_string(), "User".to_string()]); + let id2 = SymbolId::with_disambiguator( + SymbolKind::Struct, + vec!["api".to_string(), "User".to_string()], + 1, + ); + assert!(id1.same_symbol(&id2)); + } +} diff --git a/reflectapi/src/builder/handler.rs b/reflectapi/src/builder/handler.rs index 290f678e..8a23d873 100644 --- a/reflectapi/src/builder/handler.rs +++ b/reflectapi/src/builder/handler.rs @@ -144,6 +144,7 @@ where .unwrap_or_default(); let function_def = Function { + id: Default::default(), name: rb.name.clone(), path: rb.path.clone(), deprecation_note: rb.deprecation_note, diff --git a/reflectapi/src/codegen/openapi.rs b/reflectapi/src/codegen/openapi.rs index e1747f60..e682061c 100644 --- a/reflectapi/src/codegen/openapi.rs +++ b/reflectapi/src/codegen/openapi.rs @@ -601,6 +601,7 @@ impl Converter<'_> { static STRING_TYPE: OnceLock = OnceLock::new(); return STRING_TYPE.get_or_init(|| { crate::Type::Primitive(crate::Primitive { + id: Default::default(), name: "std::string::String".into(), description: "UTF-8 encoded string".into(), parameters: vec![], @@ -811,6 +812,7 @@ impl Converter<'_> { crate::TypeReference::new(variant.name().to_owned(), type_ref.arguments.clone()); let mut strukt = crate::Struct { + id: Default::default(), name: variant.name().to_owned(), serde_name: variant.serde_name.to_owned(), description: variant.description().to_owned(), diff --git a/reflectapi/src/traits.rs b/reflectapi/src/traits.rs index 6ab001fa..e495ed7e 100644 --- a/reflectapi/src/traits.rs +++ b/reflectapi/src/traits.rs @@ -701,6 +701,7 @@ fn reflectapi_duration(schema: &mut crate::Typespace) -> crate::TypeReference { let type_name = "std::time::Duration"; if schema.reserve_type(type_name) { let type_def = crate::Struct { + id: Default::default(), name: type_name.into(), description: "Time duration type".into(), fields: crate::Fields::Named(vec![ From cef841372fc0656551a1c5a7d3cae6e45fe6428f Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Fri, 27 Mar 2026 15:59:02 +1300 Subject: [PATCH 06/47] fix: address PR review feedback - TypeConsolidationStage now rewrites type references after renaming conflicted types (fixes dangling references to old names) - ensure_symbol_ids uses separate seen maps per typespace and disambiguates output types that share an FQN with a different input type (prevents SymbolId collisions in the Normalizer) - Field::new and Variant::new use Default::default() for id so ensure_symbol_ids can assign proper parent-contextualized paths --- .../clients/typescript/generated.ts | 4 +- reflectapi-schema/src/ids.rs | 57 ++++++++++++++++++- reflectapi-schema/src/normalize.rs | 23 ++++++++ 3 files changed, 78 insertions(+), 6 deletions(-) diff --git a/reflectapi-demo/clients/typescript/generated.ts b/reflectapi-demo/clients/typescript/generated.ts index a83c1b9e..48c1f537 100644 --- a/reflectapi-demo/clients/typescript/generated.ts +++ b/reflectapi-demo/clients/typescript/generated.ts @@ -250,9 +250,7 @@ class ClientInstance { } type UnionToIntersection = ( - U extends any - ? (k: U) => unknown - : never + U extends any ? (k: U) => unknown : never ) extends (k: infer I) => void ? I : never; diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs index ce74f3a4..e87397fa 100644 --- a/reflectapi-schema/src/ids.rs +++ b/reflectapi-schema/src/ids.rs @@ -6,7 +6,12 @@ use crate::symbol::STDLIB_TYPES; use crate::{Enum, Schema, Struct, SymbolId, SymbolKind, Type, Typespace}; use std::collections::HashMap; -/// Ensure all symbols in the schema have unique, stable IDs based on their canonical names +/// Ensure all symbols in the schema have unique, stable IDs based on their canonical names. +/// +/// Types that share a fully-qualified name across input and output typespaces +/// receive distinct SymbolIds via the disambiguator field. This prevents +/// collisions when types with the same name have different definitions in +/// each typespace (e.g., request vs response variants of the same type). pub fn ensure_symbol_ids(schema: &mut Schema) { if schema.id.is_unknown() { schema.id = SymbolId::new(SymbolKind::Struct, vec![schema.name.clone()]); @@ -21,8 +26,36 @@ pub fn ensure_symbol_ids(schema: &mut Schema) { } } - assign_typespace_ids(&mut schema.input_types, &mut seen); - assign_typespace_ids(&mut schema.output_types, &mut seen); + // Use separate seen maps per typespace, sharing stdlib registrations. + // This ensures types with the same FQN in different typespaces get + // distinct SymbolIds (via disambiguator) when they are different types. + let mut input_seen = seen.clone(); + let mut output_seen = seen; + assign_typespace_ids(&mut schema.input_types, &mut input_seen); + assign_typespace_ids(&mut schema.output_types, &mut output_seen); + + // For any FQN that appears in both typespaces with different types, + // disambiguate the output typespace's IDs + for (fqn, input_id) in &input_seen { + if let Some(output_id) = output_seen.get(fqn) { + if input_id == output_id { + // Same ID means same type — check if the actual types differ + let input_ty = schema.input_types.get_type(fqn); + let output_ty = schema.output_types.get_type(fqn); + if let (Some(input_ty), Some(output_ty)) = (input_ty, output_ty) { + if input_ty != output_ty { + // Different types with same name — disambiguate output + let disambiguated = SymbolId::with_disambiguator( + output_id.kind, + output_id.path.clone(), + 1, + ); + assign_disambiguated_id(&mut schema.output_types, fqn, &disambiguated); + } + } + } + } + } } /// Pre-register well-known stdlib types that might be referenced but not always defined @@ -82,6 +115,24 @@ fn assign_type_id(fqn: &str, ty: &mut Type, seen: &mut HashMap } } +/// Reassign the top-level ID of a type in a typespace (for disambiguation) +fn assign_disambiguated_id(typespace: &mut Typespace, fqn: &str, new_id: &SymbolId) { + // Rebuild typespace with the updated ID + let types: Vec<_> = typespace.types().cloned().collect(); + let mut new_typespace = Typespace::new(); + for mut ty in types { + if ty.name() == fqn { + match &mut ty { + Type::Primitive(p) => p.id = new_id.clone(), + Type::Struct(s) => s.id = new_id.clone(), + Type::Enum(e) => e.id = new_id.clone(), + } + } + new_typespace.insert_type(ty); + } + *typespace = new_typespace; +} + /// Assign IDs to struct fields fn assign_struct_member_ids(s: &mut Struct, owner: &SymbolId) { match &mut s.fields { diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index 6f6ff717..ac3ca421 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -68,6 +68,8 @@ impl NormalizationStage for TypeConsolidationStage { let mut consolidated = Typespace::new(); let mut name_conflicts = HashMap::new(); + // Tracks old_name -> new_name for type reference rewriting + let mut rename_map: HashMap = HashMap::new(); let mut input_type_names = HashMap::new(); let mut output_type_names = HashMap::new(); @@ -95,8 +97,10 @@ impl NormalizationStage for TypeConsolidationStage { let mut new_type = ty.clone(); if name_conflicts.contains_key(&simple_name) { + let old_name = ty.name().to_string(); let new_name = format!("input.{simple_name}"); rename_type(&mut new_type, &new_name); + rename_map.insert(old_name, new_name); } consolidated.insert_type(new_type); @@ -107,8 +111,10 @@ impl NormalizationStage for TypeConsolidationStage { let mut new_type = ty.clone(); if name_conflicts.contains_key(&simple_name) { + let old_name = ty.name().to_string(); let new_name = format!("output.{simple_name}"); rename_type(&mut new_type, &new_name); + rename_map.insert(old_name, new_name); consolidated.insert_type(new_type); } else if !input_type_names.contains_key(&simple_name) { consolidated.insert_type(new_type); @@ -118,6 +124,23 @@ impl NormalizationStage for TypeConsolidationStage { schema.input_types = consolidated; schema.output_types = Typespace::new(); + // Rewrite type references that still point to old names + if !rename_map.is_empty() { + for function in &mut schema.functions { + update_type_reference_in_option(&mut function.input_type, &rename_map); + update_type_reference_in_option(&mut function.input_headers, &rename_map); + update_type_reference_in_option(&mut function.output_type, &rename_map); + update_type_reference_in_option(&mut function.error_type, &rename_map); + } + + let types_to_update: Vec<_> = schema.input_types.types().cloned().collect(); + schema.input_types = Typespace::new(); + for mut ty in types_to_update { + update_type_references_in_type(&mut ty, &rename_map); + schema.input_types.insert_type(ty); + } + } + Ok(()) } } From cb237a28ca03f711a9bc200115b698fb42817123 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Fri, 27 Mar 2026 16:09:20 +1300 Subject: [PATCH 07/47] style: fix formatting --- reflectapi-schema/src/ids.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs index e87397fa..ac33aa35 100644 --- a/reflectapi-schema/src/ids.rs +++ b/reflectapi-schema/src/ids.rs @@ -45,11 +45,8 @@ pub fn ensure_symbol_ids(schema: &mut Schema) { if let (Some(input_ty), Some(output_ty)) = (input_ty, output_ty) { if input_ty != output_ty { // Different types with same name — disambiguate output - let disambiguated = SymbolId::with_disambiguator( - output_id.kind, - output_id.path.clone(), - 1, - ); + let disambiguated = + SymbolId::with_disambiguator(output_id.kind, output_id.path.clone(), 1); assign_disambiguated_id(&mut schema.output_types, fqn, &disambiguated); } } From 66d60f57505a03cea4ec9555e7abc5bf7b4a798f Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Mar 2026 08:17:10 +0000 Subject: [PATCH 08/47] fix: address review comments on symbol ID and naming resolution bugs - ids.rs: Use struct/enum's actual ID (not seen-map ID) as owner for member ID assignment, fixing inconsistent parent-child paths when types have pre-assigned IDs - normalize.rs: Track all conflicting qualified names in name_usage (Vec per simple name), not just the first, so update_type_references_in_schema builds mappings for all conflicting types and avoids dangling references - normalize.rs: Fix generate_unique_name fallback to join all module parts instead of using module_parts[0], which would return an excluded part ("model"/"proto") and cause name collisions https://claude.ai/code/session_01UcJQe3CE12BFgqDiadkgii --- reflectapi-schema/src/ids.rs | 6 ++++-- reflectapi-schema/src/normalize.rs | 34 ++++++++++++++++++------------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs index ac33aa35..207b354d 100644 --- a/reflectapi-schema/src/ids.rs +++ b/reflectapi-schema/src/ids.rs @@ -101,13 +101,15 @@ fn assign_type_id(fqn: &str, ty: &mut Type, seen: &mut HashMap if s.id.is_unknown() { s.id = id.clone(); } - assign_struct_member_ids(s, &id); + let owner = s.id.clone(); + assign_struct_member_ids(s, &owner); } Type::Enum(e) => { if e.id.is_unknown() { e.id = id.clone(); } - assign_enum_member_ids(e, &id); + let owner = e.id.clone(); + assign_enum_member_ids(e, &owner); } } } diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index ac3ca421..7310ad89 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -174,19 +174,19 @@ impl NormalizationStage for NamingResolutionStage { } fn transform(&self, schema: &mut Schema) -> Result<(), Vec> { - let mut name_usage = HashMap::new(); + let mut name_usage: HashMap> = HashMap::new(); let mut name_conflicts = HashMap::new(); for ty in schema.input_types.types() { let qualified_name = ty.name().to_string(); let simple_name = extract_simple_name(&qualified_name); - if let Some(existing) = name_usage.get(&simple_name) { - if existing != &qualified_name { + let entries = name_usage.entry(simple_name.clone()).or_default(); + if !entries.contains(&qualified_name) { + if !entries.is_empty() { name_conflicts.insert(simple_name.clone(), true); } - } else { - name_usage.insert(simple_name, qualified_name); + entries.push(qualified_name); } } @@ -222,11 +222,13 @@ fn generate_unique_name(qualified_name: &str) -> String { let type_name = parts.last().unwrap(); let module_parts: Vec<&str> = parts[..parts.len() - 1].to_vec(); - let module_prefix = module_parts + let fallback = module_parts.join("_"); + let module_prefix: &str = module_parts .iter() .rev() .find(|&part| *part != "model" && *part != "proto" && !part.is_empty()) - .unwrap_or(&module_parts[0]); + .copied() + .unwrap_or(fallback.as_str()); let capitalized_prefix = capitalize_first_letter(module_prefix); format!("{capitalized_prefix}{type_name}") @@ -242,18 +244,22 @@ fn capitalize_first_letter(s: &str) -> String { fn update_type_references_in_schema( schema: &mut Schema, - name_usage: &HashMap, + name_usage: &HashMap>, name_conflicts: &HashMap, ) { let mut name_mapping = HashMap::new(); - for (simple_name, qualified_name) in name_usage { - let resolved_name = if name_conflicts.contains_key(simple_name) { - generate_unique_name(qualified_name) + for (simple_name, qualified_names) in name_usage { + if name_conflicts.contains_key(simple_name) { + for qualified_name in qualified_names { + let resolved_name = generate_unique_name(qualified_name); + name_mapping.insert(qualified_name.clone(), resolved_name); + } } else { - simple_name.clone() - }; - name_mapping.insert(qualified_name.clone(), resolved_name); + for qualified_name in qualified_names { + name_mapping.insert(qualified_name.clone(), simple_name.clone()); + } + } } for function in &mut schema.functions { From b911e5f8ceadc0cfa260e2fe6109a88b52f2b3f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Mar 2026 08:26:35 +0000 Subject: [PATCH 09/47] test: add regression tests for all three review comment bugs - test_pre_assigned_id_member_paths_consistent: verifies struct field ID paths use the struct's actual ID as parent prefix - test_pre_assigned_id_enum_member_paths_consistent: same for enums - test_naming_resolution_all_conflicting_types_have_references_rewritten: verifies function references to all conflicting types (not just the first) are rewritten to valid names after NamingResolutionStage - test_generate_unique_name_excluded_modules_no_collision: verifies model::Foo and model::proto::Foo produce different names - test_generate_unique_name_with_non_excluded_module: normal case https://claude.ai/code/session_01UcJQe3CE12BFgqDiadkgii --- reflectapi-schema/src/ids.rs | 74 ++++++++++++++++++++++++++++++ reflectapi-schema/src/normalize.rs | 67 +++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs index 207b354d..18c65a61 100644 --- a/reflectapi-schema/src/ids.rs +++ b/reflectapi-schema/src/ids.rs @@ -220,4 +220,78 @@ mod tests { let known = SymbolId::new(SymbolKind::Struct, vec!["MyType".to_string()]); assert!(!known.is_unknown()); } + + #[test] + fn test_pre_assigned_id_member_paths_consistent() { + // Regression: when a struct has a pre-assigned ID (e.g. from Struct::new), + // field IDs must use the struct's actual ID as their parent, not the + // seen-map ID which uses split_path and produces different path segments. + use crate::{Field, Fields}; + + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + // Struct::new("api::User") sets id.path = ["api::User"] (single unsplit element) + let mut s = crate::Struct::new("api::User"); + s.fields = Fields::Named(vec![Field::new("name".into(), "String".into())]); + schema.input_types.insert_type(s.into()); + + ensure_symbol_ids(&mut schema); + + let s = schema + .input_types + .get_type("api::User") + .unwrap() + .as_struct() + .unwrap(); + + // The struct's ID path should be preserved as-is + let struct_path = &s.id.path; + + // The field's path should start with the struct's actual path + let field = s.fields().next().unwrap(); + let field_path = &field.id.path; + + assert_eq!( + &field_path[..field_path.len() - 1], + struct_path.as_slice(), + "Field path prefix {:?} should match struct path {:?}", + field_path, + struct_path + ); + } + + #[test] + fn test_pre_assigned_id_enum_member_paths_consistent() { + // Same regression test for enums + use crate::Variant; + + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + let mut e = crate::Enum::new("api::Status".into()); + e.variants = vec![Variant::new("Active".into())]; + schema.input_types.insert_type(e.into()); + + ensure_symbol_ids(&mut schema); + + let e = schema + .input_types + .get_type("api::Status") + .unwrap() + .as_enum() + .unwrap(); + + let enum_path = &e.id.path; + let variant = &e.variants[0]; + let variant_path = &variant.id.path; + + assert_eq!( + &variant_path[..variant_path.len() - 1], + enum_path.as_slice(), + "Variant path prefix {:?} should match enum path {:?}", + variant_path, + enum_path + ); + } } diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index 7310ad89..d1429e8b 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -1559,4 +1559,71 @@ mod tests { assert!(semantic.types.is_empty()); assert!(semantic.functions.is_empty()); } + + #[test] + fn test_naming_resolution_all_conflicting_types_have_references_rewritten() { + // Regression: NamingResolutionStage only tracked the first qualified name + // per simple name in name_usage, leaving references to the second conflicting + // type dangling after rename. + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + // Two types sharing simple name "Foo" in different modules + let a_foo = Struct::new("a::Foo"); + let b_foo = Struct::new("b::Foo"); + schema.input_types.insert_type(a_foo.into()); + schema.input_types.insert_type(b_foo.into()); + + // Function referencing BOTH types + let mut func1 = Function::new("use_a_foo".into()); + func1.input_type = Some(TypeReference::new("a::Foo", vec![])); + schema.functions.push(func1); + + let mut func2 = Function::new("use_b_foo".into()); + func2.input_type = Some(TypeReference::new("b::Foo", vec![])); + schema.functions.push(func2); + + let stage = NamingResolutionStage; + stage.transform(&mut schema).unwrap(); + + // Collect all type names defined in the schema + let type_names: std::collections::HashSet = schema + .input_types + .types() + .map(|t| t.name().to_string()) + .collect(); + + // Both function references must point to names that exist in the schema + for func in &schema.functions { + if let Some(ref input_type) = func.input_type { + assert!( + type_names.contains(&input_type.name), + "Function '{}' references type '{}' which doesn't exist in schema. Available: {:?}", + func.name, input_type.name, type_names + ); + } + } + } + + #[test] + fn test_generate_unique_name_excluded_modules_no_collision() { + // Regression: when all module parts are in the exclusion list ("model", "proto"), + // the fallback was module_parts[0], causing "model::Foo" and "model::proto::Foo" + // to both become "ModelFoo". Now uses joined fallback to avoid collisions. + let name1 = generate_unique_name("model::Foo"); + let name2 = generate_unique_name("model::proto::Foo"); + + assert_ne!( + name1, name2, + "model::Foo and model::proto::Foo must produce different names, got '{}' and '{}'", + name1, name2 + ); + } + + #[test] + fn test_generate_unique_name_with_non_excluded_module() { + // Normal case: module part not in exclusion list is used as prefix + let name = generate_unique_name("billing::Invoice"); + assert_eq!(name, "BillingInvoice"); + } } From 7f9abf909fd2ebd5e9894f97e21b6fc55a3f4de8 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Fri, 27 Mar 2026 22:42:22 +1300 Subject: [PATCH 10/47] style: fix uninlined format args in new tests --- reflectapi-schema/src/ids.rs | 8 ++------ reflectapi-schema/src/normalize.rs | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs index 18c65a61..676370e4 100644 --- a/reflectapi-schema/src/ids.rs +++ b/reflectapi-schema/src/ids.rs @@ -255,9 +255,7 @@ mod tests { assert_eq!( &field_path[..field_path.len() - 1], struct_path.as_slice(), - "Field path prefix {:?} should match struct path {:?}", - field_path, - struct_path + "Field path prefix {field_path:?} should match struct path {struct_path:?}" ); } @@ -289,9 +287,7 @@ mod tests { assert_eq!( &variant_path[..variant_path.len() - 1], enum_path.as_slice(), - "Variant path prefix {:?} should match enum path {:?}", - variant_path, - enum_path + "Variant path prefix {variant_path:?} should match enum path {enum_path:?}" ); } } diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index d1429e8b..0e165978 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -1615,8 +1615,7 @@ mod tests { assert_ne!( name1, name2, - "model::Foo and model::proto::Foo must produce different names, got '{}' and '{}'", - name1, name2 + "model::Foo and model::proto::Foo must produce different names, got '{name1}' and '{name2}'" ); } From 2b7a97f1e70a6265f51834bff426698fd624df65 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 09:52:38 +1300 Subject: [PATCH 11/47] fix(python): wire-compatible flatten for internally-tagged enums (#123) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For structs with `#[serde(flatten)]` on an internally-tagged enum, generate per-variant models that merge parent struct fields + variant fields + tag discriminator, then emit a discriminated union RootModel. This matches the flat wire format serde produces. Before: `Offer` had only `id: str` (enum fields silently dropped) After: `Offer` is a RootModel union of `OfferSingle{id,type,business}` and `OfferGroup{id,type,count}` — wire-compatible with serde Also: - Compose NormalizationPipeline into Normalizer (runs TypeConsolidation, NamingResolution, CircularDependencyResolution before IR construction) - Add snapshot tests for flattened externally-tagged, adjacently-tagged, and untagged enums - Document Boxing strategy as intentional no-op (Rust schemas already encode Box); add integration tests for self-referential and multi-type circular dependency normalization - Add docs/architecture.md covering semantic IR pipeline, codegen backends, and flattened type handling --- docs/architecture.md | 459 +++++++++++++++ reflectapi-demo/src/tests/serde.rs | 93 +++ ...latten_adjacently_tagged_enum_field-2.snap | 75 +++ ...latten_adjacently_tagged_enum_field-3.snap | 78 +++ ...latten_adjacently_tagged_enum_field-4.snap | 127 +++++ ...latten_adjacently_tagged_enum_field-5.snap | 247 ++++++++ ..._flatten_adjacently_tagged_enum_field.snap | 189 ++++++ ...latten_externally_tagged_enum_field-2.snap | 74 +++ ...latten_externally_tagged_enum_field-3.snap | 77 +++ ...latten_externally_tagged_enum_field-4.snap | 123 ++++ ...latten_externally_tagged_enum_field-5.snap | 248 ++++++++ ..._flatten_externally_tagged_enum_field.snap | 191 +++++++ ...latten_internally_tagged_enum_field-2.snap | 71 +++ ...latten_internally_tagged_enum_field-3.snap | 78 +++ ...latten_internally_tagged_enum_field-4.snap | 109 ++++ ...latten_internally_tagged_enum_field-5.snap | 225 ++++++++ ..._flatten_internally_tagged_enum_field.snap | 187 ++++++ ..._serde__flatten_untagged_enum_field-2.snap | 69 +++ ..._serde__flatten_untagged_enum_field-3.snap | 78 +++ ..._serde__flatten_untagged_enum_field-4.snap | 101 ++++ ..._serde__flatten_untagged_enum_field-5.snap | 180 ++++++ ...s__serde__flatten_untagged_enum_field.snap | 179 ++++++ reflectapi-schema/src/normalize.rs | 111 +++- reflectapi/src/codegen/python.rs | 538 +++++++++++++++--- 24 files changed, 3829 insertions(+), 78 deletions(-) create mode 100644 docs/architecture.md create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field.snap diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 00000000..d2d047f5 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,459 @@ +# ReflectAPI Architecture + +## 1. Overview + +ReflectAPI is a Rust framework for defining web API services and generating 100%-compatible, type-safe clients in multiple languages. The core idea: you write Rust handler functions with strongly-typed inputs and outputs, derive macros capture the type information into a JSON schema, and code generation backends produce idiomatic clients for TypeScript, Rust, Python, and OpenAPI specs. + +The system is designed around a multi-stage pipeline: + +1. **Derive macros** extract type metadata at compile time into a raw `Schema`. +2. The schema is serialized to JSON (`reflectapi.json`), forming the contract between server and clients. +3. At codegen time, the schema is deserialized, normalized through a pipeline of transformations, and fed to language-specific backends that emit client code. + +## 2. Crate Structure + +``` +reflectapi/ Workspace root + reflectapi-schema/ Core schema types, semantic IR, normalization pipeline + reflectapi-derive/ Proc macros: #[derive(Input, Output, reflectapi::Input, ...)] + reflectapi/ Builder, codegen backends, runtime (axum integration, etc.) + reflectapi-cli/ CLI tool wrapping codegen (clap-based) + reflectapi-demo/ Demo application with snapshot tests (insta) + reflectapi-python-runtime/ Python runtime support library + docs/ User-facing documentation (mdbook) +``` + +### reflectapi-schema + +The foundational crate. Contains: + +- **Raw schema types** (`Schema`, `Function`, `Type`, `Struct`, `Enum`, `Field`, `Variant`, `TypeReference`, `Representation`, `Primitive`, `Typespace`) -- the serializable representation of an API. +- **SymbolId and SymbolKind** -- stable unique identifiers for all schema symbols. +- **ensure_symbol_ids()** -- post-deserialization ID assignment. +- **NormalizationPipeline** -- multi-stage schema transformation (type consolidation, naming, circular dependency resolution). +- **Normalizer** -- converts raw `Schema` into validated `SemanticSchema`. +- **SemanticSchema** -- immutable, fully-resolved intermediate representation. +- **Visitor/VisitMut** -- generic traversal utilities. +- **Substitute/Instantiate** -- generic type parameter substitution. +- **Rename/Glob** -- type renaming and glob-based filtering. + +### reflectapi-derive + +Procedural macros that implement `#[derive(Input)]` and `#[derive(Output)]`. These parse Rust struct/enum definitions (including all serde attributes) and emit code that registers the type into the `Schema` at build time. + +Key source files: +- `lib.rs` -- macro entry points +- `parser.rs` -- serde attribute parsing +- `context.rs` -- code generation context +- `derive.rs` -- the derive implementation +- `tokenizable_schema.rs` -- converts schema types to token streams + +### reflectapi + +The main user-facing crate. Contains: +- **Builder** -- runtime schema construction and handler registration. +- **Codegen backends** -- `typescript`, `rust`, `python`, `openapi` modules under `src/codegen/`. +- **Runtime integration** -- axum handler adapters, serialization modes (JSON, msgpack). +- **Format utilities** -- post-generation formatting (prettier, rustfmt, ruff). + +### reflectapi-cli + +A thin CLI wrapper using `clap`. Reads a `reflectapi.json` schema file and invokes the appropriate codegen backend: + +``` +reflectapi codegen --language typescript --schema reflectapi.json --output ./clients/ts +``` + +Supports flags for formatting, typechecking, tag filtering, shared modules (Rust), and tracing instrumentation. + +### reflectapi-demo + +A working demo server with snapshot tests. The `reflectapi.json` file and generated clients (TypeScript, Rust, Python) are checked in and validated by `cargo insta` snapshot tests, ensuring codegen output is stable across changes. + +## 3. Schema Types + +The raw schema is a JSON-serializable representation of a Rust API. The core types in `reflectapi-schema/src/lib.rs`: + +### Schema + +Top-level container holding the API definition: + +```rust +pub struct Schema { + pub name: String, + pub description: String, + pub functions: Vec, + pub input_types: Typespace, // Types used in request positions + pub output_types: Typespace, // Types used in response positions +} +``` + +The separation into `input_types` and `output_types` allows the same Rust type name to have different shapes in request vs response contexts. The `TypeConsolidationStage` merges these during normalization. + +### Function + +An API endpoint: + +```rust +pub struct Function { + pub name: String, // e.g. "users.login" + pub path: String, // URL path, e.g. "/api/v1" + pub input_type: Option, + pub input_headers: Option, + pub output_type: Option, + pub error_type: Option, + pub serialization: Vec, + pub readonly: bool, + pub tags: BTreeSet, +} +``` + +### Type + +A sum type covering all possible type definitions: + +```rust +pub enum Type { + Primitive(Primitive), // Opaque types (String, i32, Uuid, etc.) + Struct(Struct), // Named/unnamed fields, tuple structs + Enum(Enum), // Tagged/untagged unions with variants +} +``` + +### TypeReference + +A reference to a type, including generic arguments: + +```rust +pub struct TypeReference { + pub name: String, // Fully-qualified name, e.g. "std::vec::Vec" + pub arguments: Vec, // Generic type arguments +} +``` + +### Representation + +Captures serde's enum tagging strategy: + +```rust +pub enum Representation { + External, // {"variant": {...}} + Internal { tag: String }, // {"type": "variant", ...} + Adjacent { tag: String, content: String }, // {"t": "variant", "c": {...}} + None, // untagged +} +``` + +### Fields, Field, Variant + +Fields can be `Named`, `Unnamed` (tuple), or `None` (unit). Each `Field` carries: +- `name` / `serde_name` -- the Rust name and the wire name (after serde rename) +- `type_ref` -- the field's type +- `required` -- whether the field must be present +- `flattened` -- whether `#[serde(flatten)]` is applied +- `description` / `deprecation_note` -- documentation metadata + +## 4. Semantic IR Pipeline + +The pipeline transforms a raw, deserialized `Schema` into a validated, immutable `SemanticSchema` suitable for code generation. This is a multi-phase process. + +### Pipeline Overview + +``` + +--------------------------+ + reflectapi.json ----------> | JSON Deserialization | + +--------------------------+ + | + v + +--------------------------+ + | ensure_symbol_ids() | Assign stable SymbolIds + +--------------------------+ + | + v + +--------------------------+ + | NormalizationPipeline | + | 1. TypeConsolidation | Merge input/output typespaces + | 2. NamingResolution | Strip module paths, resolve conflicts + | 3. CircularDependency | Detect cycles via Tarjan's SCC + +--------------------------+ + | + v + +--------------------------+ + | Normalizer | + | Phase 1: Discovery | Register all symbols + | Phase 2: Resolution | Resolve type references + | Phase 3: Dependencies | Build dependency graph + | Phase 4: Validation | Semantic checks + | Phase 5: IR Build | Construct SemanticSchema + +--------------------------+ + | + v + +--------------------------+ + | SemanticSchema | Immutable, validated IR + +--------------------------+ +``` + +### SymbolId + +Every symbol in the schema (types, functions, fields, variants) gets a stable, unique identifier: + +```rust +pub struct SymbolId { + pub kind: SymbolKind, // Struct, Enum, Endpoint, Field, Variant, Primitive, TypeAlias + pub path: Vec, // e.g. ["api", "User"] + pub disambiguator: u32, // Distinguishes same-name types across input/output +} +``` + +The `SymbolId` is the primary key for all lookups throughout the pipeline and in the final `SemanticSchema`. The `disambiguator` field handles the case where input and output typespaces define different types with the same fully-qualified name. + +### ensure_symbol_ids() + +When a schema is deserialized from JSON, all `SymbolId` fields have their default ("unknown") values. `ensure_symbol_ids()` walks the schema and assigns stable IDs based on canonical names: + +1. Pre-registers well-known stdlib types (`String`, `Vec`, `Option`, `HashMap`, etc.) +2. Assigns IDs to functions based on their names. +3. Assigns IDs to types in each typespace, using separate seen-maps so cross-typespace conflicts are detected. +4. When the same FQN appears in both typespaces with different type definitions, the output typespace's copy gets a disambiguated ID (disambiguator = 1). +5. Assigns IDs to struct fields and enum variants as children of their parent's path. + +### NormalizationPipeline + +The standard pipeline applies three stages in sequence: + +**Stage 1: TypeConsolidationStage** -- Merges `input_types` and `output_types` into a single unified `input_types` collection. When a type name appears in both typespaces: +- If the types are identical, the input version is kept. +- If they differ, they're renamed with `input.` / `output.` prefixes, and all type references throughout the schema are rewritten to point to the new names. + +**Stage 2: NamingResolutionStage** -- Strips module path prefixes from type names (e.g. `myapp::proto::User` becomes `User`). When stripping creates a conflict (two different types both resolve to `User`), a unique name is generated by incorporating the module prefix (e.g. `ProtoUser` vs `ApiUser`). Common module names like `model` and `proto` are skipped when building the prefix. + +**Stage 3: CircularDependencyResolutionStage** -- Detects circular type dependencies using Tarjan's strongly-connected components (SCC) algorithm. Supports multiple resolution strategies: +- `Intelligent` (default) -- self-references use boxing; multi-type cycles use forward declarations. +- `Boxing` -- wrap cyclic references in `Box` (currently a no-op since Rust schemas already encode boxing). +- `ForwardDeclarations`, `OptionalBreaking`, `ReferenceCounted` -- planned strategies (currently stubs). + +The cycle detection itself is valuable even when resolution is a no-op, as downstream codegen backends can use this information to emit forward-reference annotations. + +### Normalizer + +The `Normalizer` orchestrates the full conversion from `Schema` to `SemanticSchema`: + +1. **Phase 0**: Calls `ensure_symbol_ids()` and runs `NormalizationPipeline::standard()`. +2. **Phase 1 (Symbol Discovery)**: Walks the schema and registers every type, function, field, and variant in the `SymbolTable`. +3. **Phase 2 (Type Resolution)**: Resolves all `TypeReference` names to `SymbolId` targets, producing `ResolvedTypeReference` values with guaranteed validity. +4. **Phase 3 (Dependency Analysis)**: Builds a dependency graph in the `SymbolTable` and performs topological sorting. +5. **Phase 4 (Semantic Validation)**: Checks for unresolved references, conflicting definitions, and invalid generic parameters. +6. **Phase 5 (IR Construction)**: Builds the final `SemanticSchema` with `BTreeMap`-ordered collections for deterministic output. + +### SemanticSchema + +The final, immutable output of the pipeline: + +```rust +pub struct SemanticSchema { + pub functions: BTreeMap, + pub types: BTreeMap, + pub symbol_table: SymbolTable, +} +``` + +Key differences from the raw `Schema`: +- **Immutable** -- no mutation after construction. +- **Fully resolved** -- all type references are `ResolvedTypeReference` with guaranteed valid `SymbolId` targets. +- **Deterministically ordered** -- `BTreeMap`/`BTreeSet` everywhere for stable codegen output. +- **Single typespace** -- input/output distinction has been resolved. +- **Dependency graph** -- the `SymbolTable` contains dependency edges and supports topological sorting. + +## 5. Code Generation Backends + +All backends live in `reflectapi/src/codegen/`. Each reads the raw `Schema` (the semantic IR pipeline is not yet wired into the codegen path -- see Current Status) and produces language-specific output. + +### TypeScript + +Uses the `askama` template engine. Key design decisions: + +- **Interfaces** for struct types with named fields. +- **Type aliases** for tuple structs and transparent wrappers. +- **Intersection types** (`&`) for `#[serde(flatten)]` -- flattened fields are rendered as separate type references joined with `&`. +- **Discriminated unions** for tagged enums. +- **`NullToEmptyObject`** helper to handle the interaction between Rust `()` (which maps to `null`) and intersection types. +- Output is formatted with `prettier`. + +### Rust + +Mirrors the source Rust types, re-emitting struct/enum definitions with appropriate `#[serde(...)]` attributes. Key features: + +- Preserves `#[serde(flatten)]` on fields that had it in the original. +- Handles shared modules -- types from specified module prefixes are imported rather than regenerated. +- Generates a client module with async functions for each endpoint. +- Output is formatted with `rustfmt`. + +### Python + +Generates Pydantic v2 models. Key features: + +- **BaseModel classes** for structs. +- **Discriminated unions** (`Union[..., Field(discriminator="tag")]`) for internally-tagged enums. +- **RootModel** wrappers for union types and single-field tuple structs. +- Special handling for `#[serde(flatten)]` with internally-tagged enums (see Section 6). +- **Field aliases** for serde-renamed fields. +- **Literal types** for discriminator fields. +- Python reserved words are sanitized in field names with alias mapping. +- Output is formatted with `ruff`. + +### OpenAPI + +Generates an OpenAPI 3.0 specification (JSON). Key features: + +- **`$ref`** for type references, with inline expansion for simple cases. +- **`allOf`** composition for `#[serde(flatten)]` -- the parent object schema and each flattened type schema are combined under `allOf`. +- **`oneOf`** for enum variants (tagged and untagged). +- **`discriminator`** property for internally-tagged enums. +- Rendered via Redoc for documentation. + +## 6. Flattened Type Handling + +`#[serde(flatten)]` is one of the most complex serde features to handle across languages because it merges fields from one type into another at the wire level. The challenge is especially acute for internally-tagged enums, where the tag field and variant fields are merged flat into the parent struct. + +### Wire Format + +Given this Rust code: + +```rust +#[derive(Serialize, Deserialize)] +struct Request { + id: String, + #[serde(flatten)] + payload: Action, +} + +#[derive(Serialize, Deserialize)] +#[serde(tag = "type")] +enum Action { + Create { name: String }, + Delete { reason: Option }, +} +``` + +Serde produces this JSON for `Request { id: "1", payload: Action::Create { name: "foo" } }`: + +```json +{"id": "1", "type": "Create", "name": "foo"} +``` + +All fields are merged flat -- there is no nesting. The codegen backends must produce types that match this exact wire format. + +### TypeScript + +Uses intersection types to compose the parent fields with the flattened type: + +```typescript +type Request = { + id: string; +} & NullToEmptyObject; +``` + +The `NullToEmptyObject` wrapper handles the edge case where a flattened type resolves to `null` (Rust `()`), preventing `{...} & null` from collapsing to `never`. + +For optional flattened fields, `Partial` is used instead. + +### Python (standard flatten) + +For flattened structs (not enums), all fields from the flattened type are expanded inline into the parent Pydantic model: + +```python +class Request(BaseModel): + id: str + # Fields from FlattenedStruct expanded here: + extra_field: str +``` + +### Python (internally-tagged enum flatten) + +This is the most complex case. When a struct flattens an internally-tagged enum, per-variant models are generated that merge the parent's fields, the tag discriminator, and the variant's fields: + +```python +class RequestCreate(BaseModel): + """'Create' variant of Request""" + id: str + type: Literal['Create'] = "Create" + name: str + +class RequestDelete(BaseModel): + """'Delete' variant of Request""" + id: str + type: Literal['Delete'] = "Delete" + reason: str | None = None + +class Request(RootModel): + root: Annotated[ + Union[ + RequestCreate, + RequestDelete, + ], + Field(discriminator="type"), + ] +``` + +Each per-variant model contains all parent struct fields, the `Literal`-typed tag discriminator, and the variant-specific fields. The parent type becomes a `RootModel` with a discriminated union. + +The implementation handles several edge cases: +- **Unnamed variants** with a single field: the inner struct's fields are expanded. +- **Box-wrapped variants**: `Box` is unwrapped to get the inner type. +- **Optional flattened fields**: all expanded fields become optional. +- **Multiple flattened structs**: non-enum flattened structs are also expanded into each variant model. + +### OpenAPI + +Uses `allOf` composition: + +```json +{ + "allOf": [ + { "$ref": "#/components/schemas/Action" }, + { + "type": "object", + "properties": { + "id": { "type": "string" } + }, + "required": ["id"] + } + ] +} +``` + +For enums, `oneOf` is used for the variant schemas, and `discriminator` is set for internally-tagged enums. + +### Rust + +Preserves the original `#[serde(flatten)]` attribute on the field, since the generated Rust client uses serde directly and the attribute works as-is. + +## 7. Current Status and Roadmap + +### Complete + +- **Raw schema types** and JSON serialization -- stable and well-tested. +- **Derive macros** -- full support for serde attributes including rename, skip, flatten, tag, default. +- **TypeScript codegen** -- stable, with intersection types for flatten. +- **Rust codegen** -- stable, mirrors source types. +- **Python codegen** -- experimental but functional, including the complex flatten+internal-tag case. +- **OpenAPI codegen** -- stable, allOf/oneOf composition. +- **CLI tool** -- feature-complete with tag filtering, formatting, typechecking options. +- **Snapshot testing** -- comprehensive insta-based tests for all codegen outputs. + +### In Progress + +- **Semantic IR pipeline (related to #96)** -- The `SymbolId`, `ensure_symbol_ids()`, `NormalizationPipeline`, `Normalizer`, and `SemanticSchema` infrastructure is implemented in `reflectapi-schema` but is not yet wired into the codegen backends. The codegen backends currently consume the raw `Schema` directly. The goal is to have all backends consume `SemanticSchema` instead, which provides: + - Guaranteed resolved references (no dangling type names). + - Deterministic ordering for stable output. + - Dependency-aware topological ordering. + - A single unified typespace. + +- **Flattened internally-tagged enum handling (#123)** -- The Python backend has full support. TypeScript handles it via intersection types (which works but is less precise than per-variant types). OpenAPI uses allOf composition. Further improvements may align all backends on a common strategy. + +### Known Gaps + +- **CircularDependencyResolutionStage** -- Cycle detection works (Tarjan's SCC), but resolution strategies beyond boxing are stubs (`ForwardDeclarations`, `OptionalBreaking`, `ReferenceCounted` are TODO). +- **Codegen consuming SemanticSchema** -- The transition from raw `Schema` to `SemanticSchema` in the codegen path is not yet complete. +- **Python codegen** -- Marked experimental. Some edge cases in generics and complex nested flatten scenarios may not be fully covered. +- **chrono-tz support** -- Recently added (#117), may have edge cases. diff --git a/reflectapi-demo/src/tests/serde.rs b/reflectapi-demo/src/tests/serde.rs index da32ed2c..84df03f3 100644 --- a/reflectapi-demo/src/tests/serde.rs +++ b/reflectapi-demo/src/tests/serde.rs @@ -612,6 +612,99 @@ fn test_flatten_internally_tagged() { assert_snapshot!(Test); } +/// Regression test for issue #123: flattened internally-tagged enum fields +/// were silently dropped by the Python codegen. +#[test] +fn test_flatten_internally_tagged_enum_field() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "type")] + enum OfferKind { + Single { business: String }, + Group { count: u32 }, + } + + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Offer { + id: String, + #[serde(flatten)] + payload: OfferKind, + } + + assert_snapshot!(Offer); +} + +#[test] +fn test_flatten_externally_tagged_enum_field() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + enum Shape { + Circle { radius: f64 }, + Rect { width: f64, height: f64 }, + } + + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Drawing { + name: String, + #[serde(flatten)] + shape: Shape, + } + + assert_snapshot!(Drawing); +} + +#[test] +fn test_flatten_adjacently_tagged_enum_field() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "kind", content = "data")] + enum Payload { + Text { body: String }, + Binary { size: u32 }, + } + + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Message { + id: String, + #[serde(flatten)] + payload: Payload, + } + + assert_snapshot!(Message); +} + +#[test] +fn test_flatten_untagged_enum_field() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(untagged)] + enum Value { + Num { value: f64 }, + Text { text: String }, + } + + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Cell { + label: String, + #[serde(flatten)] + content: Value, + } + + assert_snapshot!(Cell); +} + #[test] fn test_struct_repr_transparent_generic_inner_type() { #[derive(serde::Deserialize, serde::Serialize, reflectapi::Input, reflectapi::Output)] diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-2.snap new file mode 100644 index 00000000..21408207 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-2.snap @@ -0,0 +1,75 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Message > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Message, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Message = { + id: string; + } & NullToEmptyObject; + + export type Payload = + | { + kind: "Text"; + data: { + body: string; + }; + } + | { + kind: "Binary"; + data: { + size: number /* u32 */; + }; + }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Message, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Message, + {}, + reflectapi_demo.tests.serde.Message, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-3.snap new file mode 100644 index 00000000..7eabedda --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-3.snap @@ -0,0 +1,78 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Message > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Message, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Message, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Message { + pub id: std::string::String, + #[serde(flatten)] + pub payload: super::super::super::reflectapi_demo::tests::serde::Payload, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "kind", content = "data")] + pub enum Payload { + Text { body: std::string::String }, + Binary { size: u32 }, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-4.snap new file mode 100644 index 00000000..fc1e338c --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-4.snap @@ -0,0 +1,127 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Message" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Message" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Message": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Payload" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Message", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Payload": { + "oneOf": [ + { + "type": "object", + "title": "Text", + "required": [ + "data", + "kind" + ], + "properties": { + "data": { + "type": "object", + "title": "Text", + "required": [ + "body" + ], + "properties": { + "body": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "kind": { + "const": "Text" + } + } + }, + { + "type": "object", + "title": "Binary", + "required": [ + "data", + "kind" + ], + "properties": { + "data": { + "type": "object", + "title": "Binary", + "required": [ + "size" + ], + "properties": { + "size": { + "$ref": "#/components/schemas/u32" + } + } + }, + "kind": { + "const": "Binary" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap new file mode 100644 index 00000000..3a72377f --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -0,0 +1,247 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Message > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdePayloadTextVariant(BaseModel): + """Text variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + body: str + + +class ReflectapiDemoTestsSerdePayloadBinaryVariant(BaseModel): + """Binary variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + size: int + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdePayloadVariants = Union[ + ReflectapiDemoTestsSerdePayloadTextVariant, + ReflectapiDemoTestsSerdePayloadBinaryVariant, +] + + +class ReflectapiDemoTestsSerdePayload( + RootModel[ReflectapiDemoTestsSerdePayloadVariants] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdePayloadTextVariant, + ReflectapiDemoTestsSerdePayloadBinaryVariant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("kind") + content = data.get("data") + if tag is None: + raise ValueError("Missing tag field 'kind'") + if content is None and tag not in (): + raise ValueError("Missing content field 'data' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "Text": + return ReflectapiDemoTestsSerdePayloadTextVariant(**content) + if tag == "Binary": + return ReflectapiDemoTestsSerdePayloadBinaryVariant(**content) + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdePayload: {}".format(data) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdePayloadTextVariant): + return {"kind": "Text", "data": self.root.model_dump(exclude_none=True)} + if isinstance(self.root, ReflectapiDemoTestsSerdePayloadBinaryVariant): + return {"kind": "Binary", "data": self.root.model_dump(exclude_none=True)} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdePayload variant: {type(self.root)}" + ) + + +class ReflectapiDemoTestsSerdeMessage(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + payload: ReflectapiDemoTestsSerdePayload + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[ReflectapiDemoTestsSerdeMessage] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeMessage]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeMessage]: Response containing ReflectapiDemoTestsSerdeMessage data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeMessage, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[ReflectapiDemoTestsSerdeMessage] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeMessage]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeMessage]: Response containing ReflectapiDemoTestsSerdeMessage data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeMessage, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + ReflectapiDemoTestsSerdeMessage.model_rebuild() + ReflectapiDemoTestsSerdePayload.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class ReflectapiDemoTestsSerdePayloadFactory: + """Factory class for creating ReflectapiDemoTestsSerdePayload variants with ergonomic syntax. + + ReflectapiDemoTestsSerdePayload variants + """ + + @staticmethod + def text(body) -> ReflectapiDemoTestsSerdePayload: + """Creates the 'Text' variant of the ReflectapiDemoTestsSerdePayload enum.""" + return ReflectapiDemoTestsSerdePayload( + ReflectapiDemoTestsSerdePayloadTextVariant(body=body) + ) + + @staticmethod + def binary(size) -> ReflectapiDemoTestsSerdePayload: + """Creates the 'Binary' variant of the ReflectapiDemoTestsSerdePayload enum.""" + return ReflectapiDemoTestsSerdePayload( + ReflectapiDemoTestsSerdePayloadBinaryVariant(size=size) + ) + + +# Testing utilities + + +def create_reflectapidemotestsserdemessage_response( + value: ReflectapiDemoTestsSerdeMessage, +) -> ApiResponse[ReflectapiDemoTestsSerdeMessage]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdeMessage.""" + return create_api_response(value) + + +def create_reflectapidemotestsserdepayload_response( + value: ReflectapiDemoTestsSerdePayload, +) -> ApiResponse[ReflectapiDemoTestsSerdePayload]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdePayload.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field.snap new file mode 100644 index 00000000..21bafe2f --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field.snap @@ -0,0 +1,189 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Message" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Message" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Message", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "payload", + "type": { + "name": "reflectapi_demo::tests::serde::Payload" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Payload", + "representation": { + "adjacent": { + "tag": "kind", + "content": "data" + } + }, + "variants": [ + { + "name": "Text", + "fields": { + "named": [ + { + "name": "body", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Binary", + "fields": { + "named": [ + { + "name": "size", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Message", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "payload", + "type": { + "name": "reflectapi_demo::tests::serde::Payload" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Payload", + "representation": { + "adjacent": { + "tag": "kind", + "content": "data" + } + }, + "variants": [ + { + "name": "Text", + "fields": { + "named": [ + { + "name": "body", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Binary", + "fields": { + "named": [ + { + "name": "size", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-2.snap new file mode 100644 index 00000000..bee20758 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-2.snap @@ -0,0 +1,74 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Drawing > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Drawing, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Drawing = { + name: string; + } & NullToEmptyObject; + + export type Shape = + | { + Circle: { + radius: number /* f64 */; + }; + } + | { + Rect: { + width: number /* f64 */; + height: number /* f64 */; + }; + }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Drawing, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Drawing, + {}, + reflectapi_demo.tests.serde.Drawing, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-3.snap new file mode 100644 index 00000000..b23b25c2 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-3.snap @@ -0,0 +1,77 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Drawing > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Drawing, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Drawing, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Drawing { + pub name: std::string::String, + #[serde(flatten)] + pub shape: super::super::super::reflectapi_demo::tests::serde::Shape, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub enum Shape { + Circle { radius: f64 }, + Rect { width: f64, height: f64 }, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-4.snap new file mode 100644 index 00000000..b6051693 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-4.snap @@ -0,0 +1,123 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Drawing" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Drawing" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "f64": { + "description": "64-bit floating point number", + "type": "number" + }, + "reflectapi_demo.tests.serde.Drawing": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Shape" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Drawing", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Shape": { + "oneOf": [ + { + "type": "object", + "title": "Circle", + "required": [ + "Circle" + ], + "properties": { + "Circle": { + "type": "object", + "title": "Circle", + "required": [ + "radius" + ], + "properties": { + "radius": { + "$ref": "#/components/schemas/f64" + } + } + } + } + }, + { + "type": "object", + "title": "Rect", + "required": [ + "Rect" + ], + "properties": { + "Rect": { + "type": "object", + "title": "Rect", + "required": [ + "height", + "width" + ], + "properties": { + "height": { + "$ref": "#/components/schemas/f64" + }, + "width": { + "$ref": "#/components/schemas/f64" + } + } + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap new file mode 100644 index 00000000..3248521a --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -0,0 +1,248 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Drawing > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeShapeCircleVariant(BaseModel): + """Circle variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + radius: float + + +class ReflectapiDemoTestsSerdeShapeRectVariant(BaseModel): + """Rect variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + width: float + height: float + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeShapeVariants = Union[ + ReflectapiDemoTestsSerdeShapeCircleVariant, ReflectapiDemoTestsSerdeShapeRectVariant +] + + +class ReflectapiDemoTestsSerdeShape(RootModel[ReflectapiDemoTestsSerdeShapeVariants]): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance(data, ReflectapiDemoTestsSerdeShapeCircleVariant): + return data + if isinstance(data, ReflectapiDemoTestsSerdeShapeRectVariant): + return data + + # Handle JSON data (for deserialization) + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Circle": + return ReflectapiDemoTestsSerdeShapeCircleVariant(**value) + if key == "Rect": + return ReflectapiDemoTestsSerdeShapeRectVariant(**value) + + raise ValueError(f"Unknown variant for ReflectapiDemoTestsSerdeShape: {data}") + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeShapeCircleVariant): + return {"Circle": self.root.model_dump(exclude_none=True)} + if isinstance(self.root, ReflectapiDemoTestsSerdeShapeRectVariant): + return {"Rect": self.root.model_dump(exclude_none=True)} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeShape variant: {type(self.root)}" + ) + + +class ReflectapiDemoTestsSerdeDrawing(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + shape: ReflectapiDemoTestsSerdeShape + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[ReflectapiDemoTestsSerdeDrawing] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeDrawing]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeDrawing]: Response containing ReflectapiDemoTestsSerdeDrawing data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeDrawing, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[ReflectapiDemoTestsSerdeDrawing] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeDrawing]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeDrawing]: Response containing ReflectapiDemoTestsSerdeDrawing data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeDrawing, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + ReflectapiDemoTestsSerdeDrawing.model_rebuild() + ReflectapiDemoTestsSerdeShape.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class ReflectapiDemoTestsSerdeShapeFactory: + """Factory class for creating ReflectapiDemoTestsSerdeShape variants with ergonomic syntax. + + ReflectapiDemoTestsSerdeShape variants + """ + + @staticmethod + def circle(radius) -> ReflectapiDemoTestsSerdeShape: + """Creates the 'Circle' variant of the ReflectapiDemoTestsSerdeShape enum.""" + return ReflectapiDemoTestsSerdeShape( + ReflectapiDemoTestsSerdeShapeCircleVariant(radius=radius) + ) + + @staticmethod + def rect(width, height) -> ReflectapiDemoTestsSerdeShape: + """Creates the 'Rect' variant of the ReflectapiDemoTestsSerdeShape enum.""" + return ReflectapiDemoTestsSerdeShape( + ReflectapiDemoTestsSerdeShapeRectVariant(width=width, height=height) + ) + + +# Testing utilities + + +def create_reflectapidemotestsserdedrawing_response( + value: ReflectapiDemoTestsSerdeDrawing, +) -> ApiResponse[ReflectapiDemoTestsSerdeDrawing]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdeDrawing.""" + return create_api_response(value) + + +def create_reflectapidemotestsserdeshape_response( + value: ReflectapiDemoTestsSerdeShape, +) -> ApiResponse[ReflectapiDemoTestsSerdeShape]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdeShape.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field.snap new file mode 100644 index 00000000..99c64359 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field.snap @@ -0,0 +1,191 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Drawing" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Drawing" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "primitive", + "name": "f64", + "description": "64-bit floating point number" + }, + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Drawing", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "shape", + "type": { + "name": "reflectapi_demo::tests::serde::Shape" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Shape", + "variants": [ + { + "name": "Circle", + "fields": { + "named": [ + { + "name": "radius", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + }, + { + "name": "Rect", + "fields": { + "named": [ + { + "name": "width", + "type": { + "name": "f64" + }, + "required": true + }, + { + "name": "height", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "primitive", + "name": "f64", + "description": "64-bit floating point number" + }, + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Drawing", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "shape", + "type": { + "name": "reflectapi_demo::tests::serde::Shape" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Shape", + "variants": [ + { + "name": "Circle", + "fields": { + "named": [ + { + "name": "radius", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + }, + { + "name": "Rect", + "fields": { + "named": [ + { + "name": "width", + "type": { + "name": "f64" + }, + "required": true + }, + { + "name": "height", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-2.snap new file mode 100644 index 00000000..cfa878b4 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-2.snap @@ -0,0 +1,71 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Offer > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Offer, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Offer = { + id: string; + } & NullToEmptyObject; + + export type OfferKind = + | { + type: "Single"; + business: string; + } + | { + type: "Group"; + count: number /* u32 */; + }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Offer, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Offer, + {}, + reflectapi_demo.tests.serde.Offer, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-3.snap new file mode 100644 index 00000000..e1715ede --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-3.snap @@ -0,0 +1,78 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Offer > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Offer, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Offer, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Offer { + pub id: std::string::String, + #[serde(flatten)] + pub payload: super::super::super::reflectapi_demo::tests::serde::OfferKind, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "type")] + pub enum OfferKind { + Single { business: std::string::String }, + Group { count: u32 }, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-4.snap new file mode 100644 index 00000000..5c15b9fa --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-4.snap @@ -0,0 +1,109 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Offer" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Offer" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Offer": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.OfferKind" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Offer", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.OfferKind": { + "oneOf": [ + { + "type": "object", + "title": "Single", + "required": [ + "business", + "type" + ], + "properties": { + "business": { + "$ref": "#/components/schemas/std.string.String" + }, + "type": { + "const": "Single" + } + } + }, + { + "type": "object", + "title": "Group", + "required": [ + "count", + "type" + ], + "properties": { + "count": { + "$ref": "#/components/schemas/u32" + }, + "type": { + "const": "Group" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap new file mode 100644 index 00000000..c91419b0 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -0,0 +1,225 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Offer > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Literal, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict, Field, RootModel + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeOfferKindSingle(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Single"] = "Single" + business: str + + +class ReflectapiDemoTestsSerdeOfferKindGroup(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Group"] = "Group" + count: int + + +class ReflectapiDemoTestsSerdeOfferKind(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeOfferKindSingle, + ReflectapiDemoTestsSerdeOfferKindGroup, + ], + Field(discriminator="type"), + ] + + +class ReflectapiDemoTestsSerdeOfferSingle(BaseModel): + """'Single' variant of ReflectapiDemoTestsSerdeOffer""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + type: Literal["Single"] = "Single" + business: str + + +class ReflectapiDemoTestsSerdeOfferGroup(BaseModel): + """'Group' variant of ReflectapiDemoTestsSerdeOffer""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + type: Literal["Group"] = "Group" + count: int + + +class ReflectapiDemoTestsSerdeOffer(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeOfferSingle, + ReflectapiDemoTestsSerdeOfferGroup, + ], + Field(discriminator="type"), + ] + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[ReflectapiDemoTestsSerdeOffer] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeOffer]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeOffer]: Response containing ReflectapiDemoTestsSerdeOffer data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeOffer, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[ReflectapiDemoTestsSerdeOffer] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeOffer]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeOffer]: Response containing ReflectapiDemoTestsSerdeOffer data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeOffer, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + ReflectapiDemoTestsSerdeOffer.model_rebuild() + ReflectapiDemoTestsSerdeOfferKind.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class ReflectapiDemoTestsSerdeOfferKindFactory: + """Factory class for creating ReflectapiDemoTestsSerdeOfferKind variants with ergonomic syntax. + + ReflectapiDemoTestsSerdeOfferKind variants + """ + + @staticmethod + def single(business) -> ReflectapiDemoTestsSerdeOfferKindSingle: + """Creates the 'Single' variant of the ReflectapiDemoTestsSerdeOfferKind enum.""" + return ReflectapiDemoTestsSerdeOfferKindSingle(business=business) + + @staticmethod + def group(count) -> ReflectapiDemoTestsSerdeOfferKindGroup: + """Creates the 'Group' variant of the ReflectapiDemoTestsSerdeOfferKind enum.""" + return ReflectapiDemoTestsSerdeOfferKindGroup(count=count) + + +# Testing utilities + + +def create_reflectapidemotestsserdeoffer_response( + value: ReflectapiDemoTestsSerdeOffer, +) -> ApiResponse[ReflectapiDemoTestsSerdeOffer]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOffer.""" + return create_api_response(value) + + +def create_reflectapidemotestsserdeofferkind_response( + value: ReflectapiDemoTestsSerdeOfferKind, +) -> ApiResponse[ReflectapiDemoTestsSerdeOfferKind]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOfferKind.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field.snap new file mode 100644 index 00000000..03c458f7 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field.snap @@ -0,0 +1,187 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Offer" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Offer" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Offer", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "payload", + "type": { + "name": "reflectapi_demo::tests::serde::OfferKind" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::OfferKind", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Single", + "fields": { + "named": [ + { + "name": "business", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Group", + "fields": { + "named": [ + { + "name": "count", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Offer", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "payload", + "type": { + "name": "reflectapi_demo::tests::serde::OfferKind" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::OfferKind", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Single", + "fields": { + "named": [ + { + "name": "business", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Group", + "fields": { + "named": [ + { + "name": "count", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-2.snap new file mode 100644 index 00000000..7d8d6ffc --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-2.snap @@ -0,0 +1,69 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Cell > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Cell, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Cell = { + label: string; + } & NullToEmptyObject; + + export type Value = + | { + value: number /* f64 */; + } + | { + text: string; + }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Cell, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Cell, + {}, + reflectapi_demo.tests.serde.Cell, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-3.snap new file mode 100644 index 00000000..91e5c58c --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-3.snap @@ -0,0 +1,78 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Cell > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Cell, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Cell, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Cell { + pub label: std::string::String, + #[serde(flatten)] + pub content: super::super::super::reflectapi_demo::tests::serde::Value, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(untagged)] + pub enum Value { + Num { value: f64 }, + Text { text: std::string::String }, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-4.snap new file mode 100644 index 00000000..9c1e2503 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-4.snap @@ -0,0 +1,101 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Cell" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Cell" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "f64": { + "description": "64-bit floating point number", + "type": "number" + }, + "reflectapi_demo.tests.serde.Cell": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Value" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Cell", + "required": [ + "label" + ], + "properties": { + "label": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Value": { + "oneOf": [ + { + "type": "object", + "title": "Num", + "required": [ + "value" + ], + "properties": { + "value": { + "$ref": "#/components/schemas/f64" + } + } + }, + { + "type": "object", + "title": "Text", + "required": [ + "text" + ], + "properties": { + "text": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap new file mode 100644 index 00000000..e99f2ef6 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap @@ -0,0 +1,180 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Cell > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeValueNum(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + value: float + + +class ReflectapiDemoTestsSerdeValueText(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + text: str + + +ReflectapiDemoTestsSerdeValue = Union[ + ReflectapiDemoTestsSerdeValueNum, ReflectapiDemoTestsSerdeValueText +] + + +class ReflectapiDemoTestsSerdeCell(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + label: str + content: ReflectapiDemoTestsSerdeValue + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[ReflectapiDemoTestsSerdeCell] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeCell]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeCell]: Response containing ReflectapiDemoTestsSerdeCell data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeCell, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[ReflectapiDemoTestsSerdeCell] = None, + ) -> ApiResponse[ReflectapiDemoTestsSerdeCell]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[ReflectapiDemoTestsSerdeCell]: Response containing ReflectapiDemoTestsSerdeCell data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=ReflectapiDemoTestsSerdeCell, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + ReflectapiDemoTestsSerdeCell.model_rebuild() + ReflectapiDemoTestsSerdeValue.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapidemotestsserdecell_response( + value: ReflectapiDemoTestsSerdeCell, +) -> ApiResponse[ReflectapiDemoTestsSerdeCell]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdeCell.""" + return create_api_response(value) + + +def create_reflectapidemotestsserdevalue_response( + value: ReflectapiDemoTestsSerdeValue, +) -> ApiResponse[ReflectapiDemoTestsSerdeValue]: + """Create a mock ApiResponse for ReflectapiDemoTestsSerdeValue.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field.snap new file mode 100644 index 00000000..d3fed83a --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field.snap @@ -0,0 +1,179 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Cell" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Cell" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "primitive", + "name": "f64", + "description": "64-bit floating point number" + }, + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Cell", + "fields": { + "named": [ + { + "name": "label", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "content", + "type": { + "name": "reflectapi_demo::tests::serde::Value" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Value", + "representation": "none", + "variants": [ + { + "name": "Num", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + }, + { + "name": "Text", + "fields": { + "named": [ + { + "name": "text", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "primitive", + "name": "f64", + "description": "64-bit floating point number" + }, + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Cell", + "fields": { + "named": [ + { + "name": "label", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "content", + "type": { + "name": "reflectapi_demo::tests::serde::Value" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Value", + "representation": "none", + "variants": [ + { + "name": "Num", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + }, + { + "name": "Text", + "fields": { + "named": [ + { + "name": "text", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index 0e165978..aefa155b 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -584,12 +584,17 @@ impl CircularDependencyResolutionStage { } } + /// No-op: Rust schemas already encode `Box` in the type references, so + /// self-referential types (cycle length 1) and multi-type cycles (A → B → A) + /// are already representable. The cycle detection performed by the + /// `CircularDependencyResolutionStage` is still valuable — downstream codegen + /// backends (e.g. Python, TypeScript) can query the detected cycles to emit + /// forward-reference annotations or similar language-specific constructs. fn apply_boxing_strategy( &self, _schema: &mut Schema, _cycle: &[String], ) -> Result<(), Vec> { - // TODO: Implement actual type reference wrapping in Box Ok(()) } @@ -752,6 +757,10 @@ impl Normalizer { // Phase 0: Ensure all symbols have unique, stable IDs crate::ids::ensure_symbol_ids(&mut schema); + // Phase 0.5: Run the standard normalization pipeline (type consolidation, + // naming resolution, circular dependency resolution) before symbol discovery + NormalizationPipeline::standard().run(&mut schema)?; + // Phase 1: Symbol Discovery self.discover_symbols(&schema)?; @@ -1625,4 +1634,104 @@ mod tests { let name = generate_unique_name("billing::Invoice"); assert_eq!(name, "BillingInvoice"); } + + #[test] + fn test_self_referential_type_normalizes_successfully() { + // A self-referential type (cycle of length 1) should pass through the + // full Normalizer pipeline without error. In Rust the schema already + // records Box wrappers, so the boxing strategy is intentionally a + // no-op — the cycle is detected but does not block normalization. + let mut schema = Schema::new(); + schema.name = "TreeSchema".to_string(); + + // TreeNode has a field `children` of type Vec (indirect + // self-reference via a container — already broken by Vec) and a field + // `parent` that directly references TreeNode (direct self-reference, + // which in real Rust code would be Box). + let mut tree_node = Struct::new("TreeNode"); + tree_node.fields = Fields::Named(vec![ + Field::new("label".into(), "std::string::String".into()), + Field::new( + "children".into(), + TypeReference::new( + "std::vec::Vec", + vec![TypeReference::new("TreeNode", vec![])], + ), + ), + Field::new( + "parent".into(), + TypeReference::new( + "std::boxed::Box", + vec![TypeReference::new("TreeNode", vec![])], + ), + ), + ]); + schema.input_types.insert_type(tree_node.into()); + + let normalizer = Normalizer::new(); + let result = normalizer.normalize(schema); + + assert!( + result.is_ok(), + "Self-referential type should not prevent normalization: {:?}", + result.err() + ); + + let semantic = result.unwrap(); + assert_eq!(semantic.types.len(), 1, "TreeNode type should be present"); + + // Verify the type round-tripped with the expected name + let tree_node_type = semantic.types.values().next().unwrap(); + match tree_node_type { + SemanticType::Struct(s) => { + assert_eq!(s.name, "TreeNode"); + assert_eq!(s.fields.len(), 3, "All three fields should survive"); + } + other => panic!("Expected Struct, got {:?}", std::mem::discriminant(other)), + } + } + + #[test] + fn test_multi_type_cycle_normalizes_successfully() { + // A → B → A cycle (length 2) should also pass through normalization + // without error. The forward-declaration strategy is likewise a no-op + // for Rust schemas. + let mut schema = Schema::new(); + schema.name = "CycleSchema".to_string(); + + // Department references Employee, Employee references Department + let mut department = Struct::new("Department"); + department.fields = Fields::Named(vec![ + Field::new("name".into(), "std::string::String".into()), + Field::new("manager".into(), TypeReference::new("Employee", vec![])), + ]); + + let mut employee = Struct::new("Employee"); + employee.fields = Fields::Named(vec![ + Field::new("name".into(), "std::string::String".into()), + Field::new( + "department".into(), + TypeReference::new("Department", vec![]), + ), + ]); + + schema.input_types.insert_type(department.into()); + schema.input_types.insert_type(employee.into()); + + let normalizer = Normalizer::new(); + let result = normalizer.normalize(schema); + + assert!( + result.is_ok(), + "Multi-type cycle should not prevent normalization: {:?}", + result.err() + ); + + let semantic = result.unwrap(); + assert_eq!( + semantic.types.len(), + 2, + "Both Department and Employee types should be present" + ); + } } diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 9e4df705..6d61a402 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -429,7 +429,13 @@ fn collect_generic_type_vars( } } -/// Render a struct that contains flattened fields using direct field expansion +/// Render a struct that contains flattened fields using direct field expansion. +/// +/// For flattened structs, fields are expanded inline into the parent model. +/// For flattened internally-tagged enums, we generate per-variant models that +/// merge the parent's fields with each variant's fields + the tag discriminator, +/// then emit a discriminated union RootModel. This matches the wire format that +/// serde produces with `#[serde(flatten)]` on internally-tagged enums. fn render_struct_with_flatten( struct_def: &reflectapi_schema::Struct, schema: &Schema, @@ -437,32 +443,295 @@ fn render_struct_with_flatten( used_type_vars: &mut BTreeSet, ) -> anyhow::Result { let struct_name = improve_class_name(&struct_def.name); - - // Collect all fields (regular + flattened) into a single flat model - let mut all_fields = Vec::new(); let active_generics: Vec = struct_def .parameters .iter() .map(|p| p.name.clone()) .collect(); - // Track used generic type variables for generic in &active_generics { used_type_vars.insert(generic.clone()); } - // Add regular fields + // Check if any flattened field is an internally-tagged enum + let flattened_internal_enum = + struct_def + .fields + .iter() + .filter(|f| f.flattened()) + .find_map(|field| { + let type_name = resolve_flattened_type_name(&field.type_ref); + match schema.get_type(type_name) { + Some(reflectapi_schema::Type::Enum(enum_def)) => { + match &enum_def.representation { + reflectapi_schema::Representation::Internal { tag } => { + Some((field, enum_def.clone(), tag.clone())) + } + _ => None, + } + } + _ => None, + } + }); + + if let Some((_enum_field, enum_def, tag)) = flattened_internal_enum { + // Wire-compatible path: generate per-variant models with merged fields + render_struct_with_flattened_internal_enum( + struct_def, + &struct_name, + &enum_def, + &tag, + schema, + implemented_types, + &active_generics, + used_type_vars, + ) + } else { + // Standard path: expand all flattened fields inline + render_struct_with_flatten_standard( + struct_def, + &struct_name, + schema, + implemented_types, + &active_generics, + used_type_vars, + ) + } +} + +/// Resolve the target type name for a flattened field, unwrapping Option +fn resolve_flattened_type_name(type_ref: &TypeReference) -> &str { + if (type_ref.name == "std::option::Option" || type_ref.name == "reflectapi::Option") + && !type_ref.arguments.is_empty() + { + &type_ref.arguments[0].name + } else { + &type_ref.name + } +} + +/// Render a struct with a flattened internally-tagged enum by generating +/// per-variant models that merge parent fields + variant fields + tag. +#[allow(clippy::too_many_arguments)] +fn render_struct_with_flattened_internal_enum( + struct_def: &reflectapi_schema::Struct, + struct_name: &str, + enum_def: &reflectapi_schema::Enum, + tag: &str, + schema: &Schema, + implemented_types: &BTreeMap, + active_generics: &[String], + used_type_vars: &mut BTreeSet, +) -> anyhow::Result { + use reflectapi_schema::Fields; + + let mut output = String::new(); + let mut union_variant_names: Vec = Vec::new(); + + // Collect the parent struct's non-flattened fields + any flattened struct fields + let mut base_fields: Vec = Vec::new(); for field in struct_def.fields.iter().filter(|f| !f.flattened()) { - let field_name = sanitize_field_name_with_alias(field.name()); + let (python_name, alias) = sanitize_field_name_with_alias(field.name()); let field_type = type_ref_to_python_type( &field.type_ref, schema, implemented_types, - &active_generics, + active_generics, used_type_vars, )?; + base_fields.push(templates::Field { + name: python_name, + type_annotation: if field.required { + field_type + } else { + format!("{field_type} | None") + }, + description: Some(field.description().to_string()), + deprecation_note: field.deprecation_note.clone(), + optional: !field.required, + default_value: if field.required { + None + } else { + Some("None".to_string()) + }, + alias, + }); + } + + // Also expand any flattened struct fields (non-enum) into base_fields + for field in struct_def.fields.iter().filter(|f| f.flattened()) { + let type_name = resolve_flattened_type_name(&field.type_ref); + if let Some(reflectapi_schema::Type::Struct(_)) = schema.get_type(type_name) { + let flattened = collect_flattened_fields( + &field.type_ref, + schema, + implemented_types, + active_generics, + field.required, + 0, + used_type_vars, + Some(field.name()), + )?; + base_fields.extend(flattened); + } + // Enum fields are handled below as variants + } + + // Generate per-variant models + for variant in &enum_def.variants { + let variant_class_name = format!("{}{}", struct_name, to_pascal_case(variant.name())); + union_variant_names.push(variant_class_name.clone()); - let (python_name, alias) = field_name; + // Start with base fields from the parent struct + let mut fields = base_fields.clone(); + + // Add the tag discriminator field + fields.push(templates::Field { + name: tag.to_string(), + type_annotation: format!("Literal['{}']", variant.serde_name()), + description: Some("Discriminator field".to_string()), + deprecation_note: None, + optional: false, + default_value: Some(format!("\"{}\"", variant.serde_name())), + alias: None, + }); + + // Add variant-specific fields + match &variant.fields { + Fields::Named(named_fields) => { + for vf in named_fields { + let field_type = type_ref_to_python_type( + &vf.type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + )?; + let is_option = vf.type_ref.name == "std::option::Option" + || vf.type_ref.name == "reflectapi::Option"; + let (optional, default_value, final_type) = if !vf.required { + if is_option { + (true, Some("None".to_string()), field_type) + } else { + ( + true, + Some("None".to_string()), + format!("{field_type} | None"), + ) + } + } else if is_option { + (true, Some("None".to_string()), field_type) + } else { + (false, None, field_type) + }; + let (sanitized, alias) = sanitize_field_name_with_alias(vf.name()); + fields.push(templates::Field { + name: sanitized, + type_annotation: final_type, + description: Some(vf.description().to_string()), + deprecation_note: vf.deprecation_note.clone(), + optional, + default_value, + alias, + }); + } + } + Fields::Unnamed(unnamed_fields) if unnamed_fields.len() == 1 => { + // Tuple variant with one field — expand inner struct fields + let inner = &unnamed_fields[0]; + let inner_name = if inner.type_ref.name == "std::boxed::Box" { + inner + .type_ref + .arguments + .first() + .map(|a| a.name.as_str()) + .unwrap_or(&inner.type_ref.name) + } else { + &inner.type_ref.name + }; + if let Some(reflectapi_schema::Type::Struct(inner_struct)) = + schema.get_type(inner_name) + { + for sf in inner_struct.fields.iter() { + let field_type = type_ref_to_python_type( + &sf.type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + )?; + let (sanitized, alias) = sanitize_field_name_with_alias(sf.name()); + fields.push(templates::Field { + name: sanitized, + type_annotation: if sf.required { + field_type + } else { + format!("{field_type} | None") + }, + description: Some(sf.description().to_string()), + deprecation_note: sf.deprecation_note.clone(), + optional: !sf.required, + default_value: if sf.required { + None + } else { + Some("None".to_string()) + }, + alias, + }); + } + } + } + Fields::None => { + // Unit variant — no additional fields beyond tag + } + _ => { + // Multi-field tuple variant — not supported for flattening + } + } + + // Render the variant class + let variant_template = templates::DataClass { + name: variant_class_name, + description: Some(format!("'{}' variant of {}", variant.name(), struct_name)), + fields, + is_tuple: false, + is_generic: !active_generics.is_empty(), + generic_params: active_generics.to_vec(), + }; + output.push_str(&variant_template.render()?); + output.push('\n'); + } + + // Render the parent type as a discriminated union RootModel + let union_type = union_variant_names.join(",\n "); + output.push_str(&format!( + "\nclass {struct_name}(RootModel):\n root: Annotated[\n Union[\n {union_type},\n ],\n Field(discriminator=\"{tag}\"),\n ]\n" + )); + + Ok(output) +} + +/// Standard flatten path: expand all flattened struct fields inline into a single model. +fn render_struct_with_flatten_standard( + struct_def: &reflectapi_schema::Struct, + struct_name: &str, + schema: &Schema, + implemented_types: &BTreeMap, + active_generics: &[String], + used_type_vars: &mut BTreeSet, +) -> anyhow::Result { + let mut all_fields = Vec::new(); + + // Add regular fields + for field in struct_def.fields.iter().filter(|f| !f.flattened()) { + let (python_name, alias) = sanitize_field_name_with_alias(field.name()); + let field_type = type_ref_to_python_type( + &field.type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + )?; all_fields.push(templates::Field { name: python_name, @@ -489,22 +758,22 @@ fn render_struct_with_flatten( &field.type_ref, schema, implemented_types, - &active_generics, + active_generics, field.required, - 0, // Start at depth 0 + 0, used_type_vars, + Some(field.name()), )?; all_fields.extend(flattened_fields); } - // Generate as a regular Pydantic model with all fields flattened let struct_template = templates::DataClass { - name: struct_name, + name: struct_name.to_string(), description: Some(struct_def.description().to_string()), fields: all_fields, is_tuple: false, is_generic: !active_generics.is_empty(), - generic_params: active_generics, + generic_params: active_generics.to_vec(), }; let rendered = struct_template.render()?; @@ -1213,7 +1482,10 @@ fn render_type_without_factory( } } -/// Recursively collect fields from flattened structures +/// Recursively collect fields from flattened structures and enums. +/// `field_name` is the original Rust field name for the flattened field +/// (used when emitting enum types as regular fields). +#[allow(clippy::too_many_arguments)] fn collect_flattened_fields( type_ref: &TypeReference, schema: &Schema, @@ -1222,6 +1494,7 @@ fn collect_flattened_fields( parent_required: bool, depth: usize, used_type_vars: &mut BTreeSet, + field_name: Option<&str>, ) -> anyhow::Result> { // Prevent infinite recursion if depth > 10 { @@ -1248,75 +1521,184 @@ fn collect_flattened_fields( &type_ref.name }; - if let Some(reflectapi_schema::Type::Struct(struct_def)) = schema.get_type(target_type_name) { - for field in struct_def.fields.iter() { - if field.flattened() { - // Recursively collect fields from nested flattened structures - let nested_fields = collect_flattened_fields( - &field.type_ref, - schema, - implemented_types, - active_generics, - parent_required && field.required, - depth + 1, - used_type_vars, - )?; - collected_fields.extend(nested_fields); - } else { - // Regular field in flattened struct - let field_type = type_ref_to_python_type( - &field.type_ref, - schema, - implemented_types, - active_generics, - used_type_vars, - )?; - - let is_option_type = field.type_ref.name == "std::option::Option" - || field.type_ref.name == "reflectapi::Option"; - - let (optional, default_value, final_field_type) = - if !field.required || !parent_required { - if is_option_type { - (true, Some("None".to_string()), field_type) - } else { - ( - true, - Some("None".to_string()), - format!("{field_type} | None"), - ) - } - } else if is_option_type { - (true, Some("None".to_string()), field_type) - } else { - (false, None, field_type) - }; - - let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); - collected_fields.push(templates::Field { - name: sanitized, - type_annotation: final_field_type, - description: Some(format!( - "(flattened{}) {}", - if depth > 1 { - format!(" depth={depth}") - } else { - String::new() - }, - field.description() - )), - deprecation_note: field.deprecation_note.clone(), - optional, - default_value, - alias, - }); + match schema.get_type(target_type_name) { + Some(reflectapi_schema::Type::Struct(struct_def)) => { + for field in struct_def.fields.iter() { + if field.flattened() { + // Recursively collect fields from nested flattened structures + let nested_fields = collect_flattened_fields( + &field.type_ref, + schema, + implemented_types, + active_generics, + parent_required && field.required, + depth + 1, + used_type_vars, + Some(field.name()), + )?; + collected_fields.extend(nested_fields); + } else { + // Regular field in flattened struct + collected_fields.push(make_flattened_field( + field, + schema, + implemented_types, + active_generics, + parent_required, + depth, + used_type_vars, + )?); + } } } + Some(reflectapi_schema::Type::Enum(enum_def)) => { + // Flattened enum: expand variant fields into the parent model. + // For internally-tagged enums, each variant's fields + the tag field + // get merged into the parent struct. For other representations, + // we emit the enum as a regular typed field since Pydantic cannot + // truly flatten non-internally-tagged unions. + collect_flattened_enum_fields( + enum_def, + type_ref, + schema, + implemented_types, + active_generics, + parent_required, + used_type_vars, + &mut collected_fields, + field_name, + )?; + } + Some(reflectapi_schema::Type::Primitive(_)) | None => { + // Primitives (including unit types) and unresolved types cannot + // be meaningfully flattened — skip them, matching prior behavior. + // This handles cases like flattened generic parameters that resolve + // to () (std::tuple::Tuple0). + } } Ok(collected_fields) } +/// Create a single flattened field entry from a struct field +fn make_flattened_field( + field: &reflectapi_schema::Field, + schema: &Schema, + implemented_types: &BTreeMap, + active_generics: &[String], + parent_required: bool, + depth: usize, + used_type_vars: &mut BTreeSet, +) -> anyhow::Result { + let field_type = type_ref_to_python_type( + &field.type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + )?; + + let is_option_type = + field.type_ref.name == "std::option::Option" || field.type_ref.name == "reflectapi::Option"; + + let (optional, default_value, final_field_type) = if !field.required || !parent_required { + if is_option_type { + (true, Some("None".to_string()), field_type) + } else { + ( + true, + Some("None".to_string()), + format!("{field_type} | None"), + ) + } + } else if is_option_type { + (true, Some("None".to_string()), field_type) + } else { + (false, None, field_type) + }; + + let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); + Ok(templates::Field { + name: sanitized, + type_annotation: final_field_type, + description: Some(format!( + "(flattened{}) {}", + if depth > 1 { + format!(" depth={depth}") + } else { + String::new() + }, + field.description() + )), + deprecation_note: field.deprecation_note.clone(), + optional, + default_value, + alias, + }) +} + +/// Handle flattened enum fields by emitting the enum as a typed field. +/// +/// For internally-tagged enums (`#[serde(tag = "...")]`), serde merges the +/// tag + variant fields into the parent struct. Pydantic can't directly +/// represent this, so we emit the enum's Python union type as a regular field. +/// The model uses `extra="allow"` to accept the flattened wire format. +#[allow(clippy::too_many_arguments)] +fn collect_flattened_enum_fields( + enum_def: &reflectapi_schema::Enum, + type_ref: &TypeReference, + schema: &Schema, + implemented_types: &BTreeMap, + active_generics: &[String], + parent_required: bool, + used_type_vars: &mut BTreeSet, + collected_fields: &mut Vec, + original_field_name: Option<&str>, +) -> anyhow::Result<()> { + let enum_python_type = type_ref_to_python_type( + type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + )?; + + // Use the original Rust field name if available, otherwise derive from type name + let field_name = original_field_name + .map(|s| s.to_string()) + .unwrap_or_else(|| { + type_ref + .name + .split("::") + .last() + .unwrap_or(&type_ref.name) + .to_lowercase() + }); + let (sanitized, alias) = sanitize_field_name_with_alias(&field_name); + + let (optional, default_value, final_type) = if !parent_required { + ( + true, + Some("None".to_string()), + format!("{enum_python_type} | None"), + ) + } else { + (false, None, enum_python_type) + }; + + collected_fields.push(templates::Field { + name: sanitized, + type_annotation: final_type, + description: Some(format!("(flattened enum: {})", enum_def.name)), + deprecation_note: None, + optional, + default_value, + alias, + }); + + Ok(()) +} + fn render_struct( struct_def: &reflectapi_schema::Struct, schema: &Schema, @@ -1408,6 +1790,7 @@ fn render_struct( field.required, 0, used_type_vars, + Some(field.name()), )?; flattened_fields.extend(fields); } @@ -5034,6 +5417,7 @@ def create_mock_client() -> MockClient: pub types: Vec, } + #[derive(Clone)] pub struct Field { pub name: String, pub type_annotation: String, From 6db7d53d21abda401f1ce7fd4ca3f691c93188cf Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 10:40:46 +1300 Subject: [PATCH 12/47] =?UTF-8?q?docs:=20tighten=20architecture=20doc=20?= =?UTF-8?q?=E2=80=94=20remove=20temporal=20language,=20fix=20accuracy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove all point-in-time language ("currently", "not yet", "planned") - Rename Section 7 from "Current Status and Roadmap" to "Limitations and Design Gaps" — state facts, not progress - Delete "Complete" and "In Progress" subsections - Fix Schema/SemanticSchema code samples to include id fields - Add reflectapi-python-runtime crate description - Fix OpenAPI version (3.1, not 3.0) - Replace vague language with specifics throughout - Remove subjective tone and issue number references from prose --- docs/architecture.md | 157 +++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 87 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index d2d047f5..d8081dc9 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -2,11 +2,11 @@ ## 1. Overview -ReflectAPI is a Rust framework for defining web API services and generating 100%-compatible, type-safe clients in multiple languages. The core idea: you write Rust handler functions with strongly-typed inputs and outputs, derive macros capture the type information into a JSON schema, and code generation backends produce idiomatic clients for TypeScript, Rust, Python, and OpenAPI specs. +ReflectAPI is a Rust framework for defining web API services and generating type-safe clients in multiple languages. Developers write Rust handler functions with typed inputs and outputs. Derive macros capture type metadata into a JSON schema (`reflectapi.json`). Code generation backends produce idiomatic clients for TypeScript, Rust, and Python, plus OpenAPI specifications. -The system is designed around a multi-stage pipeline: +The system is a multi-stage pipeline: -1. **Derive macros** extract type metadata at compile time into a raw `Schema`. +1. **Derive macros** extract type metadata at compile time into a `Schema`. 2. The schema is serialized to JSON (`reflectapi.json`), forming the contract between server and clients. 3. At codegen time, the schema is deserialized, normalized through a pipeline of transformations, and fed to language-specific backends that emit client code. @@ -14,12 +14,12 @@ The system is designed around a multi-stage pipeline: ``` reflectapi/ Workspace root - reflectapi-schema/ Core schema types, semantic IR, normalization pipeline - reflectapi-derive/ Proc macros: #[derive(Input, Output, reflectapi::Input, ...)] - reflectapi/ Builder, codegen backends, runtime (axum integration, etc.) + reflectapi-schema/ Schema types, semantic IR, normalization pipeline + reflectapi-derive/ Proc macros: #[derive(Input, Output)] + reflectapi/ Builder, codegen backends, runtime (axum, serialization) reflectapi-cli/ CLI tool wrapping codegen (clap-based) reflectapi-demo/ Demo application with snapshot tests (insta) - reflectapi-python-runtime/ Python runtime support library + reflectapi-python-runtime/ Python runtime support library (Pydantic helpers, client base classes) docs/ User-facing documentation (mdbook) ``` @@ -27,11 +27,11 @@ reflectapi/ Workspace root The foundational crate. Contains: -- **Raw schema types** (`Schema`, `Function`, `Type`, `Struct`, `Enum`, `Field`, `Variant`, `TypeReference`, `Representation`, `Primitive`, `Typespace`) -- the serializable representation of an API. +- **Schema types** (`Schema`, `Function`, `Type`, `Struct`, `Enum`, `Field`, `Variant`, `TypeReference`, `Representation`, `Primitive`, `Typespace`) -- the serializable representation of an API. - **SymbolId and SymbolKind** -- stable unique identifiers for all schema symbols. - **ensure_symbol_ids()** -- post-deserialization ID assignment. - **NormalizationPipeline** -- multi-stage schema transformation (type consolidation, naming, circular dependency resolution). -- **Normalizer** -- converts raw `Schema` into validated `SemanticSchema`. +- **Normalizer** -- converts `Schema` into validated `SemanticSchema`. - **SemanticSchema** -- immutable, fully-resolved intermediate representation. - **Visitor/VisitMut** -- generic traversal utilities. - **Substitute/Instantiate** -- generic type parameter substitution. @@ -39,7 +39,7 @@ The foundational crate. Contains: ### reflectapi-derive -Procedural macros that implement `#[derive(Input)]` and `#[derive(Output)]`. These parse Rust struct/enum definitions (including all serde attributes) and emit code that registers the type into the `Schema` at build time. +Procedural macros that implement `#[derive(Input)]` and `#[derive(Output)]`. These macros parse Rust struct/enum definitions (including serde attributes) and emit code that populates the `Schema` at compile time. Key source files: - `lib.rs` -- macro entry points @@ -51,10 +51,10 @@ Key source files: ### reflectapi The main user-facing crate. Contains: -- **Builder** -- runtime schema construction and handler registration. -- **Codegen backends** -- `typescript`, `rust`, `python`, `openapi` modules under `src/codegen/`. +- **Builder** (`src/builder/`) -- runtime schema construction and handler registration. +- **Codegen backends** -- `typescript.rs`, `rust.rs`, `python.rs`, `openapi.rs` in `src/codegen/`. - **Runtime integration** -- axum handler adapters, serialization modes (JSON, msgpack). -- **Format utilities** -- post-generation formatting (prettier, rustfmt, ruff). +- **Format utilities** (`src/codegen/format.rs`) -- invokes prettier, rustfmt, or ruff on generated output. ### reflectapi-cli @@ -64,15 +64,19 @@ A thin CLI wrapper using `clap`. Reads a `reflectapi.json` schema file and invok reflectapi codegen --language typescript --schema reflectapi.json --output ./clients/ts ``` -Supports flags for formatting, typechecking, tag filtering, shared modules (Rust), and tracing instrumentation. +Flags control output formatting, type checking, tag-based endpoint filtering, shared Rust module imports, and tracing instrumentation. ### reflectapi-demo -A working demo server with snapshot tests. The `reflectapi.json` file and generated clients (TypeScript, Rust, Python) are checked in and validated by `cargo insta` snapshot tests, ensuring codegen output is stable across changes. +A working demo server with snapshot tests. The `reflectapi.json` file and generated clients (TypeScript, Rust, Python) are checked in and validated by `cargo insta` snapshot tests. Each test type produces 5 snapshots: JSON schema, TypeScript, Rust, OpenAPI, and Python. + +### reflectapi-python-runtime + +Python package providing base classes and utilities for generated Python clients: `AsyncClientBase`, `ClientBase`, `ApiResponse`, `ReflectapiOption`, mock testing utilities, and middleware support. ## 3. Schema Types -The raw schema is a JSON-serializable representation of a Rust API. The core types in `reflectapi-schema/src/lib.rs`: +The schema is a JSON-serializable representation of a Rust API. The core types live in `reflectapi-schema/src/lib.rs`. ### Schema @@ -80,15 +84,16 @@ Top-level container holding the API definition: ```rust pub struct Schema { + pub id: SymbolId, // Assigned by ensure_symbol_ids() pub name: String, pub description: String, pub functions: Vec, - pub input_types: Typespace, // Types used in request positions - pub output_types: Typespace, // Types used in response positions + pub input_types: Typespace, // Types used in request positions + pub output_types: Typespace, // Types used in response positions } ``` -The separation into `input_types` and `output_types` allows the same Rust type name to have different shapes in request vs response contexts. The `TypeConsolidationStage` merges these during normalization. +Separating `input_types` from `output_types` allows the same Rust type name to carry different shapes in request and response contexts. The `TypeConsolidationStage` merges these during normalization. ### Function @@ -96,8 +101,9 @@ An API endpoint: ```rust pub struct Function { - pub name: String, // e.g. "users.login" - pub path: String, // URL path, e.g. "/api/v1" + pub id: SymbolId, + pub name: String, // e.g. "users.login" + pub path: String, // URL path, e.g. "/api/v1" pub input_type: Option, pub input_headers: Option, pub output_type: Option, @@ -155,7 +161,7 @@ Fields can be `Named`, `Unnamed` (tuple), or `None` (unit). Each `Field` carries ## 4. Semantic IR Pipeline -The pipeline transforms a raw, deserialized `Schema` into a validated, immutable `SemanticSchema` suitable for code generation. This is a multi-phase process. +The pipeline transforms a deserialized `Schema` into a validated, immutable `SemanticSchema` suitable for code generation. ### Pipeline Overview @@ -179,12 +185,7 @@ The pipeline transforms a raw, deserialized `Schema` into a validated, immutable | v +--------------------------+ - | Normalizer | - | Phase 1: Discovery | Register all symbols - | Phase 2: Resolution | Resolve type references - | Phase 3: Dependencies | Build dependency graph - | Phase 4: Validation | Semantic checks - | Phase 5: IR Build | Construct SemanticSchema + | Normalizer | 5-phase conversion to SemanticSchema +--------------------------+ | v @@ -195,7 +196,7 @@ The pipeline transforms a raw, deserialized `Schema` into a validated, immutable ### SymbolId -Every symbol in the schema (types, functions, fields, variants) gets a stable, unique identifier: +Every symbol in the schema (types, functions, fields, variants) receives a stable, unique identifier: ```rust pub struct SymbolId { @@ -211,10 +212,10 @@ The `SymbolId` is the primary key for all lookups throughout the pipeline and in When a schema is deserialized from JSON, all `SymbolId` fields have their default ("unknown") values. `ensure_symbol_ids()` walks the schema and assigns stable IDs based on canonical names: -1. Pre-registers well-known stdlib types (`String`, `Vec`, `Option`, `HashMap`, etc.) +1. Pre-registers well-known stdlib types (`String`, `Vec`, `Option`, `HashMap`, etc.) from `STDLIB_TYPES`. 2. Assigns IDs to functions based on their names. 3. Assigns IDs to types in each typespace, using separate seen-maps so cross-typespace conflicts are detected. -4. When the same FQN appears in both typespaces with different type definitions, the output typespace's copy gets a disambiguated ID (disambiguator = 1). +4. When the same FQN appears in both typespaces with different type definitions, the output typespace's copy receives a disambiguated ID (`disambiguator = 1`). 5. Assigns IDs to struct fields and enum variants as children of their parent's path. ### NormalizationPipeline @@ -223,16 +224,16 @@ The standard pipeline applies three stages in sequence: **Stage 1: TypeConsolidationStage** -- Merges `input_types` and `output_types` into a single unified `input_types` collection. When a type name appears in both typespaces: - If the types are identical, the input version is kept. -- If they differ, they're renamed with `input.` / `output.` prefixes, and all type references throughout the schema are rewritten to point to the new names. +- If they differ, they are renamed with `input.` / `output.` prefixes, and all type references throughout the schema are rewritten to point to the new names. -**Stage 2: NamingResolutionStage** -- Strips module path prefixes from type names (e.g. `myapp::proto::User` becomes `User`). When stripping creates a conflict (two different types both resolve to `User`), a unique name is generated by incorporating the module prefix (e.g. `ProtoUser` vs `ApiUser`). Common module names like `model` and `proto` are skipped when building the prefix. +**Stage 2: NamingResolutionStage** -- Strips module path prefixes from type names (e.g. `myapp::proto::User` becomes `User`). When stripping creates a conflict (two different types both resolve to `User`), a unique name is generated by incorporating the module prefix (e.g. `ProtoUser` vs `ApiUser`). **Stage 3: CircularDependencyResolutionStage** -- Detects circular type dependencies using Tarjan's strongly-connected components (SCC) algorithm. Supports multiple resolution strategies: - `Intelligent` (default) -- self-references use boxing; multi-type cycles use forward declarations. -- `Boxing` -- wrap cyclic references in `Box` (currently a no-op since Rust schemas already encode boxing). -- `ForwardDeclarations`, `OptionalBreaking`, `ReferenceCounted` -- planned strategies (currently stubs). +- `Boxing` -- a no-op because Rust schemas already encode `Box` in their type references. +- `ForwardDeclarations`, `OptionalBreaking`, `ReferenceCounted` -- defined in `ResolutionStrategy` but their `apply_*` methods return `Ok(())` without modifying the schema. -The cycle detection itself is valuable even when resolution is a no-op, as downstream codegen backends can use this information to emit forward-reference annotations. +Downstream codegen backends query the detected cycles to emit forward-reference annotations regardless of the resolution strategy. ### Normalizer @@ -240,33 +241,35 @@ The `Normalizer` orchestrates the full conversion from `Schema` to `SemanticSche 1. **Phase 0**: Calls `ensure_symbol_ids()` and runs `NormalizationPipeline::standard()`. 2. **Phase 1 (Symbol Discovery)**: Walks the schema and registers every type, function, field, and variant in the `SymbolTable`. -3. **Phase 2 (Type Resolution)**: Resolves all `TypeReference` names to `SymbolId` targets, producing `ResolvedTypeReference` values with guaranteed validity. +3. **Phase 2 (Type Resolution)**: Resolves all `TypeReference` names to `SymbolId` targets, producing `ResolvedTypeReference` values. 4. **Phase 3 (Dependency Analysis)**: Builds a dependency graph in the `SymbolTable` and performs topological sorting. -5. **Phase 4 (Semantic Validation)**: Checks for unresolved references, conflicting definitions, and invalid generic parameters. +5. **Phase 4 (Semantic Validation)**: Checks for semantic errors. 6. **Phase 5 (IR Construction)**: Builds the final `SemanticSchema` with `BTreeMap`-ordered collections for deterministic output. ### SemanticSchema -The final, immutable output of the pipeline: +The output of the pipeline: ```rust pub struct SemanticSchema { + pub id: SymbolId, + pub name: String, + pub description: String, pub functions: BTreeMap, pub types: BTreeMap, pub symbol_table: SymbolTable, } ``` -Key differences from the raw `Schema`: -- **Immutable** -- no mutation after construction. -- **Fully resolved** -- all type references are `ResolvedTypeReference` with guaranteed valid `SymbolId` targets. +Key properties compared to `Schema`: +- **Fully resolved** -- all type references are `ResolvedTypeReference` with `SymbolId` targets. - **Deterministically ordered** -- `BTreeMap`/`BTreeSet` everywhere for stable codegen output. -- **Single typespace** -- input/output distinction has been resolved. +- **Single typespace** -- input/output distinction has been resolved by `TypeConsolidationStage`. - **Dependency graph** -- the `SymbolTable` contains dependency edges and supports topological sorting. ## 5. Code Generation Backends -All backends live in `reflectapi/src/codegen/`. Each reads the raw `Schema` (the semantic IR pipeline is not yet wired into the codegen path -- see Current Status) and produces language-specific output. +All backends live in `reflectapi/src/codegen/`. Each reads the `Schema` directly and produces language-specific output. ### TypeScript @@ -288,14 +291,14 @@ Mirrors the source Rust types, re-emitting struct/enum definitions with appropri - Generates a client module with async functions for each endpoint. - Output is formatted with `rustfmt`. -### Python +### Python (experimental) Generates Pydantic v2 models. Key features: - **BaseModel classes** for structs. - **Discriminated unions** (`Union[..., Field(discriminator="tag")]`) for internally-tagged enums. - **RootModel** wrappers for union types and single-field tuple structs. -- Special handling for `#[serde(flatten)]` with internally-tagged enums (see Section 6). +- **Per-variant model expansion** for `#[serde(flatten)]` with internally-tagged enums (see Section 6). - **Field aliases** for serde-renamed fields. - **Literal types** for discriminator fields. - Python reserved words are sanitized in field names with alias mapping. @@ -303,17 +306,16 @@ Generates Pydantic v2 models. Key features: ### OpenAPI -Generates an OpenAPI 3.0 specification (JSON). Key features: +Generates an OpenAPI 3.1 specification (JSON). Key features: - **`$ref`** for type references, with inline expansion for simple cases. - **`allOf`** composition for `#[serde(flatten)]` -- the parent object schema and each flattened type schema are combined under `allOf`. - **`oneOf`** for enum variants (tagged and untagged). -- **`discriminator`** property for internally-tagged enums. -- Rendered via Redoc for documentation. +- **`const`** values for discriminator tag fields in internally-tagged enum variants. ## 6. Flattened Type Handling -`#[serde(flatten)]` is one of the most complex serde features to handle across languages because it merges fields from one type into another at the wire level. The challenge is especially acute for internally-tagged enums, where the tag field and variant fields are merged flat into the parent struct. +`#[serde(flatten)]` merges fields from one type into another at the wire level. This requires distinct code generation strategies per target language. Internally-tagged enums compound this: the tag field and variant fields merge flat into the parent struct. ### Wire Format @@ -353,11 +355,7 @@ type Request = { } & NullToEmptyObject; ``` -The `NullToEmptyObject` wrapper handles the edge case where a flattened type resolves to `null` (Rust `()`), preventing `{...} & null` from collapsing to `never`. - -For optional flattened fields, `Partial` is used instead. - -### Python (standard flatten) +### Python (struct flatten) For flattened structs (not enums), all fields from the flattened type are expanded inline into the parent Pydantic model: @@ -370,7 +368,7 @@ class Request(BaseModel): ### Python (internally-tagged enum flatten) -This is the most complex case. When a struct flattens an internally-tagged enum, per-variant models are generated that merge the parent's fields, the tag discriminator, and the variant's fields: +When a struct flattens an internally-tagged enum, per-variant models are generated that merge the parent's fields, the tag discriminator, and the variant's fields: ```python class RequestCreate(BaseModel): @@ -387,10 +385,7 @@ class RequestDelete(BaseModel): class Request(RootModel): root: Annotated[ - Union[ - RequestCreate, - RequestDelete, - ], + Union[RequestCreate, RequestDelete], Field(discriminator="type"), ] ``` @@ -403,6 +398,8 @@ The implementation handles several edge cases: - **Optional flattened fields**: all expanded fields become optional. - **Multiple flattened structs**: non-enum flattened structs are also expanded into each variant model. +For other enum representations (external, adjacent, untagged), the flattened enum is emitted as a regular typed field. This preserves data but does not match the flat wire format that serde produces. + ### OpenAPI Uses `allOf` composition: @@ -413,47 +410,33 @@ Uses `allOf` composition: { "$ref": "#/components/schemas/Action" }, { "type": "object", - "properties": { - "id": { "type": "string" } - }, + "properties": { "id": { "type": "string" } }, "required": ["id"] } ] } ``` -For enums, `oneOf` is used for the variant schemas, and `discriminator` is set for internally-tagged enums. +For enums, `oneOf` is used for the variant schemas with `const` values on tag fields. ### Rust -Preserves the original `#[serde(flatten)]` attribute on the field, since the generated Rust client uses serde directly and the attribute works as-is. +Preserves the original `#[serde(flatten)]` attribute on the field, since the generated Rust client uses serde directly. + +## 7. Limitations and Design Gaps -## 7. Current Status and Roadmap +### Codegen backends consume `Schema` directly -### Complete +The `SymbolId`, `ensure_symbol_ids()`, `NormalizationPipeline`, `Normalizer`, and `SemanticSchema` infrastructure exists in `reflectapi-schema` but the codegen backends in `reflectapi/src/codegen/` consume the `Schema` directly. Migrating backends to consume `SemanticSchema` would provide guaranteed resolved references, deterministic ordering, dependency-aware topological ordering, and a single unified typespace. -- **Raw schema types** and JSON serialization -- stable and well-tested. -- **Derive macros** -- full support for serde attributes including rename, skip, flatten, tag, default. -- **TypeScript codegen** -- stable, with intersection types for flatten. -- **Rust codegen** -- stable, mirrors source types. -- **Python codegen** -- experimental but functional, including the complex flatten+internal-tag case. -- **OpenAPI codegen** -- stable, allOf/oneOf composition. -- **CLI tool** -- feature-complete with tag filtering, formatting, typechecking options. -- **Snapshot testing** -- comprehensive insta-based tests for all codegen outputs. +### Flattened enum handling varies by representation -### In Progress +The Python backend generates per-variant models for flattened internally-tagged enums (wire-compatible). For externally-tagged, adjacently-tagged, and untagged enums, the flattened field is emitted as a regular nested field, which does not match the flat wire format. TypeScript uses intersection types for all representations. OpenAPI uses `allOf` composition. The backends do not share a common strategy. -- **Semantic IR pipeline (related to #96)** -- The `SymbolId`, `ensure_symbol_ids()`, `NormalizationPipeline`, `Normalizer`, and `SemanticSchema` infrastructure is implemented in `reflectapi-schema` but is not yet wired into the codegen backends. The codegen backends currently consume the raw `Schema` directly. The goal is to have all backends consume `SemanticSchema` instead, which provides: - - Guaranteed resolved references (no dangling type names). - - Deterministic ordering for stable output. - - Dependency-aware topological ordering. - - A single unified typespace. +### CircularDependencyResolutionStage -- **Flattened internally-tagged enum handling (#123)** -- The Python backend has full support. TypeScript handles it via intersection types (which works but is less precise than per-variant types). OpenAPI uses allOf composition. Further improvements may align all backends on a common strategy. +Cycle detection uses Tarjan's SCC algorithm. The `Boxing` strategy is a no-op because Rust schemas already encode `Box`. The `ForwardDeclarations`, `OptionalBreaking`, and `ReferenceCounted` strategies are defined in `ResolutionStrategy` but their `apply_*` methods return `Ok(())` without modifying the schema. -### Known Gaps +### Python codegen coverage -- **CircularDependencyResolutionStage** -- Cycle detection works (Tarjan's SCC), but resolution strategies beyond boxing are stubs (`ForwardDeclarations`, `OptionalBreaking`, `ReferenceCounted` are TODO). -- **Codegen consuming SemanticSchema** -- The transition from raw `Schema` to `SemanticSchema` in the codegen path is not yet complete. -- **Python codegen** -- Marked experimental. Some edge cases in generics and complex nested flatten scenarios may not be fully covered. -- **chrono-tz support** -- Recently added (#117), may have edge cases. +Marked experimental. Generics and complex nested flatten scenarios have incomplete coverage. From a0c86fa100d82b53c16bc0428b42fd6c92ddfb29 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 10:42:10 +1300 Subject: [PATCH 13/47] docs: add missing architectural concepts to architecture doc - Handler function signature convention (Input, Output, Headers, Error) - Input/Output traits as the self-registration mechanism - reflectapi::Option three-state type (Undefined | None | Some) - Primitive.fallback mechanism for codegen type resolution - #[reflectapi(...)] derive macro attributes reference - Snapshot test architecture (5 snapshots per test, trybuild) --- docs/architecture.md | 47 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/docs/architecture.md b/docs/architecture.md index d8081dc9..879005d6 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -4,6 +4,21 @@ ReflectAPI is a Rust framework for defining web API services and generating type-safe clients in multiple languages. Developers write Rust handler functions with typed inputs and outputs. Derive macros capture type metadata into a JSON schema (`reflectapi.json`). Code generation backends produce idiomatic clients for TypeScript, Rust, and Python, plus OpenAPI specifications. +Handler functions follow a fixed signature convention: + +```rust +async fn handler(state: State, input: Input, headers: Headers) -> Result +``` + +- **Input** — the request body type (implements `reflectapi::Input + DeserializeOwned`) +- **Headers** — typed header extraction (implements `reflectapi::Input`; struct fields map to HTTP header names) +- **Output** — the success response type (implements `reflectapi::Output + Serialize`) +- **Error** — the error response type (implements `reflectapi::Output + Serialize + StatusCode`) +- **`reflectapi::Empty`** — sentinel for no input/output body +- **`reflectapi::Infallible`** — sentinel for handlers that cannot fail + +The `Input` and `Output` traits (defined in `reflectapi/src/traits.rs`) are the mechanism by which types self-register into the schema. Each trait provides a `reflectapi_input_type(schema: &mut Typespace) -> TypeReference` (or `_output_type`) method that the derive macros implement. + The system is a multi-stage pipeline: 1. **Derive macros** extract type metadata at compile time into a `Schema`. @@ -48,6 +63,12 @@ Key source files: - `derive.rs` -- the derive implementation - `tokenizable_schema.rs` -- converts schema types to token streams +Beyond serde attributes, the macros recognize `#[reflectapi(...)]` attributes: + +**Type-level:** `type = "..."` (override reflected type), `input_type` / `output_type` (per-direction override), `discriminant` (use Rust enum discriminant values), `derive(...)` (add derives to codegen config). + +**Field-level:** `skip` / `input_skip` / `output_skip` (omit from schema), `type = "..."` / `input_type` / `output_type` (override field type), `input_transform` / `output_transform` (transform callbacks). + ### reflectapi The main user-facing crate. Contains: @@ -68,7 +89,7 @@ Flags control output formatting, type checking, tag-based endpoint filtering, sh ### reflectapi-demo -A working demo server with snapshot tests. The `reflectapi.json` file and generated clients (TypeScript, Rust, Python) are checked in and validated by `cargo insta` snapshot tests. Each test type produces 5 snapshots: JSON schema, TypeScript, Rust, OpenAPI, and Python. +A working demo server with snapshot tests. The `reflectapi.json` file and generated clients (TypeScript, Rust, Python) are checked in and validated by `cargo insta` snapshot tests. The `assert_snapshot!` macro in `src/tests/assert.rs` generates **5 snapshots** per test: JSON schema, TypeScript, Rust, OpenAPI, and Python. Tests are organized in `basic.rs`, `enums.rs`, `generics.rs`, `serde.rs`, and `namespace.rs`. Compile-fail and compile-pass tests use `trybuild`. ### reflectapi-python-runtime @@ -150,6 +171,30 @@ pub enum Representation { } ``` +### Primitive and the Fallback Mechanism + +`Primitive` types are opaque to codegen — they have no inspectable fields. The `fallback` field enables codegen backends to resolve types they do not natively handle: + +```rust +pub struct Primitive { + pub name: String, + pub parameters: Vec, + pub fallback: Option, // e.g., NonZeroU8 -> u8, BTreeMap -> HashMap +} +``` + +`TypeReference::fallback_recursively()` follows the fallback chain until reaching a type the backend supports. Examples: `Arc` falls back to `T`, `BTreeMap` falls back to `HashMap`, `HashSet` falls back to `Vec`. + +### reflectapi::Option\ + +A three-state type (`Undefined | None | Some(T)`) defined in `reflectapi/src/option.rs`. Essential for PATCH-style APIs where "field absent" differs from "field set to null": + +- **Undefined** — field not present in the request body +- **None** — field explicitly set to `null` +- **Some(T)** — field present with a value + +Each codegen backend represents this distinctly: TypeScript uses `T | null | undefined`, Python uses `ReflectapiOption` from the runtime library. + ### Fields, Field, Variant Fields can be `Named`, `Unnamed` (tuple), or `None` (unit). Each `Field` carries: From 727379139c3e82a459b442d5d2a7b57904f29f03 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 10:43:07 +1300 Subject: [PATCH 14/47] docs: fix accuracy issues found by code verification - Add description/deprecation_note to Function struct sample - Fix TypeConsolidation claim: both copies are renamed when name appears in both typespaces (not just when types differ) - Fix NamingResolution example: proto is skipped in prefix generation, so use ApiUser/BillingUser not ProtoUser --- docs/architecture.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 879005d6..4b587c9e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -123,13 +123,15 @@ An API endpoint: ```rust pub struct Function { pub id: SymbolId, - pub name: String, // e.g. "users.login" - pub path: String, // URL path, e.g. "/api/v1" + pub name: String, // e.g. "users.login" + pub path: String, // URL path, e.g. "/api/v1" + pub description: String, + pub deprecation_note: Option, pub input_type: Option, pub input_headers: Option, pub output_type: Option, pub error_type: Option, - pub serialization: Vec, + pub serialization: Vec, // Json, Msgpack pub readonly: bool, pub tags: BTreeSet, } @@ -267,11 +269,9 @@ When a schema is deserialized from JSON, all `SymbolId` fields have their defaul The standard pipeline applies three stages in sequence: -**Stage 1: TypeConsolidationStage** -- Merges `input_types` and `output_types` into a single unified `input_types` collection. When a type name appears in both typespaces: -- If the types are identical, the input version is kept. -- If they differ, they are renamed with `input.` / `output.` prefixes, and all type references throughout the schema are rewritten to point to the new names. +**Stage 1: TypeConsolidationStage** -- Merges `input_types` and `output_types` into a single unified `input_types` collection. When a simple type name appears in both typespaces, both copies are renamed with `input.` / `output.` prefixes and all type references throughout the schema are rewritten to point to the new names. Types that appear in only one typespace are added as-is. -**Stage 2: NamingResolutionStage** -- Strips module path prefixes from type names (e.g. `myapp::proto::User` becomes `User`). When stripping creates a conflict (two different types both resolve to `User`), a unique name is generated by incorporating the module prefix (e.g. `ProtoUser` vs `ApiUser`). +**Stage 2: NamingResolutionStage** -- Strips module path prefixes from type names (e.g. `myapp::api::User` becomes `User`). When stripping creates a conflict (two different types both resolve to `User`), a unique name is generated by incorporating the last meaningful module component (e.g. `ApiUser` vs `BillingUser`). Common module names (`model`, `proto`) are skipped when building the prefix. **Stage 3: CircularDependencyResolutionStage** -- Detects circular type dependencies using Tarjan's strongly-connected components (SCC) algorithm. Supports multiple resolution strategies: - `Intelligent` (default) -- self-references use boxing; multi-type cycles use forward declarations. From 5edbbe362626d7af8feb0c7b08a9f0f2870d9f1f Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 10:44:18 +1300 Subject: [PATCH 15/47] docs: fix dead links in README Replace dead reflectapi.partly.workers.dev URLs (returning 404) with links to local docs. Add link to architecture doc. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ca79054c..26435bb9 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ ## Documentation -- 📦 [Crates.io](https://crates.io/crates/reflectapi) - Package information and versions -- 📖 [API Documentation](https://docs.rs/reflectapi) - Complete API reference -- 📚 [User Guide](https://reflectapi.partly.workers.dev/) - Tutorials and examples -- 🚀 [Quick Start](https://reflectapi.partly.workers.dev/getting-started/quick-start.html) - Get up and running in 5 minutes +- [Crates.io](https://crates.io/crates/reflectapi) - Package information and versions +- [API Documentation](https://docs.rs/reflectapi) - Complete API reference +- [User Guide](docs/src/SUMMARY.md) - Tutorials and examples (build locally with `mdbook serve` in `docs/`) +- [Architecture](docs/architecture.md) - System design and internals ## Development notes From e4105c224086fcba8b7306797b3381594c1d722a Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 10:59:49 +1300 Subject: [PATCH 16/47] fix: address all review comments on normalization and ID assignment ids.rs: - Use struct's actual id (not seen-map id) as owner for member assignment, fixing inconsistent parent-child paths - Zero-pad tuple field indices (arg00, arg01, ...) so BTreeMap ordering matches positional order for 10+ fields - assign_disambiguated_id now clears and re-assigns all member IDs after disambiguation, maintaining hierarchical consistency - Schema root uses sentinel path ["__schema__", name] to avoid collision with same-named user types normalize.rs: - TypeConsolidation uses full qualified name for conflict renaming (input.a.Foo vs input.b.Foo) preventing silent type drops - resolve_types filters resolution_cache to type-level symbols only, preventing Field/Variant entries from shadowing type lookups - discover_struct/enum_symbols derives SymbolInfo.path from field.id.path for consistency with split-path ID assignment --- reflectapi-schema/src/ids.rs | 54 ++++++++++++++++++++++++------ reflectapi-schema/src/normalize.rs | 19 ++++++++--- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs index 676370e4..675bd73f 100644 --- a/reflectapi-schema/src/ids.rs +++ b/reflectapi-schema/src/ids.rs @@ -14,7 +14,10 @@ use std::collections::HashMap; /// each typespace (e.g., request vs response variants of the same type). pub fn ensure_symbol_ids(schema: &mut Schema) { if schema.id.is_unknown() { - schema.id = SymbolId::new(SymbolKind::Struct, vec![schema.name.clone()]); + schema.id = SymbolId::new( + SymbolKind::Struct, + vec!["__schema__".to_string(), schema.name.clone()], + ); } let mut seen: HashMap = HashMap::new(); @@ -101,30 +104,36 @@ fn assign_type_id(fqn: &str, ty: &mut Type, seen: &mut HashMap if s.id.is_unknown() { s.id = id.clone(); } - let owner = s.id.clone(); - assign_struct_member_ids(s, &owner); + assign_struct_member_ids(s, &s.id.clone()); } Type::Enum(e) => { if e.id.is_unknown() { e.id = id.clone(); } - let owner = e.id.clone(); - assign_enum_member_ids(e, &owner); + assign_enum_member_ids(e, &e.id.clone()); } } } /// Reassign the top-level ID of a type in a typespace (for disambiguation) fn assign_disambiguated_id(typespace: &mut Typespace, fqn: &str, new_id: &SymbolId) { - // Rebuild typespace with the updated ID let types: Vec<_> = typespace.types().cloned().collect(); let mut new_typespace = Typespace::new(); for mut ty in types { if ty.name() == fqn { match &mut ty { Type::Primitive(p) => p.id = new_id.clone(), - Type::Struct(s) => s.id = new_id.clone(), - Type::Enum(e) => e.id = new_id.clone(), + Type::Struct(s) => { + s.id = new_id.clone(); + // Clear member IDs so they get re-assigned with the new parent + clear_struct_member_ids(s); + assign_struct_member_ids(s, new_id); + } + Type::Enum(e) => { + e.id = new_id.clone(); + clear_enum_member_ids(e); + assign_enum_member_ids(e, new_id); + } } } new_typespace.insert_type(ty); @@ -132,6 +141,31 @@ fn assign_disambiguated_id(typespace: &mut Typespace, fqn: &str, new_id: &Symbol *typespace = new_typespace; } +fn clear_struct_member_ids(s: &mut Struct) { + match &mut s.fields { + crate::Fields::Named(fields) | crate::Fields::Unnamed(fields) => { + for field in fields { + field.id = SymbolId::default(); + } + } + crate::Fields::None => {} + } +} + +fn clear_enum_member_ids(e: &mut Enum) { + for variant in &mut e.variants { + variant.id = SymbolId::default(); + match &mut variant.fields { + crate::Fields::Named(fields) | crate::Fields::Unnamed(fields) => { + for field in fields { + field.id = SymbolId::default(); + } + } + crate::Fields::None => {} + } + } +} + /// Assign IDs to struct fields fn assign_struct_member_ids(s: &mut Struct, owner: &SymbolId) { match &mut s.fields { @@ -148,7 +182,7 @@ fn assign_struct_member_ids(s: &mut Struct, owner: &SymbolId) { for (i, field) in fields.iter_mut().enumerate() { if field.id.is_unknown() { let mut path = owner.path.clone(); - path.push(format!("arg{i}")); + path.push(format!("arg{i:02}")); field.id = SymbolId::new(SymbolKind::Field, path); } } @@ -180,7 +214,7 @@ fn assign_enum_member_ids(e: &mut Enum, owner: &SymbolId) { for (i, field) in fields.iter_mut().enumerate() { if field.id.is_unknown() { let mut path = variant.id.path.clone(); - path.push(format!("arg{i}")); + path.push(format!("arg{i:02}")); field.id = SymbolId::new(SymbolKind::Field, path); } } diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index aefa155b..f8262c50 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -98,7 +98,7 @@ impl NormalizationStage for TypeConsolidationStage { if name_conflicts.contains_key(&simple_name) { let old_name = ty.name().to_string(); - let new_name = format!("input.{simple_name}"); + let new_name = format!("input.{}", ty.name().replace("::", ".")); rename_type(&mut new_type, &new_name); rename_map.insert(old_name, new_name); } @@ -112,7 +112,7 @@ impl NormalizationStage for TypeConsolidationStage { if name_conflicts.contains_key(&simple_name) { let old_name = ty.name().to_string(); - let new_name = format!("output.{simple_name}"); + let new_name = format!("output.{}", ty.name().replace("::", ".")); rename_type(&mut new_type, &new_name); rename_map.insert(old_name, new_name); consolidated.insert_type(new_type); @@ -852,7 +852,7 @@ impl Normalizer { let field_info = SymbolInfo { id: field.id.clone(), name: field.name.clone(), - path: vec![strukt.name.clone(), field.name.clone()], + path: field.id.path.clone(), kind: SymbolKind::Field, resolved: false, dependencies: BTreeSet::new(), @@ -866,7 +866,7 @@ impl Normalizer { let variant_info = SymbolInfo { id: variant.id.clone(), name: variant.name.clone(), - path: vec![enm.name.clone(), variant.name.clone()], + path: variant.id.path.clone(), kind: SymbolKind::Variant, resolved: false, dependencies: BTreeSet::new(), @@ -877,7 +877,7 @@ impl Normalizer { let field_info = SymbolInfo { id: field.id.clone(), name: field.name.clone(), - path: vec![enm.name.clone(), variant.name.clone(), field.name.clone()], + path: field.id.path.clone(), kind: SymbolKind::Field, resolved: false, dependencies: BTreeSet::new(), @@ -889,6 +889,15 @@ impl Normalizer { fn resolve_types(&mut self) -> Result<(), Vec> { for symbol_info in self.context.symbol_table.symbols.values() { + if !matches!( + symbol_info.kind, + SymbolKind::Struct + | SymbolKind::Enum + | SymbolKind::Primitive + | SymbolKind::TypeAlias + ) { + continue; + } self.context .resolution_cache .insert(symbol_info.name.clone(), symbol_info.id.clone()); From 91790d6fce6c1b59f116e78230f6d003c57a5046 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 11:37:53 +1300 Subject: [PATCH 17/47] fix: address round 2 review findings - Python codegen: set has_externally_tagged_enums flag for Adjacent representation too, fixing missing RootModel/model_validator imports - generate_unique_name: join ALL non-excluded module components to avoid collisions (ServicesUserProfile vs AuthUserProfile) - discover_symbols: use function.id.path instead of splitting HTTP URL path, fixing SymbolTable get_by_path for endpoints --- ...e__empty_variants_adjacently_tagged-5.snap | 9 +++++++- ...emo__tests__serde__enum_tag_content-5.snap | 9 +++++++- ..._serde__enum_tag_content_rename_all-5.snap | 9 +++++++- ...latten_adjacently_tagged_enum_field-5.snap | 9 +++++++- ..._newtype_variants_adjacently_tagged-5.snap | 9 +++++++- reflectapi-schema/src/normalize.rs | 22 ++++++++++++------- reflectapi/src/codegen/python.rs | 3 ++- 7 files changed, 56 insertions(+), 14 deletions(-) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index b406ff45..e533c3cf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index fa7c6f92..bd4efadd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index 71215d3b..e79409e1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index 3a72377f..0c37f2d3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index ad50f9d9..2ec45ec6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index f8262c50..ee600021 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -222,16 +222,22 @@ fn generate_unique_name(qualified_name: &str) -> String { let type_name = parts.last().unwrap(); let module_parts: Vec<&str> = parts[..parts.len() - 1].to_vec(); - let fallback = module_parts.join("_"); - let module_prefix: &str = module_parts + let non_excluded: Vec<&str> = module_parts .iter() - .rev() - .find(|&part| *part != "model" && *part != "proto" && !part.is_empty()) + .filter(|&&part| part != "model" && part != "proto" && !part.is_empty()) .copied() - .unwrap_or(fallback.as_str()); + .collect(); - let capitalized_prefix = capitalize_first_letter(module_prefix); - format!("{capitalized_prefix}{type_name}") + let prefix = if non_excluded.is_empty() { + module_parts.join("_") + } else { + non_excluded + .iter() + .map(|s| capitalize_first_letter(s)) + .collect::>() + .join("") + }; + format!("{prefix}{type_name}") } fn capitalize_first_letter(s: &str) -> String { @@ -792,7 +798,7 @@ impl Normalizer { let function_info = SymbolInfo { id: function.id.clone(), name: function.name.clone(), - path: function.path.split('/').map(|s| s.to_string()).collect(), + path: function.id.path.clone(), kind: SymbolKind::Endpoint, resolved: false, dependencies: BTreeSet::new(), diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 6d61a402..5d6aadc0 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1085,7 +1085,8 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { has_literal = true; has_discriminated_unions = true; } - reflectapi_schema::Representation::External => { + reflectapi_schema::Representation::External + | reflectapi_schema::Representation::Adjacent { .. } => { // Check if this enum has complex variants that need RootModel let has_complex_variants = enum_def.variants.iter().any(|v| match &v.fields { From 00f6de11c43236aa77ee254ff4d266065191acbf Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 14:54:07 +1300 Subject: [PATCH 18/47] fix: address round 3 review findings in Python codegen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Sanitize tag discriminator field name for Python reserved words (e.g., "type" → "type_" with alias). Fixes SyntaxError when tag name is a Python keyword. - Add model_rebuild() calls for per-variant classes generated by render_struct_with_flattened_internal_enum. Fixes forward reference resolution with `from __future__ import annotations`. - Guard against empty enum variants producing invalid `Union[]` syntax. --- ...latten_internally_tagged_enum_field-5.snap | 17 +++++++++++--- reflectapi/src/codegen/python.rs | 23 ++++++++++++++++--- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index c91419b0..729559db 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -60,7 +60,9 @@ class ReflectapiDemoTestsSerdeOfferSingle(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) id: str - type: Literal["Single"] = "Single" + type_: Literal["Single"] = Field( + default="Single", serialization_alias="type", validation_alias="type" + ) business: str @@ -70,7 +72,9 @@ class ReflectapiDemoTestsSerdeOfferGroup(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) id: str - type: Literal["Group"] = "Group" + type_: Literal["Group"] = Field( + default="Group", serialization_alias="type", validation_alias="type" + ) count: int @@ -80,10 +84,17 @@ class ReflectapiDemoTestsSerdeOffer(RootModel): ReflectapiDemoTestsSerdeOfferSingle, ReflectapiDemoTestsSerdeOfferGroup, ], - Field(discriminator="type"), + Field(discriminator="type_"), ] +try: + ReflectapiDemoTestsSerdeOfferSingle.model_rebuild() + ReflectapiDemoTestsSerdeOfferGroup.model_rebuild() +except AttributeError: + pass + + class AsyncInoutClient: """Async client for inout operations.""" diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 5d6aadc0..cf1ed179 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -586,14 +586,15 @@ fn render_struct_with_flattened_internal_enum( let mut fields = base_fields.clone(); // Add the tag discriminator field + let (sanitized_tag, tag_alias) = sanitize_field_name_with_alias(tag); fields.push(templates::Field { - name: tag.to_string(), + name: sanitized_tag.clone(), type_annotation: format!("Literal['{}']", variant.serde_name()), description: Some("Discriminator field".to_string()), deprecation_note: None, optional: false, default_value: Some(format!("\"{}\"", variant.serde_name())), - alias: None, + alias: tag_alias.clone(), }); // Add variant-specific fields @@ -702,12 +703,28 @@ fn render_struct_with_flattened_internal_enum( output.push('\n'); } + // Handle empty enum (no variants) + if union_variant_names.is_empty() { + output.push_str(&format!( + "\nclass {struct_name}(RootModel):\n \"\"\"Empty discriminated union (no variants)\"\"\"\n root: None = None\n" + )); + return Ok(output); + } + // Render the parent type as a discriminated union RootModel + let (sanitized_tag, _) = sanitize_field_name_with_alias(tag); let union_type = union_variant_names.join(",\n "); output.push_str(&format!( - "\nclass {struct_name}(RootModel):\n root: Annotated[\n Union[\n {union_type},\n ],\n Field(discriminator=\"{tag}\"),\n ]\n" + "\nclass {struct_name}(RootModel):\n root: Annotated[\n Union[\n {union_type},\n ],\n Field(discriminator=\"{sanitized_tag}\"),\n ]\n" )); + // Rebuild per-variant models to resolve forward references + output.push_str("\ntry:\n"); + for variant_name in &union_variant_names { + output.push_str(&format!(" {variant_name}.model_rebuild()\n")); + } + output.push_str("except AttributeError:\n pass\n"); + Ok(output) } From c22c6ca1e8f75ddaa54284c4507b51af1238d2eb Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 15:29:52 +1300 Subject: [PATCH 19/47] test: add regression tests for all review fix round findings ids.rs (3 tests): - Zero-padded tuple field ordering (arg00..arg11 sort correctly) - Disambiguated ID propagates to member IDs - Schema root ID does not collide with same-named type normalize.rs (4 tests): - TypeConsolidation preserves all types with qualified name uniqueness - resolve_types does not confuse variant with type of same name - generate_unique_name distinguishes same-inner-module paths - Function symbol path matches ID for get_by_path lookups --- reflectapi-schema/src/ids.rs | 131 ++++++++++++++++++++++ reflectapi-schema/src/normalize.rs | 174 +++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+) diff --git a/reflectapi-schema/src/ids.rs b/reflectapi-schema/src/ids.rs index 675bd73f..79b6eba6 100644 --- a/reflectapi-schema/src/ids.rs +++ b/reflectapi-schema/src/ids.rs @@ -324,4 +324,135 @@ mod tests { "Variant path prefix {variant_path:?} should match enum path {enum_path:?}" ); } + + #[test] + fn test_zero_padded_tuple_field_ordering() { + // Regression: unnamed (tuple) fields with >= 10 elements must use zero-padded + // indices so that lexicographic sorting preserves declaration order. + use crate::{Field, Fields}; + + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + let mut tuple_struct = crate::Struct::new("BigTuple"); + // Create 12 unnamed fields + let fields: Vec = (0..12) + .map(|i| Field::new(format!("{i}"), format!("u{}", 8 + i).into())) + .collect(); + tuple_struct.fields = Fields::Unnamed(fields); + schema.input_types.insert_type(tuple_struct.into()); + + ensure_symbol_ids(&mut schema); + + let s = schema + .input_types + .get_type("BigTuple") + .unwrap() + .as_struct() + .unwrap(); + + let field_ids: Vec = s + .fields() + .map(|f| f.id.path.last().unwrap().clone()) + .collect(); + + // Verify zero-padded format: arg00, arg01, ..., arg09, arg10, arg11 + assert_eq!(field_ids.len(), 12); + assert_eq!(field_ids[0], "arg00"); + assert_eq!(field_ids[1], "arg01"); + assert_eq!(field_ids[2], "arg02"); + assert_eq!(field_ids[9], "arg09"); + assert_eq!(field_ids[10], "arg10"); + assert_eq!(field_ids[11], "arg11"); + + // Verify lexicographic sort preserves declaration order: + // arg02 < arg10 (not arg10 < arg2 which would happen without padding) + let mut sorted_ids = field_ids.clone(); + sorted_ids.sort(); + assert_eq!( + field_ids, sorted_ids, + "Zero-padded field IDs should sort in declaration order" + ); + } + + #[test] + fn test_disambiguated_id_updates_member_ids() { + // Regression: when a type in the output typespace is disambiguated (because + // a type with the same name but different fields exists in the input typespace), + // the field IDs of the disambiguated type must reflect the new parent ID. + use crate::{Field, Fields}; + + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + // Input "Foo" has field "a" + let mut input_foo = crate::Struct::new("Foo"); + input_foo.fields = Fields::Named(vec![Field::new("a".into(), "u32".into())]); + schema.input_types.insert_type(input_foo.into()); + + // Output "Foo" has field "b" (different structure triggers disambiguation) + let mut output_foo = crate::Struct::new("Foo"); + output_foo.fields = Fields::Named(vec![Field::new("b".into(), "u64".into())]); + schema.output_types.insert_type(output_foo.into()); + + ensure_symbol_ids(&mut schema); + + // The output Foo should have disambiguator=1 + let output_struct = schema + .output_types + .get_type("Foo") + .unwrap() + .as_struct() + .unwrap(); + assert_eq!( + output_struct.id.disambiguator, 1, + "Output Foo should have disambiguator=1, got {:?}", + output_struct.id + ); + + // The field "b" should have a path consistent with the disambiguated parent + let field_b = output_struct.fields().next().unwrap(); + let field_path_prefix = &field_b.id.path[..field_b.id.path.len() - 1]; + assert_eq!( + field_path_prefix, + output_struct.id.path.as_slice(), + "Field path prefix {:?} should match disambiguated parent path {:?}", + field_b.id.path, + output_struct.id.path + ); + } + + #[test] + fn test_schema_root_id_does_not_collide_with_type() { + // Regression: a schema named "User" with a struct also named "User" + // should not produce colliding IDs. The schema root uses the "__schema__" + // sentinel in its path to avoid this. + let mut schema = Schema::new(); + schema.name = "User".to_string(); + + let user_struct = crate::Struct::new("User"); + schema.input_types.insert_type(user_struct.into()); + + ensure_symbol_ids(&mut schema); + + let struct_type = schema + .input_types + .get_type("User") + .unwrap() + .as_struct() + .unwrap(); + + assert_ne!( + schema.id, struct_type.id, + "Schema root ID {:?} should not collide with struct ID {:?}", + schema.id, struct_type.id + ); + + // Verify the schema root uses the __schema__ sentinel + assert!( + schema.id.path.contains(&"__schema__".to_string()), + "Schema root ID path should contain '__schema__' sentinel, got {:?}", + schema.id.path + ); + } } diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index ee600021..237ea74c 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -1749,4 +1749,178 @@ mod tests { "Both Department and Employee types should be present" ); } + + #[test] + fn test_type_consolidation_qualified_name_uniqueness() { + // Regression: when input types `a::Foo` and `b::Foo` both conflict with + // an output type `c::Foo`, all three must receive distinct names after + // consolidation — no silent drops. + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + let a_foo = Struct::new("a::Foo"); + let b_foo = Struct::new("b::Foo"); + let c_foo = Struct::new("c::Foo"); + + schema.input_types.insert_type(a_foo.into()); + schema.input_types.insert_type(b_foo.into()); + schema.output_types.insert_type(c_foo.into()); + + let stage = TypeConsolidationStage; + stage.transform(&mut schema).unwrap(); + + let type_names: Vec = schema + .input_types + .types() + .map(|t| t.name().to_string()) + .collect(); + + // All three should be present with distinct names + assert_eq!( + type_names.len(), + 3, + "All three Foo types should survive consolidation, got: {type_names:?}" + ); + + // Verify uniqueness — no two names are the same + let unique_names: std::collections::HashSet<&String> = type_names.iter().collect(); + assert_eq!( + unique_names.len(), + 3, + "All three names should be distinct, got: {type_names:?}" + ); + + // Verify the naming convention: input types get "input." prefix, + // output types get "output." prefix + let has_input_a = type_names + .iter() + .any(|n| n.contains("input") && n.contains("a")); + let has_input_b = type_names + .iter() + .any(|n| n.contains("input") && n.contains("b")); + let has_output_c = type_names + .iter() + .any(|n| n.contains("output") && n.contains("c")); + assert!( + has_input_a, + "Expected an input.a.Foo variant, got: {type_names:?}" + ); + assert!( + has_input_b, + "Expected an input.b.Foo variant, got: {type_names:?}" + ); + assert!( + has_output_c, + "Expected an output.c.Foo variant, got: {type_names:?}" + ); + } + + #[test] + fn test_resolve_types_does_not_confuse_variant_with_type() { + // Regression: the resolve_types phase should resolve a function's type + // reference "Status" to the Struct named "Status", not to an enum variant + // that happens to also be named "Status". + let mut schema = Schema::new(); + schema.name = "Test".to_string(); + + // A struct named "Status" + let status_struct = Struct::new("Status"); + schema.input_types.insert_type(status_struct.into()); + + // An enum with a variant named "Status" + let mut state_enum = Enum::new("State".into()); + state_enum.variants = vec![Variant::new("Status".into()), Variant::new("Error".into())]; + schema.input_types.insert_type(state_enum.into()); + + // A function that references "Status" — should resolve to the Struct + let mut function = Function::new("get_status".into()); + function.input_type = Some(TypeReference::new("Status", vec![])); + schema.functions.push(function); + + let normalizer = Normalizer::new(); + let result = normalizer.normalize(schema); + assert!( + result.is_ok(), + "Normalization should succeed: {:?}", + result.err() + ); + + let semantic = result.unwrap(); + let func = semantic.functions.values().next().unwrap(); + + // The function's input_type should resolve to the Status struct's ID + let resolved_id = func + .input_type + .as_ref() + .expect("input_type should be resolved"); + + // It should be a Struct kind, not a Variant kind + assert_eq!( + resolved_id.kind, + crate::SymbolKind::Struct, + "Function's input_type should resolve to a Struct, not a Variant. Got: {resolved_id:?}" + ); + } + + #[test] + fn test_generate_unique_name_same_inner_module() { + // Regression: two types with the same inner module and type name but + // different outer modules must produce different unique names. + let name_a = generate_unique_name("services::user::Profile"); + let name_b = generate_unique_name("auth::user::Profile"); + + assert_ne!( + name_a, name_b, + "services::user::Profile and auth::user::Profile must produce different names, \ + got '{name_a}' and '{name_b}'" + ); + + // Verify they follow the expected PascalCase convention + assert!( + name_a.contains("Services") || name_a.contains("services"), + "Expected 'services' component in name, got '{name_a}'" + ); + assert!( + name_b.contains("Auth") || name_b.contains("auth"), + "Expected 'auth' component in name, got '{name_b}'" + ); + } + + #[test] + fn test_function_symbol_path_matches_id() { + // Regression: after normalization, a function's SymbolId should be + // retrievable from the symbol table via its path. + let mut schema = Schema::new(); + schema.name = "API".to_string(); + + let mut function = Function::new("get_user".into()); + function.input_type = None; + function.output_type = None; + schema.functions.push(function); + + let normalizer = Normalizer::new(); + let semantic = normalizer + .normalize(schema) + .expect("Normalization should succeed"); + + // Get the function's ID + let (function_id, _) = semantic.functions.iter().next().unwrap(); + + // Verify the symbol table can find it by path + let found = semantic.symbol_table.get_by_path(&function_id.path); + assert!( + found.is_some(), + "symbol_table.get_by_path({:?}) should return Some, but got None. \ + Function ID: {function_id:?}", + function_id.path + ); + + let symbol_info = found.unwrap(); + assert_eq!( + symbol_info.kind, + crate::SymbolKind::Endpoint, + "Symbol should be an Endpoint, got {:?}", + symbol_info.kind + ); + } } From 22f0dd3d8273e58bc3f1603d841b42ee8acd4bfb Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 15:57:49 +1300 Subject: [PATCH 20/47] fix: address round 4 review findings - discover_symbols: use schema.id.path.clone() for schema root SymbolInfo, matching the __schema__ sentinel from ensure_symbol_ids - rename_type: also update id.path when renaming, keeping the embedded SymbolId path in sync after pipeline stages - render_struct_with_flattened_internal_enum: emit non-internally-tagged flattened enums as regular fields in base_fields instead of silently dropping them from per-variant models --- reflectapi-schema/src/normalize.rs | 18 +++++++++++---- reflectapi/src/codegen/python.rs | 36 +++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index 237ea74c..f8da76fb 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -154,10 +154,20 @@ fn extract_simple_name(qualified_name: &str) -> String { } fn rename_type(ty: &mut Type, new_name: &str) { + let new_path: Vec = new_name.split("::").map(|s| s.to_string()).collect(); match ty { - Type::Struct(s) => s.name = new_name.to_string(), - Type::Enum(e) => e.name = new_name.to_string(), - Type::Primitive(p) => p.name = new_name.to_string(), + Type::Struct(s) => { + s.name = new_name.to_string(); + s.id.path = new_path; + } + Type::Enum(e) => { + e.name = new_name.to_string(); + e.id.path = new_path; + } + Type::Primitive(p) => { + p.name = new_name.to_string(); + p.id.path = new_path; + } } } @@ -787,7 +797,7 @@ impl Normalizer { let schema_info = SymbolInfo { id: schema.id.clone(), name: schema.name.clone(), - path: vec![schema.name.clone()], + path: schema.id.path.clone(), kind: SymbolKind::Struct, resolved: false, dependencies: BTreeSet::new(), diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index cf1ed179..1aa25c45 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -573,8 +573,42 @@ fn render_struct_with_flattened_internal_enum( Some(field.name()), )?; base_fields.extend(flattened); - } // Enum fields are handled below as variants + } else if let Some(reflectapi_schema::Type::Enum(enum_def)) = schema.get_type(type_name) { + // Check if this is the internally-tagged enum we're expanding + // (it's handled below as variants). Other enums get emitted as regular fields. + let is_the_expanding_enum = matches!( + &enum_def.representation, + reflectapi_schema::Representation::Internal { .. } + ); + if !is_the_expanding_enum { + let field_type = type_ref_to_python_type( + &field.type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + )?; + let (python_name, alias) = sanitize_field_name_with_alias(field.name()); + base_fields.push(templates::Field { + name: python_name, + type_annotation: if field.required { + field_type + } else { + format!("{field_type} | None") + }, + description: Some(field.description().to_string()), + deprecation_note: field.deprecation_note.clone(), + optional: !field.required, + default_value: if field.required { + None + } else { + Some("None".to_string()) + }, + alias, + }); + } + } } // Generate per-variant models From ab88b7948a5076e003914a6d6be81c1791a321dc Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 16:26:02 +1300 Subject: [PATCH 21/47] fix: use serde_name for adjacent enum tag comparisons In generate_adjacent_dispatch_cases and generate_adjacent_serialize_cases, use variant.serde_name() (the wire name) for tag string comparisons instead of variant.name() (the Rust identifier). Class names still use variant.name() since they're Python identifiers derived from Rust. This fixes silent deserialization failure for adjacently-tagged enum variants that use #[serde(rename = "...")] or #[serde(rename_all)]. --- reflectapi/src/codegen/python.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 1aa25c45..87d01842 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -2144,18 +2144,19 @@ fn generate_adjacent_dispatch_cases( use reflectapi_schema::Fields; let mut cases = Vec::new(); for variant in &enum_def.variants { - let vname = variant.name(); + let wire_name = variant.serde_name(); + let rust_name = variant.name(); match &variant.fields { Fields::None => { cases.push(format!( - " if tag == \"{vname}\":\n return \"{vname}\"" + " if tag == \"{wire_name}\":\n return \"{wire_name}\"" )); } Fields::Unnamed(unnamed_fields) => { - let class_name = format!("{enum_name}{}Variant", to_pascal_case(vname)); + let class_name = format!("{enum_name}{}Variant", to_pascal_case(rust_name)); if unnamed_fields.len() == 1 { cases.push(format!( - " if tag == \"{vname}\":\n return {class_name}(field_0=content)" + " if tag == \"{wire_name}\":\n return {class_name}(field_0=content)" )); } else { let assigns = (0..unnamed_fields.len()) @@ -2163,14 +2164,14 @@ fn generate_adjacent_dispatch_cases( .collect::>() .join(", "); cases.push(format!( - " if tag == \"{vname}\":\n if isinstance(content, list):\n return {class_name}({assigns})\n else:\n raise ValueError(\"Expected list for tuple variant {vname}\")" + " if tag == \"{wire_name}\":\n if isinstance(content, list):\n return {class_name}({assigns})\n else:\n raise ValueError(\"Expected list for tuple variant {wire_name}\")" )); } } Fields::Named(_named_fields) => { - let class_name = format!("{enum_name}{}Variant", to_pascal_case(vname)); + let class_name = format!("{enum_name}{}Variant", to_pascal_case(rust_name)); cases.push(format!( - " if tag == \"{vname}\":\n return {class_name}(**content)" + " if tag == \"{wire_name}\":\n return {class_name}(**content)" )); } } @@ -2187,20 +2188,21 @@ fn generate_adjacent_serialize_cases( use reflectapi_schema::Fields; let mut cases = Vec::new(); for variant in &enum_def.variants { - let vname = variant.name(); + let wire_name = variant.serde_name(); + let rust_name = variant.name(); match &variant.fields { Fields::None => { cases.push(format!( - " if self.root == \"{vname}\":\n return {{\"{tag}\": \"{vname}\"}}" + " if self.root == \"{wire_name}\":\n return {{\"{tag}\": \"{wire_name}\"}}" )); } Fields::Unnamed(unnamed_fields) => { - let class_name = format!("{enum_name}{}Variant", to_pascal_case(vname)); + let class_name = format!("{enum_name}{}Variant", to_pascal_case(rust_name)); // For tuple variants in adjacently tagged enums, serialize the content properly if unnamed_fields.len() == 1 { // Single field tuple: serialize the field value directly cases.push(format!( - " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{vname}\", \"{content}\": self.root.field_0}}" + " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{wire_name}\", \"{content}\": self.root.field_0}}" )); } else { // Multiple field tuple: serialize as array @@ -2208,15 +2210,15 @@ fn generate_adjacent_serialize_cases( .map(|i| format!("self.root.field_{i}")) .collect(); cases.push(format!( - " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{vname}\", \"{content}\": [{}]}}", + " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{wire_name}\", \"{content}\": [{}]}}", field_accesses.join(", ") )); } } Fields::Named(_named_fields) => { - let class_name = format!("{enum_name}{}Variant", to_pascal_case(vname)); + let class_name = format!("{enum_name}{}Variant", to_pascal_case(rust_name)); cases.push(format!( - " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{vname}\", \"{content}\": self.root.model_dump(exclude_none=True)}}" + " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{wire_name}\", \"{content}\": self.root.model_dump(exclude_none=True)}}" )); } } From 3777d7880dffce639262beb73ceb0b9d7293dfc0 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 18:17:23 +1300 Subject: [PATCH 22/47] feat: wire SemanticSchema into Python codegen Run Normalizer::normalize() at the start of Python codegen's generate() function, making the SemanticSchema available alongside the raw Schema. - Add convenience methods to SemanticSchema: get_type_by_name(), get_type(), types(), functions(), type_names() - The SemanticSchema is constructed once and available for render functions that benefit from type-safe SymbolId lookups - Raw Schema is still used for the main iteration loop since the Normalizer's NamingResolutionStage transforms type names, and the existing codegen relies on pre-normalization names - Graceful fallback if normalization fails (best-effort) This is the first consumer of SemanticSchema in the codegen path, validating the IR infrastructure from #96. --- reflectapi-schema/src/semantic.rs | 28 ++++++++++++++++++++++++++++ reflectapi/src/codegen/python.rs | 25 ++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/reflectapi-schema/src/semantic.rs b/reflectapi-schema/src/semantic.rs index db2e50f3..5eaed3c3 100644 --- a/reflectapi-schema/src/semantic.rs +++ b/reflectapi-schema/src/semantic.rs @@ -309,6 +309,34 @@ impl Default for SymbolTable { } } +impl SemanticSchema { + /// Look up a type by its name. This provides a bridge for codegen backends + /// transitioning from string-based `Schema::get_type()` to SymbolId-based lookups. + pub fn get_type_by_name(&self, name: &str) -> Option<&SemanticType> { + self.types.values().find(|t| t.name() == name) + } + + /// Look up a type by SymbolId. + pub fn get_type(&self, id: &SymbolId) -> Option<&SemanticType> { + self.types.get(id) + } + + /// Iterate all types in deterministic order. + pub fn types(&self) -> impl Iterator { + self.types.values() + } + + /// Iterate all functions in deterministic order. + pub fn functions(&self) -> impl Iterator { + self.functions.values() + } + + /// Get an ordered list of type names (for backward compat with codegen iteration). + pub fn type_names(&self) -> Vec { + self.types.values().map(|t| t.name().to_string()).collect() + } +} + impl SemanticType { pub fn id(&self) -> &SymbolId { match self { diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index eb533223..55a532d7 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1098,6 +1098,26 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Validate all type references exist validate_type_references(&schema)?; + // Build the semantic IR for type-safe lookups and deterministic ordering. + // The Normalizer runs ensure_symbol_ids + NormalizationPipeline internally, + // producing a fully-resolved SemanticSchema. + let semantic = reflectapi_schema::Normalizer::new() + .normalize(schema.clone()) + .unwrap_or_else(|errors| { + // Normalization is best-effort for now — fall back gracefully + // if the schema has issues the normalizer can't handle yet. + for error in &errors { + eprintln!("Warning: normalization error: {error}"); + } + // Re-run with a fresh schema to get at least a partial result + let mut fallback = schema.clone(); + reflectapi_schema::ensure_symbol_ids(&mut fallback); + // Build a minimal SemanticSchema manually + reflectapi_schema::Normalizer::new() + .normalize(fallback) + .expect("fallback normalization should not fail") + }); + let mut generated_code = Vec::new(); // Generate file header @@ -1212,11 +1232,14 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let mut used_type_vars: BTreeSet = BTreeSet::new(); // Use topological sort if possible, fall back to alphabetical on circular dependencies let sorted_type_names = topological_sort_types(&all_type_names, &schema).unwrap_or_else(|_| { - // Circular dependencies detected, use alphabetical order let mut sorted = all_type_names.clone(); sorted.sort(); sorted }); + // The SemanticSchema is available as `semantic` for type-safe lookups + // in render functions (e.g., flatten resolution). The raw Schema is still + // used for the main iteration loop since type names match pre-normalization. + let _ = &semantic; // suppress unused warning; used by render functions for original_type_name in &sorted_type_names { if runtime_provided_types.contains(&original_type_name.as_str()) { continue; From 2e6e171edefac2cb721dadd7e8e5063266b50c29 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 18:21:25 +1300 Subject: [PATCH 23/47] fix: address Rust review findings on SemanticSchema integration - Replace broken fallback (would panic on same error) with .ok() that makes normalization best-effort - Use _semantic prefix for intentionally-unused binding - get_type_by_name: use symbol table O(log n) lookup with linear scan fallback, instead of always O(n) - type_names: return iterator instead of allocating Vec - Remove stale dead code reference to `semantic` variable --- reflectapi-schema/src/semantic.rs | 18 +++++++++++++----- reflectapi/src/codegen/python.rs | 21 ++------------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/reflectapi-schema/src/semantic.rs b/reflectapi-schema/src/semantic.rs index 5eaed3c3..0adccaaa 100644 --- a/reflectapi-schema/src/semantic.rs +++ b/reflectapi-schema/src/semantic.rs @@ -310,9 +310,17 @@ impl Default for SymbolTable { } impl SemanticSchema { - /// Look up a type by its name. This provides a bridge for codegen backends - /// transitioning from string-based `Schema::get_type()` to SymbolId-based lookups. + /// Look up a type by its name via the symbol table's resolution cache. + /// Falls back to linear scan if the name isn't in the symbol table. pub fn get_type_by_name(&self, name: &str) -> Option<&SemanticType> { + // Try symbol table lookup first (O(log n)) + let path = name.split("::").map(|s| s.to_string()).collect::>(); + if let Some(info) = self.symbol_table.get_by_path(&path) { + if let Some(ty) = self.types.get(&info.id) { + return Some(ty); + } + } + // Fallback: linear scan by name (handles post-normalization name changes) self.types.values().find(|t| t.name() == name) } @@ -331,9 +339,9 @@ impl SemanticSchema { self.functions.values() } - /// Get an ordered list of type names (for backward compat with codegen iteration). - pub fn type_names(&self) -> Vec { - self.types.values().map(|t| t.name().to_string()).collect() + /// Ordered type names (deterministic via BTreeMap). + pub fn type_names(&self) -> impl Iterator { + self.types.values().map(|t| t.name()) } } diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 55a532d7..568898c3 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1101,22 +1101,9 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Build the semantic IR for type-safe lookups and deterministic ordering. // The Normalizer runs ensure_symbol_ids + NormalizationPipeline internally, // producing a fully-resolved SemanticSchema. - let semantic = reflectapi_schema::Normalizer::new() + let _semantic = reflectapi_schema::Normalizer::new() .normalize(schema.clone()) - .unwrap_or_else(|errors| { - // Normalization is best-effort for now — fall back gracefully - // if the schema has issues the normalizer can't handle yet. - for error in &errors { - eprintln!("Warning: normalization error: {error}"); - } - // Re-run with a fresh schema to get at least a partial result - let mut fallback = schema.clone(); - reflectapi_schema::ensure_symbol_ids(&mut fallback); - // Build a minimal SemanticSchema manually - reflectapi_schema::Normalizer::new() - .normalize(fallback) - .expect("fallback normalization should not fail") - }); + .ok(); let mut generated_code = Vec::new(); @@ -1236,10 +1223,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { sorted.sort(); sorted }); - // The SemanticSchema is available as `semantic` for type-safe lookups - // in render functions (e.g., flatten resolution). The raw Schema is still - // used for the main iteration loop since type names match pre-normalization. - let _ = &semantic; // suppress unused warning; used by render functions for original_type_name in &sorted_type_names { if runtime_provided_types.contains(&original_type_name.as_str()) { continue; From 6e8abec670904b0d1c85e784587bc92395c521e8 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 18:22:21 +1300 Subject: [PATCH 24/47] refactor: remove redundant consolidate_types call, improve comments --- reflectapi/src/codegen/python.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 568898c3..81f80f90 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1092,15 +1092,17 @@ __all__ = {} pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let implemented_types = build_implemented_types(); - // Consolidate types to avoid duplicates - schema.consolidate_types(); + // Consolidate types (merge input/output typespaces, deduplicate) + let all_type_names = schema.consolidate_types(); // Validate all type references exist validate_type_references(&schema)?; - // Build the semantic IR for type-safe lookups and deterministic ordering. - // The Normalizer runs ensure_symbol_ids + NormalizationPipeline internally, - // producing a fully-resolved SemanticSchema. + // Build the semantic IR. The Normalizer runs ensure_symbol_ids + + // NormalizationPipeline internally. The SemanticSchema is available + // for render functions that need type-safe SymbolId-based lookups; + // the raw Schema is still used for the main iteration loop since + // the Normalizer's NamingResolutionStage transforms type names. let _semantic = reflectapi_schema::Normalizer::new() .normalize(schema.clone()) .ok(); @@ -1112,9 +1114,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { package_name: config.package_name.clone(), }; generated_code.push(file_header.render()); - - // Check if we have enums in the schema - let all_type_names = schema.consolidate_types(); let has_enums = all_type_names.iter().any(|name| { if let Some(type_def) = schema.get_type(name) { matches!(type_def, reflectapi_schema::Type::Enum(_)) From 1485707aa1156f970f450c4e67c90fee9f5a3878 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 18:40:16 +1300 Subject: [PATCH 25/47] fix: Python codegen correctness + Normalizer &Schema + original_name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python codegen fixes: - Underscore-prefixed fields no longer treated as Pydantic private attributes. sanitize_field_name strips leading underscores and generates Field(alias="_original") for wire compatibility. - exclude_none=True removed from enum serializers — was dropping intentional None values. Plain model_dump() matches serde behavior. - Factory method parameters now include type annotations (e.g., `def circle(radius: float)` instead of `def circle(radius)`). - sanitize_field_name_with_alias now takes serde_name for proper alias generation on renamed fields. Normalizer refactor: - normalize() takes &Schema instead of Schema by value, eliminating the clone at the call site (clones internally for pipeline mutation) - build_semantic_ir receives pre-pipeline original_names map - SemanticPrimitive/Struct/Enum gain original_name field preserving pre-normalization qualified names - SemanticSchema::get_type_by_name falls back to original_name search ~88 snapshots updated with type-annotated factory params, wire-name aliases on renamed fields, and model_dump() without exclude_none. --- reflectapi-demo/clients/python/generated.py | 22 ++- ...tests__basic__reflectapi_deprecated-5.snap | 6 +- ...__basic__reflectapi_enum_documented-4.snap | 6 +- ...i_struct_one_basic_field_static_str-4.snap | 2 +- ...ctapi_struct_one_basic_field_string-4.snap | 2 +- ..._basic_field_string_reflectapi_both-5.snap | 2 +- ...ield_string_reflectapi_both_equally-5.snap | 2 +- ...eld_string_reflectapi_both_equally2-4.snap | 2 +- ...ing_reflectapi_both_with_attributes-5.snap | 4 +- ...flectapi_struct_one_basic_field_u32-4.snap | 2 +- ...ts__basic__reflectapi_struct_option-5.snap | 2 +- ...sts__basic__reflectapi_struct_tuple-5.snap | 14 +- ...ruct_with_all_primitive_type_fields-5.snap | 132 ++++++++----- ...__basic__reflectapi_struct_with_arc-5.snap | 2 +- ...ectapi_struct_with_arc_pointer_only-5.snap | 4 +- ...i_struct_with_attributes_input_only-5.snap | 2 +- ..._struct_with_attributes_output_only-5.snap | 2 +- ...ectapi_struct_with_fixed_size_array-5.snap | 2 +- ...sic__reflectapi_struct_with_hashmap-5.snap | 2 +- ...eflectapi_struct_with_hashset_field-5.snap | 4 +- ...i_struct_with_hashset_field_generic-5.snap | 4 +- ...asic__reflectapi_struct_with_nested-5.snap | 6 +- ...lectapi_struct_with_nested_external-5.snap | 6 +- ...reflectapi_struct_with_self_via_arc-5.snap | 4 +- ...ectapi_struct_with_skip_field_input-5.snap | 2 +- ...ctapi_struct_with_skip_field_output-5.snap | 2 +- ...lectapi_struct_with_transform_array-5.snap | 2 +- ...flectapi_struct_with_transform_both-5.snap | 2 +- ...tapi_struct_with_transform_fallback-5.snap | 2 +- ...ruct_with_transform_fallback_nested-5.snap | 2 +- ...lectapi_struct_with_transform_input-5.snap | 4 +- ...ectapi_struct_with_transform_output-5.snap | 4 +- ...basic__reflectapi_struct_with_tuple-5.snap | 2 +- ...sic__reflectapi_struct_with_tuple12-5.snap | 4 +- ...__basic__reflectapi_struct_with_vec-5.snap | 2 +- ...reflectapi_struct_with_vec_external-5.snap | 6 +- ...__reflectapi_struct_with_vec_nested-5.snap | 6 +- ...sic__reflectapi_struct_with_vec_two-5.snap | 4 +- ...variant_and_fields_and_named_fields-4.snap | 6 +- ..._enum_with_empty_variant_and_fields-4.snap | 4 +- ...emo__tests__enums__enum_with_fields-4.snap | 6 +- ...o__tests__enums__enum_with_generics-4.snap | 6 +- ...nums__enum_with_generics_and_fields-4.snap | 6 +- ...enerics_and_fields_and_named_fields-4.snap | 8 +- ...lly_tagged_enum_with_tuple_variants-5.snap | 2 +- ...ally_tagged_enum_with_unit_variants-5.snap | 2 +- ...ics__struct_with_circular_reference-4.snap | 4 +- ...uct_with_circular_reference_generic-4.snap | 6 +- ...h_circular_reference_generic_parent-4.snap | 14 +- ...cular_reference_generic_without_box-4.snap | 6 +- ...eference_generic_without_box_parent-4.snap | 10 +- ...generic_without_box_parent_specific-4.snap | 8 +- ...__struct_with_nested_generic_struct-4.snap | 6 +- ...ct_with_nested_generic_struct_twice-4.snap | 10 +- ...enerics__struct_with_simple_generic-4.snap | 2 +- ...__generics__struct_with_vec_generic-4.snap | 2 +- ...cs__struct_with_vec_generic_generic-4.snap | 6 +- ...ct_with_vec_generic_generic_generic-4.snap | 6 +- ...adj_repr_enum_with_untagged_variant-5.snap | 4 +- ...e__empty_variants_adjacently_tagged-5.snap | 2 +- ...e__empty_variants_externally_tagged-5.snap | 2 +- ...__serde__enum_rename_all_on_variant-5.snap | 10 +- ...s__serde__enum_rename_variant_field-5.snap | 4 +- ...ectapi_demo__tests__serde__enum_tag-5.snap | 4 +- ...emo__tests__serde__enum_tag_content-5.snap | 9 +- ..._serde__enum_tag_content_rename_all-5.snap | 11 +- ..._tests__serde__enum_with_field_skip-5.snap | 2 +- ...__enum_with_rename_to_invalid_chars-5.snap | 6 +- ...__serde__enum_with_variant_untagged-5.snap | 2 +- ...latten_adjacently_tagged_enum_field-5.snap | 8 +- ...latten_externally_tagged_enum_field-5.snap | 8 +- ...s__serde__flatten_internally_tagged-5.snap | 6 +- ...latten_internally_tagged_enum_field-5.snap | 4 +- ...tapi_demo__tests__serde__kebab_case-5.snap | 4 +- ...rde__nested_internally_tagged_enums-5.snap | 12 +- ...ted_internally_tagged_enums_minimal-5.snap | 4 +- ..._newtype_variants_adjacently_tagged-5.snap | 12 +- ..._newtype_variants_externally_tagged-5.snap | 12 +- ..._newtype_variants_internally_tagged-5.snap | 4 +- ...mo__tests__serde__struct_rename_all-5.snap | 4 +- ...erde__struct_rename_all_differently-5.snap | 4 +- ...erde__struct_rename_all_pascal_case-5.snap | 4 +- ...__tests__serde__struct_rename_field-5.snap | 4 +- ..._with_flatten_optional_and_required-5.snap | 8 +- ...struct_with_rename_to_invalid_chars-5.snap | 2 +- ...e__struct_with_rename_to_kebab_case-5.snap | 4 +- ...e__struct_with_serde_skip_serialize-5.snap | 2 +- reflectapi-schema/src/normalize.rs | 101 +++++++--- reflectapi-schema/src/semantic.rs | 18 +- reflectapi/src/codegen/python.rs | 176 ++++++++++++++---- 90 files changed, 574 insertions(+), 283 deletions(-) diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index da86409e..51b78fd8 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -115,7 +115,7 @@ def _serialize_externally_tagged(self): if isinstance(self.root, MyapiModelBehaviorAggressiveVariant): return {"Aggressive": [self.root.field_0, self.root.field_1]} if isinstance(self.root, MyapiModelBehaviorOtherVariant): - return {"Other": self.root.model_dump(exclude_none=True)} + return {"Other": self.root.model_dump()} raise ValueError( f"Cannot serialize MyapiModelBehavior variant: {type(self.root)}" @@ -187,7 +187,7 @@ def _serialize_externally_tagged(self): if self.root == "NotAuthorized": return "NotAuthorized" if isinstance(self.root, MyapiProtoPetsCreateErrorInvalidIdentityVariant): - return {"InvalidIdentity": self.root.model_dump(exclude_none=True)} + return {"InvalidIdentity": self.root.model_dump()} raise ValueError( f"Cannot serialize MyapiProtoPetsCreateError variant: {type(self.root)}" @@ -896,14 +896,14 @@ def calm() -> MyapiModelBehavior: return MyapiModelBehavior("Calm") @staticmethod - def aggressive(field_0, field_1) -> MyapiModelBehavior: + def aggressive(field_0: float, field_1: str) -> MyapiModelBehavior: """Creates the 'Aggressive' variant of the MyapiModelBehavior enum.""" return MyapiModelBehavior( MyapiModelBehaviorAggressiveVariant(field_0=field_0, field_1=field_1) ) @staticmethod - def other(description, notes=None) -> MyapiModelBehavior: + def other(description: str, notes: str | None = None) -> MyapiModelBehavior: """Creates the 'Other' variant of the MyapiModelBehavior enum.""" return MyapiModelBehavior( MyapiModelBehaviorOtherVariant(description=description, notes=notes) @@ -927,7 +927,7 @@ def not_authorized() -> MyapiProtoPetsCreateError: return MyapiProtoPetsCreateError("NotAuthorized") @staticmethod - def invalid_identity(message) -> MyapiProtoPetsCreateError: + def invalid_identity(message: str) -> MyapiProtoPetsCreateError: """Creates the 'InvalidIdentity' variant of the MyapiProtoPetsCreateError enum.""" return MyapiProtoPetsCreateError( MyapiProtoPetsCreateErrorInvalidIdentityVariant(message=message) @@ -943,12 +943,12 @@ class MyapiModelKindFactory: BIRD = MyapiModelKindBird() @staticmethod - def dog(breed) -> MyapiModelKindDog: + def dog(breed: str) -> MyapiModelKindDog: """Creates the 'dog' variant of the MyapiModelKind enum.""" return MyapiModelKindDog(breed=breed) @staticmethod - def cat(lives) -> MyapiModelKindCat: + def cat(lives: int) -> MyapiModelKindCat: """Creates the 'cat' variant of the MyapiModelKind enum.""" return MyapiModelKindCat(lives=lives) @@ -963,7 +963,7 @@ class MyapiProtoPetsListErrorFactory: UNAUTHORIZED = MyapiProtoPetsListErrorUnauthorized() @staticmethod - def internal(field_0) -> MyapiProtoPetsListErrorInternal: + def internal(field_0: MyapiProtoInternalError) -> MyapiProtoPetsListErrorInternal: """Creates the 'Internal' variant of the MyapiProtoPetsListError enum.""" return MyapiProtoPetsListErrorInternal(field_0=field_0) @@ -975,7 +975,7 @@ class MyapiProtoValidationErrorFactory: """ @staticmethod - def validation_a(field_0) -> MyapiProtoValidationError: + def validation_a(field_0: MyapiProtoValidationA) -> MyapiProtoValidationError: """Creates the 'ValidationA' variant of the MyapiProtoValidationError enum.""" return MyapiProtoValidationError( MyapiProtoValidationErrorValidationAVariant(field_0=field_0) @@ -999,7 +999,9 @@ def not_authorized() -> MyapiProtoPetsUpdateError: return MyapiProtoPetsUpdateError("NotAuthorized") @staticmethod - def validation(field_0) -> MyapiProtoPetsUpdateError: + def validation( + field_0: list[MyapiProtoValidationError], + ) -> MyapiProtoPetsUpdateError: """Creates the 'Validation' variant of the MyapiProtoPetsUpdateError enum.""" return MyapiProtoPetsUpdateError( MyapiProtoPetsUpdateErrorValidationVariant(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap index 214e368f..0b644ae4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap @@ -30,9 +30,9 @@ class ReflectapiDemoTestsBasicStructWithDeprecatedField(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int - _g: int - _h: int + f: int = Field(serialization_alias="_f", validation_alias="_f") + g: int = Field(serialization_alias="_g", validation_alias="_g") + h: int = Field(serialization_alias="_h", validation_alias="_h") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap index 230f5680..e139a64a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap @@ -113,7 +113,7 @@ class ReflectapiDemoTestsBasicTestEnumDocumented( if isinstance( self.root, ReflectapiDemoTestsBasicTestEnumDocumentedVariant2Variant ): - return {"Variant2": self.root.model_dump(exclude_none=True)} + return {"Variant2": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsBasicTestEnumDocumented variant: {type(self.root)}" @@ -229,7 +229,7 @@ class ReflectapiDemoTestsBasicTestEnumDocumentedFactory: """ @staticmethod - def variant1(field_0) -> ReflectapiDemoTestsBasicTestEnumDocumented[T]: + def variant1(field_0: T) -> ReflectapiDemoTestsBasicTestEnumDocumented[T]: """Creates the 'Variant1' variant of the ReflectapiDemoTestsBasicTestEnumDocumented enum.""" return ReflectapiDemoTestsBasicTestEnumDocumented( ReflectapiDemoTestsBasicTestEnumDocumentedVariant1Variant[T]( @@ -238,7 +238,7 @@ class ReflectapiDemoTestsBasicTestEnumDocumentedFactory: ) @staticmethod - def variant2(named_field) -> ReflectapiDemoTestsBasicTestEnumDocumented[T]: + def variant2(named_field: T) -> ReflectapiDemoTestsBasicTestEnumDocumented[T]: """Creates the 'Variant2' variant of the ReflectapiDemoTestsBasicTestEnumDocumented enum.""" return ReflectapiDemoTestsBasicTestEnumDocumented( ReflectapiDemoTestsBasicTestEnumDocumentedVariant2Variant[T]( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap index 41d61f17..4dc4723d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class AsyncOutputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap index b980a99c..e3f12ea8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldString(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap index 8d72f071..9c776eab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth(BaseModel model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap index e09381c6..9083d6c7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap @@ -32,7 +32,7 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap index d669e946..c707126d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap @@ -32,7 +32,7 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap index 4a74e894..2e448b75 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap @@ -32,7 +32,7 @@ class ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDiffe model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently( @@ -42,7 +42,7 @@ class ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDiff model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap index ab862dfe..ceacd550 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldU32(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap index 298156ed..5d6cc2c7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsBasicTestStructOption(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int | None = None + f: int | None = Field(default=None, serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap index 4e2d7091..335bc671 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructTuple > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -30,8 +30,8 @@ class ReflectapiDemoTestsBasicTestStructTuple(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _0: int = Field(serialization_alias="0", validation_alias="0") - _1: str = Field(serialization_alias="1", validation_alias="1") + 0: int + 1: str class AsyncInoutClient: @@ -74,6 +74,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -117,6 +118,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -138,9 +140,7 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructtuple_response( - value: ReflectapiDemoTestsBasicTestStructTuple, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructTuple]: +def create_reflectapidemotestsbasicteststructtuple_response(value: ReflectapiDemoTestsBasicTestStructTuple) -> ApiResponse[ReflectapiDemoTestsBasicTestStructTuple]: """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructTuple.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap index 8a879d1e..84b4a475 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap @@ -31,51 +31,95 @@ class ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f_u8: int - _f_u16: int - _f_u32: int - _f_u64: int - _f_u128: U128 - _f_usize: int - _f_i8: int - _f_i16: int - _f_i32: int - _f_i64: int - _f_i128: I128 - _f_isize: int - _f_f32: float - _f_f64: float - _f_bool: bool - _f_char: Char - _f_str: str - _f_unit: None - _f_option: int | None = None - _f_vec: bytes - _f_hashmap: dict[int, str] - _f_hashset: bytes - _f_tuple: StdTupleTuple2[int, str] - _f_tuple3: StdTupleTuple3[int, str, int] - _f_tuple4: StdTupleTuple4[int, str, int, str] - _f_tuple5: StdTupleTuple5[int, str, int, str, int] - _f_tuple6: StdTupleTuple6[int, str, int, str, int, str] - _f_tuple7: StdTupleTuple7[int, str, int, str, int, str, int] - _f_tuple8: StdTupleTuple8[int, str, int, str, int, str, int, str] - _f_tuple9: StdTupleTuple9[int, str, int, str, int, str, int, str, int] - _f_tuple10: StdTupleTuple10[int, str, int, str, int, str, int, str, int, str] - _f_tuple11: StdTupleTuple11[int, str, int, str, int, str, int, str, int, str, int] - _f_tuple12: StdTupleTuple12[ + f_u8: int = Field(serialization_alias="_f_u8", validation_alias="_f_u8") + f_u16: int = Field(serialization_alias="_f_u16", validation_alias="_f_u16") + f_u32: int = Field(serialization_alias="_f_u32", validation_alias="_f_u32") + f_u64: int = Field(serialization_alias="_f_u64", validation_alias="_f_u64") + f_u128: U128 = Field(serialization_alias="_f_u128", validation_alias="_f_u128") + f_usize: int = Field(serialization_alias="_f_usize", validation_alias="_f_usize") + f_i8: int = Field(serialization_alias="_f_i8", validation_alias="_f_i8") + f_i16: int = Field(serialization_alias="_f_i16", validation_alias="_f_i16") + f_i32: int = Field(serialization_alias="_f_i32", validation_alias="_f_i32") + f_i64: int = Field(serialization_alias="_f_i64", validation_alias="_f_i64") + f_i128: I128 = Field(serialization_alias="_f_i128", validation_alias="_f_i128") + f_isize: int = Field(serialization_alias="_f_isize", validation_alias="_f_isize") + f_f32: float = Field(serialization_alias="_f_f32", validation_alias="_f_f32") + f_f64: float = Field(serialization_alias="_f_f64", validation_alias="_f_f64") + f_bool: bool = Field(serialization_alias="_f_bool", validation_alias="_f_bool") + f_char: Char = Field(serialization_alias="_f_char", validation_alias="_f_char") + f_str: str = Field(serialization_alias="_f_str", validation_alias="_f_str") + f_unit: None = Field(serialization_alias="_f_unit", validation_alias="_f_unit") + f_option: int | None = Field( + default=None, serialization_alias="_f_option", validation_alias="_f_option" + ) + f_vec: bytes = Field(serialization_alias="_f_vec", validation_alias="_f_vec") + f_hashmap: dict[int, str] = Field( + serialization_alias="_f_hashmap", validation_alias="_f_hashmap" + ) + f_hashset: bytes = Field( + serialization_alias="_f_hashset", validation_alias="_f_hashset" + ) + f_tuple: StdTupleTuple2[int, str] = Field( + serialization_alias="_f_tuple", validation_alias="_f_tuple" + ) + f_tuple3: StdTupleTuple3[int, str, int] = Field( + serialization_alias="_f_tuple3", validation_alias="_f_tuple3" + ) + f_tuple4: StdTupleTuple4[int, str, int, str] = Field( + serialization_alias="_f_tuple4", validation_alias="_f_tuple4" + ) + f_tuple5: StdTupleTuple5[int, str, int, str, int] = Field( + serialization_alias="_f_tuple5", validation_alias="_f_tuple5" + ) + f_tuple6: StdTupleTuple6[int, str, int, str, int, str] = Field( + serialization_alias="_f_tuple6", validation_alias="_f_tuple6" + ) + f_tuple7: StdTupleTuple7[int, str, int, str, int, str, int] = Field( + serialization_alias="_f_tuple7", validation_alias="_f_tuple7" + ) + f_tuple8: StdTupleTuple8[int, str, int, str, int, str, int, str] = Field( + serialization_alias="_f_tuple8", validation_alias="_f_tuple8" + ) + f_tuple9: StdTupleTuple9[int, str, int, str, int, str, int, str, int] = Field( + serialization_alias="_f_tuple9", validation_alias="_f_tuple9" + ) + f_tuple10: StdTupleTuple10[int, str, int, str, int, str, int, str, int, str] = ( + Field(serialization_alias="_f_tuple10", validation_alias="_f_tuple10") + ) + f_tuple11: StdTupleTuple11[ + int, str, int, str, int, str, int, str, int, str, int + ] = Field(serialization_alias="_f_tuple11", validation_alias="_f_tuple11") + f_tuple12: StdTupleTuple12[ int, str, int, str, int, str, int, str, int, str, int, str - ] - _f_array: bytes - _f_pointer_box: int - _f_pointer_arc: int - _f_pointer_cell: int - _f_pointer_refcell: int - _f_pointer_mutex: int - _f_pointer_rwlock: int - _f_pointer_weak: int - _f_phantomdata: StdMarkerPhantomData[int] - _f_infallible: ReflectapiInfallible + ] = Field(serialization_alias="_f_tuple12", validation_alias="_f_tuple12") + f_array: bytes = Field(serialization_alias="_f_array", validation_alias="_f_array") + f_pointer_box: int = Field( + serialization_alias="_f_pointer_box", validation_alias="_f_pointer_box" + ) + f_pointer_arc: int = Field( + serialization_alias="_f_pointer_arc", validation_alias="_f_pointer_arc" + ) + f_pointer_cell: int = Field( + serialization_alias="_f_pointer_cell", validation_alias="_f_pointer_cell" + ) + f_pointer_refcell: int = Field( + serialization_alias="_f_pointer_refcell", validation_alias="_f_pointer_refcell" + ) + f_pointer_mutex: int = Field( + serialization_alias="_f_pointer_mutex", validation_alias="_f_pointer_mutex" + ) + f_pointer_rwlock: int = Field( + serialization_alias="_f_pointer_rwlock", validation_alias="_f_pointer_rwlock" + ) + f_pointer_weak: int = Field( + serialization_alias="_f_pointer_weak", validation_alias="_f_pointer_weak" + ) + f_phantomdata: StdMarkerPhantomData[int] = Field( + serialization_alias="_f_phantomdata", validation_alias="_f_phantomdata" + ) + f_infallible: ReflectapiInfallible = Field( + serialization_alias="_f_infallible", validation_alias="_f_infallible" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap index 5d810ccd..26585d35 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithArc(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap index b2acfb36..216fd73c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsBasicTestStructWithArcPointerOnly(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f_pointer_arc: int + f_pointer_arc: int = Field( + serialization_alias="_f_pointer_arc", validation_alias="_f_pointer_arc" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap index 2b83eb2d..1a6b8429 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap index 323374fb..163576ae 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap index 6327fe7c..9c3cc1be 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithFixedSizeArray(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: bytes + f: bytes = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap index 826d0f08..3ec4638f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithHashMap(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: dict[int, str] + f: dict[int, str] = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap index 82cf0a2c..4ab1aa0d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsBasicTestStructWithHashSetField(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f_hashset: bytes + f_hashset: bytes = Field( + serialization_alias="_f_hashset", validation_alias="_f_hashset" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap index b257b831..6c15280d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap @@ -36,7 +36,9 @@ class ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric(BaseModel, Gener model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f_hashset: list[G] + f_hashset: list[G] = Field( + serialization_alias="_f_hashset", validation_alias="_f_hashset" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap index 37b32b73..8494e79f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsBasicTestStructWithNested(BaseModel): @@ -38,7 +38,9 @@ class ReflectapiDemoTestsBasicTestStructWithNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsBasicTestStructNested + f: ReflectapiDemoTestsBasicTestStructNested = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap index dd419c7e..7fb841a2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsBasicTestStructWithNestedExternal(BaseModel): @@ -38,7 +38,9 @@ class ReflectapiDemoTestsBasicTestStructWithNestedExternal(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsTestLibTestStructNested + f: ReflectapiDemoTestsTestLibTestStructNested = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap index 74ecad73..0da1cef3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsBasicTestStructWithSelfViaArc(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsBasicTestStructWithSelfViaArc + f: ReflectapiDemoTestsBasicTestStructWithSelfViaArc = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap index 315c83dd..8aacadc3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap index e92b55f7..89907177 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap index 9647185a..943380af 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithTransformArray(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: bytes + f: bytes = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap index 8712f778..b4497e0c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithTransformBoth(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap index 5fa1279c..2cf400f9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithTransformFallback(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap index 7a216424..3fc75ec2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap index 54f0f6ed..292ff821 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicInputTestStructWithTransformInput(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsBasicOutputTestStructWithTransformInput(BaseModel): @@ -38,7 +38,7 @@ class ReflectapiDemoTestsBasicOutputTestStructWithTransformInput(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap index 5e624b3e..8010b727 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicInputTestStructWithTransformOutput(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput(BaseModel): @@ -38,7 +38,7 @@ class ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap index 471dbc23..55e07271 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithTuple(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: StdTupleTuple2[int, str] + f: StdTupleTuple2[int, str] = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap index d6868e1a..0df7793d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsBasicTestStructWithTuple12(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: StdTupleTuple12[int, str, int, str, int, str, int, str, int, str, int, str] + f: StdTupleTuple12[int, str, int, str, int, str, int, str, int, str, int, str] = ( + Field(serialization_alias="_f", validation_alias="_f") + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap index 49b84db6..ef7ad6fa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsBasicTestStructWithVec(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: bytes + f: bytes = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap index 70e9a7a8..f1002968 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsBasicTestStructWithVecExternal(BaseModel): @@ -38,7 +38,9 @@ class ReflectapiDemoTestsBasicTestStructWithVecExternal(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: list[ReflectapiDemoTestsTestLibTestStructNested] + f: list[ReflectapiDemoTestsTestLibTestStructNested] = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap index 10c0e103..9710ea03 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: str + f: str = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsBasicTestStructWithVecNested(BaseModel): @@ -38,7 +38,9 @@ class ReflectapiDemoTestsBasicTestStructWithVecNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: list[list[ReflectapiDemoTestsTestLibTestStructNested]] + f: list[list[ReflectapiDemoTestsTestLibTestStructNested]] = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap index 73e3bf8f..d5c9e22d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap @@ -30,8 +30,8 @@ class ReflectapiDemoTestsBasicTestStructWithVecTwo(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: bytes - _f2: list[int] + f: bytes = Field(serialization_alias="_f", validation_alias="_f") + f2: list[int] = Field(serialization_alias="_f2", validation_alias="_f2") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap index 108ec656..154f10f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap @@ -123,7 +123,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields( self.root, ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant, ): - return {"Variant2": self.root.model_dump(exclude_none=True)} + return {"Variant2": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields variant: {type(self.root)}" @@ -252,7 +252,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsFac @staticmethod def variant1( - field_0, field_1 + field_0: int, field_1: str ) -> ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields: """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields( @@ -263,7 +263,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsFac @staticmethod def variant2( - field1, field2 + field1: int, field2: str ) -> ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields: """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap index b11f6919..7426bfc8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap @@ -215,7 +215,9 @@ class ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsFactory: return ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields("Variant1") @staticmethod - def variant2(field_0) -> ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields: + def variant2( + field_0: int, + ) -> ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields: """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields( ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsVariant2Variant( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap index 38ea266a..69281c91 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap @@ -218,14 +218,16 @@ class ReflectapiDemoTestsEnumsTestEnumWithFieldsFactory: """ @staticmethod - def variant1(field_0) -> ReflectapiDemoTestsEnumsTestEnumWithFields: + def variant1(field_0: int) -> ReflectapiDemoTestsEnumsTestEnumWithFields: """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithFields( ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant1Variant(field_0=field_0) ) @staticmethod - def variant2(field_0, field_1) -> ReflectapiDemoTestsEnumsTestEnumWithFields: + def variant2( + field_0: str, field_1: float + ) -> ReflectapiDemoTestsEnumsTestEnumWithFields: """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithFields( ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant2Variant( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap index a083ae1f..38c6ac6f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap @@ -239,7 +239,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsFactory: """ @staticmethod - def variant1(field_0) -> ReflectapiDemoTestsEnumsTestEnumWithGenerics[T]: + def variant1(field_0: T) -> ReflectapiDemoTestsEnumsTestEnumWithGenerics[T]: """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenerics enum.""" return ReflectapiDemoTestsEnumsTestEnumWithGenerics( ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant1Variant[T]( @@ -248,7 +248,9 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsFactory: ) @staticmethod - def variant2(field_0, field_1) -> ReflectapiDemoTestsEnumsTestEnumWithGenerics[T]: + def variant2( + field_0: T, field_1: T + ) -> ReflectapiDemoTestsEnumsTestEnumWithGenerics[T]: """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenerics enum.""" return ReflectapiDemoTestsEnumsTestEnumWithGenerics( ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant2Variant[T]( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap index 2b8d3c2e..89132ded 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap @@ -245,7 +245,9 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsFactory: """ @staticmethod - def variant1(field_0) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields[T]: + def variant1( + field_0: int, + ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields[T]: """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields( ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant1Variant[T]( @@ -255,7 +257,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsFactory: @staticmethod def variant2( - field_0, field_1 + field_0: T, field_1: T ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields[T]: """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap index 1a561a38..5d385d36 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap @@ -163,7 +163,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( self.root, ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant, ): - return {"Variant3": self.root.model_dump(exclude_none=True)} + return {"Variant3": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields variant: {type(self.root)}" @@ -283,7 +283,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsFactory @staticmethod def variant1( - field_0, + field_0: int, ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[T]: """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( @@ -294,7 +294,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsFactory @staticmethod def variant2( - field_0, field_1 + field_0: T, field_1: T ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[T]: """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( @@ -305,7 +305,7 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsFactory @staticmethod def variant3( - field1, field2 + field1: int, field2: T ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[T]: """Creates the 'Variant3' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields enum.""" return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap index 5adc1777..ea0680ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap @@ -155,7 +155,7 @@ class ReflectapiDemoTestsEnumsEFactory: """ @staticmethod - def a(field_0) -> ReflectapiDemoTestsEnumsEA: + def a(field_0: ReflectapiDemoTestsEnumsA) -> ReflectapiDemoTestsEnumsEA: """Creates the 'a' variant of the ReflectapiDemoTestsEnumsE enum.""" return ReflectapiDemoTestsEnumsEA(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap index 54b69ba7..040647ca 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap @@ -160,7 +160,7 @@ class ReflectapiDemoTestsEnumsAFactory: X = ReflectapiDemoTestsEnumsAX() @staticmethod - def y(field_0) -> ReflectapiDemoTestsEnumsAY: + def y(field_0: None) -> ReflectapiDemoTestsEnumsAY: """Creates the 'Y' variant of the ReflectapiDemoTestsEnumsA enum.""" return ReflectapiDemoTestsEnumsAY(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap index a6a70860..343f4b5e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReference(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithCircularReference + f: ReflectapiDemoTestsGenericsTestStructWithCircularReference = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap index b9e5cf4b..8c5df162 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap @@ -38,8 +38,10 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric( model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[T] - _f2: T + f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[T] = Field( + serialization_alias="_f", validation_alias="_f" + ) + f2: T = Field(serialization_alias="_f2", validation_alias="_f2") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap index 041b5066..c62e5035 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap @@ -38,8 +38,10 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric( model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[T] - _f2: T + f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[T] = Field( + serialization_alias="_f", validation_alias="_f" + ) + f2: T = Field(serialization_alias="_f2", validation_alias="_f2") class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent( @@ -49,10 +51,12 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent( model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[ + f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[ ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent[T] - ] - _f2: StdMarkerPhantomData[T] + ] = Field(serialization_alias="_f", validation_alias="_f") + f2: StdMarkerPhantomData[T] = Field( + serialization_alias="_f2", validation_alias="_f2" + ) class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap index 44b6012a..55fb90c3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap @@ -1,6 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super :: into_input_python_code :: <\nTestStructWithCircularReferenceGenericWithoutBox::<\nTestStructWithCircularReferenceGenericWithoutBox,\nTestStructWithCircularReferenceGenericWithoutBox, >\n> ()" +expression: "super :: into_input_python_code :: <\nTestStructWithCircularReferenceGenericWithoutBox::<\nTestStructWithCircularReferenceGenericWithoutBox,\nTestStructWithCircularReferenceGenericWithoutBox, > > ()" --- """ Generated Python client for api_client. @@ -40,8 +40,8 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f1: A - _f2: B + f1: A = Field(serialization_alias="_f1", validation_alias="_f1") + f2: B = Field(serialization_alias="_f2", validation_alias="_f2") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap index dac6ab13..8e0353a4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap @@ -1,6 +1,6 @@ --- source: reflectapi-demo/src/tests/generics.rs -expression: "super :: into_input_python_code :: <\nTestStructWithCircularReferenceGenericWithoutBoxParent::<\nTestStructWithCircularReferenceGenericWithoutBoxParent,\nTestStructWithCircularReferenceGenericWithoutBoxParent, >\n> ()" +expression: "super :: into_input_python_code :: <\nTestStructWithCircularReferenceGenericWithoutBoxParent::<\nTestStructWithCircularReferenceGenericWithoutBoxParent,\nTestStructWithCircularReferenceGenericWithoutBoxParent, > > ()" --- """ Generated Python client for api_client. @@ -44,8 +44,8 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f1: A - _f2: B + f1: A = Field(serialization_alias="_f1", validation_alias="_f1") + f2: B = Field(serialization_alias="_f2", validation_alias="_f2") class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent( @@ -55,9 +55,9 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ D, C - ] + ] = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap index 84fd51cd..55b3d022 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap @@ -40,8 +40,8 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f1: A - _f2: B + f1: A = Field(serialization_alias="_f1", validation_alias="_f1") + f2: B = Field(serialization_alias="_f2", validation_alias="_f2") class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific( @@ -51,14 +51,14 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ int, int ], ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ str, int ], - ] + ] = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap index 09df653f..b82a2e4c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[ model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: A + f: A = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct(BaseModel): @@ -44,9 +44,9 @@ class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[ + f: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[ ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[int] - ] + ] = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap index 9577e87f..8919dc75 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[ model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: A + f: A = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice(BaseModel): @@ -44,8 +44,12 @@ class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice(BaseMode model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[int] - _f2: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[str] + f: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[int] = Field( + serialization_alias="_f", validation_alias="_f" + ) + f2: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[str] = Field( + serialization_alias="_f2", validation_alias="_f2" + ) class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap index 3cb5dd25..de4f5c36 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[ model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: A + f: A = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap index 056e798f..cd12e767 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsGenericsTestStructWithVecGeneric(BaseModel, Generic[T]) model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: list[T] + f: list[T] = Field(serialization_alias="_f", validation_alias="_f") class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap index c0869010..7bc2b533 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap @@ -38,7 +38,7 @@ class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[ model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: A + f: A = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric(BaseModel, Generic[T]): @@ -46,7 +46,9 @@ class ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric(BaseModel, Gene model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: list[ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[T]] + f: list[ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[T]] = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap index 950d83af..76c5dbb0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsGenericsTestStructWithVecGeneric(BaseModel, Generic[T]) model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: list[T] + f: list[T] = Field(serialization_alias="_f", validation_alias="_f") class ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric( @@ -46,7 +46,9 @@ class ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric( model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: list[ReflectapiDemoTestsGenericsTestStructWithVecGeneric[T]] + f: list[ReflectapiDemoTestsGenericsTestStructWithVecGeneric[T]] = Field( + serialization_alias="_f", validation_alias="_f" + ) class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap index 6697eaae..e7155c68 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap @@ -161,12 +161,12 @@ class ReflectapiDemoTestsSerdeTestFactory: """ @staticmethod - def variant1(field_name) -> ReflectapiDemoTestsSerdeTestVariant1: + def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestVariant1: """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTest enum.""" return ReflectapiDemoTestsSerdeTestVariant1(field_name=field_name) @staticmethod - def variant2(field_0) -> ReflectapiDemoTestsSerdeTestVariant2: + def variant2(field_0: str) -> ReflectapiDemoTestsSerdeTestVariant2: """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTest enum.""" return ReflectapiDemoTestsSerdeTestVariant2(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index e533c3cf..456fcbd8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -112,7 +112,7 @@ class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged( self.root, ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant, ): - return {"t": "EmptyStruct", "c": self.root.model_dump(exclude_none=True)} + return {"t": "EmptyStruct", "c": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged variant: {type(self.root)}" ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap index 1dcc8db4..c104c4f2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap @@ -113,7 +113,7 @@ class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged( self.root, ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant, ): - return {"EmptyStruct": self.root.model_dump(exclude_none=True)} + return {"EmptyStruct": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged variant: {type(self.root)}" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap index bfc48690..8e89278e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap @@ -38,7 +38,9 @@ class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant(BaseMode model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant(BaseModel): @@ -103,7 +105,7 @@ class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( if isinstance( self.root, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant ): - return {"Variant1": self.root.model_dump(exclude_none=True)} + return {"Variant1": self.root.model_dump()} if isinstance( self.root, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant ): @@ -222,7 +224,7 @@ class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantFactory: """ @staticmethod - def variant1(field_name) -> ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: + def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant enum.""" return ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant( @@ -231,7 +233,7 @@ class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantFactory: ) @staticmethod - def variant2(field_0) -> ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: + def variant2(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant enum.""" return ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap index 5c7cc6a6..0c3d5089 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap @@ -84,7 +84,7 @@ class ReflectapiDemoTestsSerdeTestEnumRenameVariantField( if isinstance( self.root, ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant ): - return {"Variant2": self.root.model_dump(exclude_none=True)} + return {"Variant2": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumRenameVariantField variant: {type(self.root)}" @@ -200,7 +200,7 @@ class ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldFactory: @staticmethod def variant2( - variant2_field_name, + variant2_field_name: int, ) -> ReflectapiDemoTestsSerdeTestEnumRenameVariantField: """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumRenameVariantField enum.""" return ReflectapiDemoTestsSerdeTestEnumRenameVariantField( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap index ebf9d34d..baa6505c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap @@ -162,12 +162,12 @@ class ReflectapiDemoTestsSerdeTestEnumTagFactory: """ @staticmethod - def variant1(field_name) -> ReflectapiDemoTestsSerdeTestEnumTagVariant1: + def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumTagVariant1: """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumTag enum.""" return ReflectapiDemoTestsSerdeTestEnumTagVariant1(field_name=field_name) @staticmethod - def variant2(field_name) -> ReflectapiDemoTestsSerdeTestEnumTagVariant2: + def variant2(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumTagVariant2: """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumTag enum.""" return ReflectapiDemoTestsSerdeTestEnumTagVariant2(field_name=field_name) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index bd4efadd..9fd39868 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -102,10 +102,7 @@ class ReflectapiDemoTestsSerdeTestEnumTagContent( if isinstance( self.root, ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant ): - return { - "type": "Variant1", - "content": self.root.model_dump(exclude_none=True), - } + return {"type": "Variant1", "content": self.root.model_dump()} if isinstance( self.root, ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant ): @@ -223,7 +220,7 @@ class ReflectapiDemoTestsSerdeTestEnumTagContentFactory: """ @staticmethod - def variant1(field_name) -> ReflectapiDemoTestsSerdeTestEnumTagContent: + def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumTagContent: """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumTagContent enum.""" return ReflectapiDemoTestsSerdeTestEnumTagContent( ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant( @@ -232,7 +229,7 @@ class ReflectapiDemoTestsSerdeTestEnumTagContentFactory: ) @staticmethod - def variant2(field_0) -> ReflectapiDemoTestsSerdeTestEnumTagContent: + def variant2(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumTagContent: """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumTagContent enum.""" return ReflectapiDemoTestsSerdeTestEnumTagContent( ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index e79409e1..05faa3a5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -107,10 +107,7 @@ class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( self.root, ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant, ): - return { - "type": "variant1", - "content": self.root.model_dump(exclude_none=True), - } + return {"type": "variant1", "content": self.root.model_dump()} if isinstance( self.root, ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant, @@ -229,7 +226,9 @@ class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllFactory: """ @staticmethod - def variant1(field_name) -> ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: + def variant1( + field_name: int, + ) -> ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: """Creates the 'variant1' variant of the ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll enum.""" return ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant( @@ -238,7 +237,7 @@ class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllFactory: ) @staticmethod - def variant2(field_0) -> ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: + def variant2(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: """Creates the 'variant2' variant of the ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll enum.""" return ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap index 895f41f5..eb7b5e72 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap @@ -80,7 +80,7 @@ class ReflectapiDemoTestsSerdeTestEnumWithFieldSkip( if isinstance( self.root, ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant ): - return {"Variant1": self.root.model_dump(exclude_none=True)} + return {"Variant1": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithFieldSkip variant: {type(self.root)}" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index fd13a06d..9afc0e6d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant(Ba model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: int + f: int = Field(serialization_alias='field-name&&', validation_alias='field-name&&') # Externally tagged enum using RootModel @@ -63,7 +63,7 @@ class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars(RootModel[Reflect @model_serializer def _serialize_externally_tagged(self): if isinstance(self.root, ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant): - return {"Variant1": self.root.model_dump(exclude_none=True)} + return {"Variant1": self.root.model_dump()} raise ValueError(f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variant: {type(self.root)}") @@ -177,7 +177,7 @@ class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsFactory: ''' @staticmethod - def variant1(field_name&&) -> ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars: + def variant1(field_name&&: int) -> ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars: '''Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars enum.''' return ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars(ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant(f=field_name&&)) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap index 200d8e53..34370381 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap @@ -200,7 +200,7 @@ class ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedFactory: """ @staticmethod - def variant1(field_0) -> ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged: + def variant1(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged: """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged enum.""" return ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged( ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index 0c37f2d3..52e60f4e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -92,9 +92,9 @@ class ReflectapiDemoTestsSerdePayload( @model_serializer def _serialize_adjacently_tagged(self): if isinstance(self.root, ReflectapiDemoTestsSerdePayloadTextVariant): - return {"kind": "Text", "data": self.root.model_dump(exclude_none=True)} + return {"kind": "Text", "data": self.root.model_dump()} if isinstance(self.root, ReflectapiDemoTestsSerdePayloadBinaryVariant): - return {"kind": "Binary", "data": self.root.model_dump(exclude_none=True)} + return {"kind": "Binary", "data": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsSerdePayload variant: {type(self.root)}" ) @@ -218,14 +218,14 @@ class ReflectapiDemoTestsSerdePayloadFactory: """ @staticmethod - def text(body) -> ReflectapiDemoTestsSerdePayload: + def text(body: str) -> ReflectapiDemoTestsSerdePayload: """Creates the 'Text' variant of the ReflectapiDemoTestsSerdePayload enum.""" return ReflectapiDemoTestsSerdePayload( ReflectapiDemoTestsSerdePayloadTextVariant(body=body) ) @staticmethod - def binary(size) -> ReflectapiDemoTestsSerdePayload: + def binary(size: int) -> ReflectapiDemoTestsSerdePayload: """Creates the 'Binary' variant of the ReflectapiDemoTestsSerdePayload enum.""" return ReflectapiDemoTestsSerdePayload( ReflectapiDemoTestsSerdePayloadBinaryVariant(size=size) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap index 3248521a..7b29988d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -85,9 +85,9 @@ class ReflectapiDemoTestsSerdeShape(RootModel[ReflectapiDemoTestsSerdeShapeVaria @model_serializer def _serialize_externally_tagged(self): if isinstance(self.root, ReflectapiDemoTestsSerdeShapeCircleVariant): - return {"Circle": self.root.model_dump(exclude_none=True)} + return {"Circle": self.root.model_dump()} if isinstance(self.root, ReflectapiDemoTestsSerdeShapeRectVariant): - return {"Rect": self.root.model_dump(exclude_none=True)} + return {"Rect": self.root.model_dump()} raise ValueError( f"Cannot serialize ReflectapiDemoTestsSerdeShape variant: {type(self.root)}" @@ -212,14 +212,14 @@ class ReflectapiDemoTestsSerdeShapeFactory: """ @staticmethod - def circle(radius) -> ReflectapiDemoTestsSerdeShape: + def circle(radius: float) -> ReflectapiDemoTestsSerdeShape: """Creates the 'Circle' variant of the ReflectapiDemoTestsSerdeShape enum.""" return ReflectapiDemoTestsSerdeShape( ReflectapiDemoTestsSerdeShapeCircleVariant(radius=radius) ) @staticmethod - def rect(width, height) -> ReflectapiDemoTestsSerdeShape: + def rect(width: float, height: float) -> ReflectapiDemoTestsSerdeShape: """Creates the 'Rect' variant of the ReflectapiDemoTestsSerdeShape enum.""" return ReflectapiDemoTestsSerdeShape( ReflectapiDemoTestsSerdeShapeRectVariant(width=width, height=height) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap index 5de18095..d01eeeb5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap @@ -181,7 +181,11 @@ class ReflectapiDemoTestsSerdeTestFactory: """ @staticmethod - def s(field_0) -> ReflectapiDemoTestsSerdeTestS: + def s( + field_0: ReflectapiDemoTestsSerdeS[ + ReflectapiDemoTestsSerdeA, ReflectapiDemoTestsSerdeB + ], + ) -> ReflectapiDemoTestsSerdeTestS: """Creates the 'S' variant of the ReflectapiDemoTestsSerdeTest enum.""" return ReflectapiDemoTestsSerdeTestS(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index 729559db..fa06ce2b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -204,12 +204,12 @@ class ReflectapiDemoTestsSerdeOfferKindFactory: """ @staticmethod - def single(business) -> ReflectapiDemoTestsSerdeOfferKindSingle: + def single(business: str) -> ReflectapiDemoTestsSerdeOfferKindSingle: """Creates the 'Single' variant of the ReflectapiDemoTestsSerdeOfferKind enum.""" return ReflectapiDemoTestsSerdeOfferKindSingle(business=business) @staticmethod - def group(count) -> ReflectapiDemoTestsSerdeOfferKindGroup: + def group(count: int) -> ReflectapiDemoTestsSerdeOfferKindGroup: """Creates the 'Group' variant of the ReflectapiDemoTestsSerdeOfferKind enum.""" return ReflectapiDemoTestsSerdeOfferKindGroup(count=count) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap index 1fa93697..41943dfb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsSerdeTest(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="field-name", validation_alias="field-name" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap index 2cb88f80..158c65f4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap @@ -211,12 +211,12 @@ class ReflectapiDemoTestsSerdeV2Factory: """ @staticmethod - def c(c) -> ReflectapiDemoTestsSerdeV2C: + def c(c: int) -> ReflectapiDemoTestsSerdeV2C: """Creates the 'C' variant of the ReflectapiDemoTestsSerdeV2 enum.""" return ReflectapiDemoTestsSerdeV2C(c=c) @staticmethod - def d(d) -> ReflectapiDemoTestsSerdeV2D: + def d(d: int) -> ReflectapiDemoTestsSerdeV2D: """Creates the 'D' variant of the ReflectapiDemoTestsSerdeV2 enum.""" return ReflectapiDemoTestsSerdeV2D(d=d) @@ -228,12 +228,12 @@ class ReflectapiDemoTestsSerdeV1Factory: """ @staticmethod - def a(a) -> ReflectapiDemoTestsSerdeV1A: + def a(a: int) -> ReflectapiDemoTestsSerdeV1A: """Creates the 'A' variant of the ReflectapiDemoTestsSerdeV1 enum.""" return ReflectapiDemoTestsSerdeV1A(a=a) @staticmethod - def b(b) -> ReflectapiDemoTestsSerdeV1B: + def b(b: int) -> ReflectapiDemoTestsSerdeV1B: """Creates the 'B' variant of the ReflectapiDemoTestsSerdeV1 enum.""" return ReflectapiDemoTestsSerdeV1B(b=b) @@ -245,12 +245,12 @@ class ReflectapiDemoTestsSerdeTestFactory: """ @staticmethod - def v1(field_0) -> ReflectapiDemoTestsSerdeTestV1: + def v1(field_0: ReflectapiDemoTestsSerdeV1) -> ReflectapiDemoTestsSerdeTestV1: """Creates the 'v1' variant of the ReflectapiDemoTestsSerdeTest enum.""" return ReflectapiDemoTestsSerdeTestV1(field_0=field_0) @staticmethod - def v2(field_0) -> ReflectapiDemoTestsSerdeTestV2: + def v2(field_0: ReflectapiDemoTestsSerdeV2) -> ReflectapiDemoTestsSerdeTestV2: """Creates the 'v2' variant of the ReflectapiDemoTestsSerdeTest enum.""" return ReflectapiDemoTestsSerdeTestV2(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap index 9240d30e..f954a2b3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap @@ -163,7 +163,7 @@ class ReflectapiDemoTestsSerdeV1Factory: """ @staticmethod - def a(a) -> ReflectapiDemoTestsSerdeV1A: + def a(a: int) -> ReflectapiDemoTestsSerdeV1A: """Creates the 'A' variant of the ReflectapiDemoTestsSerdeV1 enum.""" return ReflectapiDemoTestsSerdeV1A(a=a) @@ -175,7 +175,7 @@ class ReflectapiDemoTestsSerdeTestFactory: """ @staticmethod - def v1(field_0) -> ReflectapiDemoTestsSerdeTestV1: + def v1(field_0: ReflectapiDemoTestsSerdeV1) -> ReflectapiDemoTestsSerdeTestV1: """Creates the 'v1' variant of the ReflectapiDemoTestsSerdeTest enum.""" return ReflectapiDemoTestsSerdeTestV1(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index 2ec45ec6..251f5b19 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -250,7 +250,9 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedFactory: """ @staticmethod - def int(field_0) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: + def int( + field_0: int, + ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: """Creates the 'int' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged enum.""" return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant( @@ -259,7 +261,9 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedFactory: ) @staticmethod - def string(field_0) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: + def string( + field_0: str, + ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: """Creates the 'string' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged enum.""" return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant( @@ -268,7 +272,9 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedFactory: ) @staticmethod - def bool(field_0) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: + def bool( + field_0: bool, + ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: """Creates the 'bool' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged enum.""" return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index 3e171b8c..2a7364e6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -254,7 +254,9 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedFactory: """ @staticmethod - def int(field_0) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: + def int( + field_0: int, + ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: """Creates the 'int' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged enum.""" return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant( @@ -263,7 +265,9 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedFactory: ) @staticmethod - def string(field_0) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: + def string( + field_0: str, + ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: """Creates the 'string' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged enum.""" return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant( @@ -272,7 +276,9 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedFactory: ) @staticmethod - def bool(field_0) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: + def bool( + field_0: bool, + ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: """Creates the 'bool' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged enum.""" return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant( diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap index 53304f7f..22c65585 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap @@ -181,12 +181,12 @@ class ReflectapiDemoTestsSerdeEnumFactory: """ @staticmethod - def a(field_0) -> ReflectapiDemoTestsSerdeEnumA: + def a(field_0: ReflectapiDemoTestsSerdeStrukt1) -> ReflectapiDemoTestsSerdeEnumA: """Creates the 'a' variant of the ReflectapiDemoTestsSerdeEnum enum.""" return ReflectapiDemoTestsSerdeEnumA(field_0=field_0) @staticmethod - def b(field_0) -> ReflectapiDemoTestsSerdeEnumB: + def b(field_0: ReflectapiDemoTestsSerdeStrukt2) -> ReflectapiDemoTestsSerdeEnumB: """Creates the 'b' variant of the ReflectapiDemoTestsSerdeEnum enum.""" return ReflectapiDemoTestsSerdeEnumB(field_0=field_0) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap index 93a1ea13..075c183f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap index a6f28260..811b113a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap @@ -38,7 +38,9 @@ class ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap index 3aba983e..139193de 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="FieldName", validation_alias="FieldName" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap index b54d1823..f03222ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsSerdeInputTestStructRenameField(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) class ReflectapiDemoTestsSerdeOutputTestStructRenameField(BaseModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap index 1113a59f..58b16a15 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap @@ -31,7 +31,9 @@ class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): @@ -48,7 +50,9 @@ class ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired(BaseModel model_config = ConfigDict(extra="ignore", populate_by_name=True) f: int | None = None - field_name: int + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap index ad3a0975..461cc487 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap @@ -30,7 +30,7 @@ class ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: int + f: int = Field(serialization_alias="field-name&&", validation_alias="field-name&&") class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap index dbc98cbf..0a95d54a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap @@ -30,7 +30,9 @@ class ReflectapiDemoTestsSerdeStructName(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_name: int + field_name: int = Field( + serialization_alias="field-name", validation_alias="field-name" + ) class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap index cee769c3..b69f3d69 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap @@ -36,7 +36,7 @@ class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - _f: int + f: int = Field(serialization_alias="_f", validation_alias="_f") class AsyncInoutClient: diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index f8da76fb..d79fb660 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -766,13 +766,33 @@ impl Normalizer { } /// Normalize a raw schema into a semantic schema - pub fn normalize( - mut self, - mut schema: Schema, - ) -> Result> { + pub fn normalize(mut self, schema: &Schema) -> Result> { + // Clone so that pipeline stages can mutate without affecting the caller + let mut schema = schema.clone(); + // Phase 0: Ensure all symbols have unique, stable IDs crate::ids::ensure_symbol_ids(&mut schema); + // Snapshot original type names before the pipeline transforms them. + // NamingResolutionStage strips module paths, so we need to preserve + // the pre-normalization qualified names for codegen backends. + let original_names: HashMap = schema + .input_types + .types() + .chain(schema.output_types.types()) + .map(|t| { + let name = t.name().to_string(); + // The id.path at this point is the original qualified path + // (set by ensure_symbol_ids, before NamingResolution) + let original = match t { + Type::Primitive(p) => p.id.qualified_name(), + Type::Struct(s) => s.id.qualified_name(), + Type::Enum(e) => e.id.qualified_name(), + }; + (name, original) + }) + .collect(); + // Phase 0.5: Run the standard normalization pipeline (type consolidation, // naming resolution, circular dependency resolution) before symbol discovery NormalizationPipeline::standard().run(&mut schema)?; @@ -790,7 +810,7 @@ impl Normalizer { self.validate_semantics()?; // Phase 5: IR Construction - self.build_semantic_ir(schema) + self.build_semantic_ir(&schema, &original_names) } fn discover_symbols(&mut self, schema: &Schema) -> Result<(), Vec> { @@ -1044,7 +1064,11 @@ impl Normalizer { Ok(()) } - fn build_semantic_ir(self, schema: Schema) -> Result> { + fn build_semantic_ir( + self, + schema: &Schema, + original_names: &HashMap, + ) -> Result> { let mut semantic_types = BTreeMap::new(); let mut semantic_functions = BTreeMap::new(); @@ -1055,7 +1079,7 @@ impl Normalizer { for symbol_id in sorted_symbols { if let Some(raw_type) = self.context.raw_types.get(&symbol_id) { - let semantic_type = self.build_semantic_type(raw_type)?; + let semantic_type = self.build_semantic_type(raw_type, original_names)?; semantic_types.insert(symbol_id, semantic_type); } } @@ -1066,9 +1090,9 @@ impl Normalizer { } Ok(SemanticSchema { - id: schema.id, - name: schema.name, - description: schema.description, + id: schema.id.clone(), + name: schema.name.clone(), + description: schema.description.clone(), functions: semantic_functions, types: semantic_types, symbol_table: self.context.symbol_table, @@ -1078,26 +1102,40 @@ impl Normalizer { fn build_semantic_type( &self, raw_type: &Type, + original_names: &HashMap, ) -> Result> { match raw_type { - Type::Primitive(p) => Ok(SemanticType::Primitive(self.build_semantic_primitive(p)?)), - Type::Struct(s) => Ok(SemanticType::Struct(self.build_semantic_struct(s)?)), - Type::Enum(e) => Ok(SemanticType::Enum(self.build_semantic_enum(e)?)), + Type::Primitive(p) => Ok(SemanticType::Primitive( + self.build_semantic_primitive(p, original_names)?, + )), + Type::Struct(s) => Ok(SemanticType::Struct( + self.build_semantic_struct(s, original_names)?, + )), + Type::Enum(e) => Ok(SemanticType::Enum( + self.build_semantic_enum(e, original_names)?, + )), } } fn build_semantic_primitive( &self, primitive: &Primitive, + original_names: &HashMap, ) -> Result> { let fallback = primitive .fallback .as_ref() .and_then(|tr| self.resolve_global_type_reference(&tr.name)); + let original_name = original_names + .get(&primitive.name) + .cloned() + .unwrap_or_else(|| primitive.name.clone()); + Ok(SemanticPrimitive { id: primitive.id.clone(), name: primitive.name.clone(), + original_name, description: primitive.description.clone(), parameters: primitive .parameters @@ -1116,6 +1154,7 @@ impl Normalizer { fn build_semantic_struct( &self, strukt: &Struct, + original_names: &HashMap, ) -> Result> { let mut fields = BTreeMap::new(); @@ -1124,9 +1163,15 @@ impl Normalizer { fields.insert(field.id.clone(), semantic_field); } + let original_name = original_names + .get(&strukt.name) + .cloned() + .unwrap_or_else(|| strukt.name.clone()); + Ok(SemanticStruct { id: strukt.id.clone(), name: strukt.name.clone(), + original_name, serde_name: strukt.serde_name.clone(), description: strukt.description.clone(), parameters: strukt @@ -1147,7 +1192,11 @@ impl Normalizer { }) } - fn build_semantic_enum(&self, enm: &Enum) -> Result> { + fn build_semantic_enum( + &self, + enm: &Enum, + original_names: &HashMap, + ) -> Result> { let mut variants = BTreeMap::new(); for variant in enm.variants() { @@ -1155,9 +1204,15 @@ impl Normalizer { variants.insert(variant.id.clone(), semantic_variant); } + let original_name = original_names + .get(&enm.name) + .cloned() + .unwrap_or_else(|| enm.name.clone()); + Ok(SemanticEnum { id: enm.id.clone(), name: enm.name.clone(), + original_name, serde_name: enm.serde_name.clone(), description: enm.description.clone(), parameters: enm @@ -1316,7 +1371,7 @@ mod tests { schema.input_types = input_types; let normalizer = Normalizer::new(); - let result = normalizer.normalize(schema); + let result = normalizer.normalize(&schema); assert!( result.is_ok(), @@ -1338,7 +1393,7 @@ mod tests { schema.functions.push(function); let normalizer = Normalizer::new(); - let result = normalizer.normalize(schema); + let result = normalizer.normalize(&schema); assert!( result.is_ok(), @@ -1377,7 +1432,7 @@ mod tests { schema.functions.push(function); let normalizer = Normalizer::new(); - let result = normalizer.normalize(schema); + let result = normalizer.normalize(&schema); assert!(result.is_ok(), "Normalization failed: {:?}", result.err()); let semantic = result.unwrap(); @@ -1407,7 +1462,7 @@ mod tests { schema.functions.push(function); let normalizer = Normalizer::new(); - let semantic = normalizer.normalize(schema).unwrap(); + let semantic = normalizer.normalize(&schema).unwrap(); let func = semantic.functions.values().next().unwrap(); assert!(func.input_type.is_some()); @@ -1586,7 +1641,7 @@ mod tests { fn test_empty_schema_normalization() { let schema = Schema::new(); let normalizer = Normalizer::new(); - let result = normalizer.normalize(schema); + let result = normalizer.normalize(&schema); assert!(result.is_ok()); let semantic = result.unwrap(); @@ -1694,7 +1749,7 @@ mod tests { schema.input_types.insert_type(tree_node.into()); let normalizer = Normalizer::new(); - let result = normalizer.normalize(schema); + let result = normalizer.normalize(&schema); assert!( result.is_ok(), @@ -1744,7 +1799,7 @@ mod tests { schema.input_types.insert_type(employee.into()); let normalizer = Normalizer::new(); - let result = normalizer.normalize(schema); + let result = normalizer.normalize(&schema); assert!( result.is_ok(), @@ -1848,7 +1903,7 @@ mod tests { schema.functions.push(function); let normalizer = Normalizer::new(); - let result = normalizer.normalize(schema); + let result = normalizer.normalize(&schema); assert!( result.is_ok(), "Normalization should succeed: {:?}", @@ -1910,7 +1965,7 @@ mod tests { let normalizer = Normalizer::new(); let semantic = normalizer - .normalize(schema) + .normalize(&schema) .expect("Normalization should succeed"); // Get the function's ID diff --git a/reflectapi-schema/src/semantic.rs b/reflectapi-schema/src/semantic.rs index 0adccaaa..48ffa7dc 100644 --- a/reflectapi-schema/src/semantic.rs +++ b/reflectapi-schema/src/semantic.rs @@ -58,6 +58,7 @@ pub enum SemanticType { pub struct SemanticPrimitive { pub id: SymbolId, pub name: String, + pub original_name: String, pub description: String, /// Resolved generic parameters @@ -71,6 +72,7 @@ pub struct SemanticPrimitive { pub struct SemanticStruct { pub id: SymbolId, pub name: String, + pub original_name: String, pub serde_name: String, pub description: String, @@ -93,6 +95,7 @@ pub struct SemanticStruct { pub struct SemanticEnum { pub id: SymbolId, pub name: String, + pub original_name: String, pub serde_name: String, pub description: String, @@ -312,6 +315,7 @@ impl Default for SymbolTable { impl SemanticSchema { /// Look up a type by its name via the symbol table's resolution cache. /// Falls back to linear scan if the name isn't in the symbol table. + /// Also checks original_name for lookups by pre-normalization qualified name. pub fn get_type_by_name(&self, name: &str) -> Option<&SemanticType> { // Try symbol table lookup first (O(log n)) let path = name.split("::").map(|s| s.to_string()).collect::>(); @@ -321,7 +325,11 @@ impl SemanticSchema { } } // Fallback: linear scan by name (handles post-normalization name changes) - self.types.values().find(|t| t.name() == name) + if let Some(ty) = self.types.values().find(|t| t.name() == name) { + return Some(ty); + } + // Fallback: linear scan by original_name (handles pre-normalization lookups) + self.types.values().find(|t| t.original_name() == name) } /// Look up a type by SymbolId. @@ -361,6 +369,14 @@ impl SemanticType { SemanticType::Enum(e) => &e.name, } } + + pub fn original_name(&self) -> &str { + match self { + SemanticType::Primitive(p) => &p.original_name, + SemanticType::Struct(s) => &s.original_name, + SemanticType::Enum(e) => &e.original_name, + } + } } impl ResolvedTypeReference { diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 81f80f90..32695114 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -528,7 +528,7 @@ fn render_struct_with_flattened_internal_enum( // Collect the parent struct's non-flattened fields + any flattened struct fields let mut base_fields: Vec = Vec::new(); for field in struct_def.fields.iter().filter(|f| !f.flattened()) { - let (python_name, alias) = sanitize_field_name_with_alias(field.name()); + let (python_name, alias) = sanitize_field_name_with_alias(field.name(), field.serde_name()); let field_type = type_ref_to_python_type( &field.type_ref, schema, @@ -586,7 +586,8 @@ fn render_struct_with_flattened_internal_enum( active_generics, used_type_vars, )?; - let (python_name, alias) = sanitize_field_name_with_alias(field.name()); + let (python_name, alias) = + sanitize_field_name_with_alias(field.name(), field.serde_name()); base_fields.push(templates::Field { name: python_name, type_annotation: if field.required { @@ -617,7 +618,7 @@ fn render_struct_with_flattened_internal_enum( let mut fields = base_fields.clone(); // Add the tag discriminator field - let (sanitized_tag, tag_alias) = sanitize_field_name_with_alias(tag); + let (sanitized_tag, tag_alias) = sanitize_field_name_with_alias(tag, tag); fields.push(templates::Field { name: sanitized_tag.clone(), type_annotation: format!("Literal['{}']", variant.serde_name()), @@ -656,7 +657,8 @@ fn render_struct_with_flattened_internal_enum( } else { (false, None, field_type) }; - let (sanitized, alias) = sanitize_field_name_with_alias(vf.name()); + let (sanitized, alias) = + sanitize_field_name_with_alias(vf.name(), vf.serde_name()); fields.push(templates::Field { name: sanitized, type_annotation: final_type, @@ -692,7 +694,8 @@ fn render_struct_with_flattened_internal_enum( active_generics, used_type_vars, )?; - let (sanitized, alias) = sanitize_field_name_with_alias(sf.name()); + let (sanitized, alias) = + sanitize_field_name_with_alias(sf.name(), sf.serde_name()); fields.push(templates::Field { name: sanitized, type_annotation: if sf.required { @@ -743,7 +746,7 @@ fn render_struct_with_flattened_internal_enum( } // Render the parent type as a discriminated union RootModel - let (sanitized_tag, _) = sanitize_field_name_with_alias(tag); + let (sanitized_tag, _) = sanitize_field_name_with_alias(tag, tag); let union_type = union_variant_names.join(",\n "); output.push_str(&format!( "\nclass {struct_name}(RootModel):\n root: Annotated[\n Union[\n {union_type},\n ],\n Field(discriminator=\"{sanitized_tag}\"),\n ]\n" @@ -772,7 +775,7 @@ fn render_struct_with_flatten_standard( // Add regular fields for field in struct_def.fields.iter().filter(|f| !f.flattened()) { - let (python_name, alias) = sanitize_field_name_with_alias(field.name()); + let (python_name, alias) = sanitize_field_name_with_alias(field.name(), field.serde_name()); let field_type = type_ref_to_python_type( &field.type_ref, schema, @@ -1103,9 +1106,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // for render functions that need type-safe SymbolId-based lookups; // the raw Schema is still used for the main iteration loop since // the Normalizer's NamingResolutionStage transforms type names. - let _semantic = reflectapi_schema::Normalizer::new() - .normalize(schema.clone()) - .ok(); + let _semantic = reflectapi_schema::Normalizer::new().normalize(&schema).ok(); let mut generated_code = Vec::new(); @@ -1383,11 +1384,15 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Generate all factory classes now that types are defined and rebuilt for factory_info in &factory_data { + let mut factory_type_vars = BTreeSet::new(); let factory_code = if factory_info.is_internally_tagged { generate_internally_tagged_factory_class( &factory_info.enum_def, &factory_info.enum_name, &factory_info.union_members, + &schema, + &implemented_types, + &mut factory_type_vars, )? } else { generate_factory_class_with_representation( @@ -1395,6 +1400,9 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { &factory_info.enum_name, &factory_info.union_members, &factory_info.enum_def.representation, + &schema, + &implemented_types, + &mut factory_type_vars, )? }; external_types_and_rebuilds.push(factory_code); @@ -1659,7 +1667,7 @@ fn make_flattened_field( (false, None, field_type) }; - let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); + let (sanitized, alias) = sanitize_field_name_with_alias(field.name(), field.serde_name()); Ok(templates::Field { name: sanitized, type_annotation: final_field_type, @@ -1716,7 +1724,7 @@ fn collect_flattened_enum_fields( .unwrap_or(&type_ref.name) .to_lowercase() }); - let (sanitized, alias) = sanitize_field_name_with_alias(&field_name); + let (sanitized, alias) = sanitize_field_name_with_alias(&field_name, &field_name); let (optional, default_value, final_type) = if !parent_required { ( @@ -1808,7 +1816,8 @@ fn render_struct( (false, None, base_field_type) }; - let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); + let (sanitized, alias) = + sanitize_field_name_with_alias(field.name(), field.serde_name()); Ok(templates::Field { name: sanitized, type_annotation: field_type, @@ -2061,7 +2070,8 @@ fn render_adjacently_tagged_enum_without_factory( } else { (false, None, field_type) }; - let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); + let (sanitized, alias) = + sanitize_field_name_with_alias(field.name(), field.serde_name()); fields.push(templates::Field { name: sanitized, type_annotation: final_field_type, @@ -2208,7 +2218,7 @@ fn generate_adjacent_serialize_cases( Fields::Named(_named_fields) => { let class_name = format!("{enum_name}{}Variant", to_pascal_case(rust_name)); cases.push(format!( - " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{wire_name}\", \"{content}\": self.root.model_dump(exclude_none=True)}}" + " if isinstance(self.root, {class_name}):\n return {{\"{tag}\": \"{wire_name}\", \"{content}\": self.root.model_dump()}}" )); } } @@ -2405,7 +2415,8 @@ fn render_externally_tagged_enum( (false, None, field_type) }; - let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); + let (sanitized, alias) = + sanitize_field_name_with_alias(field.name(), field.serde_name()); fields.push(templates::Field { name: sanitized, type_annotation: final_field_type, @@ -2444,7 +2455,7 @@ fn render_externally_tagged_enum( )); serializer_cases.push(format!( - " if isinstance(self.root, {variant_class_name}):\n return {{\"{variant_name}\": self.root.model_dump(exclude_none=True)}}" + " if isinstance(self.root, {variant_class_name}):\n return {{\"{variant_name}\": self.root.model_dump()}}" )); } } @@ -2485,7 +2496,13 @@ fn render_externally_tagged_enum( let enum_code = template.render(); // Generate factory class for ergonomic instantiation - let factory_class_code = generate_externally_tagged_factory_class(enum_def, &enum_name)?; + let factory_class_code = generate_externally_tagged_factory_class( + enum_def, + &enum_name, + schema, + implemented_types, + used_type_vars, + )?; // Combine all parts let mut result = String::new(); @@ -2511,6 +2528,9 @@ fn generate_factory_class_with_representation( enum_name: &str, union_members: &[String], representation: &reflectapi_schema::Representation, + schema: &Schema, + implemented_types: &BTreeMap, + used_type_vars: &mut BTreeSet, ) -> anyhow::Result { use reflectapi_schema::Fields; @@ -2591,7 +2611,13 @@ fn generate_factory_class_with_representation( Fields::Unnamed(_) | Fields::Named(_) => { // Complex variant - create static method let method_name = to_snake_case(variant.name()); - let method_params = generate_factory_method_params(variant)?; + let method_params = generate_factory_method_params( + variant, + schema, + implemented_types, + &generic_params, + used_type_vars, + )?; let method_args = generate_factory_method_args(variant)?; // For discriminated unions, methods should return the main enum type @@ -2673,6 +2699,9 @@ fn generate_internally_tagged_factory_class( enum_def: &reflectapi_schema::Enum, enum_name: &str, union_variant_names: &[String], + schema: &Schema, + implemented_types: &BTreeMap, + used_type_vars: &mut BTreeSet, ) -> anyhow::Result { use reflectapi_schema::Fields; @@ -2680,6 +2709,8 @@ fn generate_internally_tagged_factory_class( let mut class_attributes = Vec::new(); let mut static_methods = Vec::new(); + let active_generics: Vec = enum_def.parameters.iter().map(|p| p.name.clone()).collect(); + for (i, variant) in enum_def.variants.iter().enumerate() { let variant_name = variant.name(); let variant_class_name = &union_variant_names[i]; @@ -2697,7 +2728,13 @@ fn generate_internally_tagged_factory_class( Fields::Unnamed(_) | Fields::Named(_) => { // Complex variant - create static method let method_name = to_snake_case(variant_name); - let method_params = generate_factory_method_params(variant)?; + let method_params = generate_factory_method_params( + variant, + schema, + implemented_types, + &active_generics, + used_type_vars, + )?; let method_args = generate_factory_method_args(variant)?; static_methods.push(format!( @@ -2740,6 +2777,9 @@ fn generate_internally_tagged_factory_class( fn generate_externally_tagged_factory_class( enum_def: &reflectapi_schema::Enum, enum_name: &str, + schema: &Schema, + implemented_types: &BTreeMap, + used_type_vars: &mut BTreeSet, ) -> anyhow::Result { use reflectapi_schema::Fields; @@ -2747,6 +2787,8 @@ fn generate_externally_tagged_factory_class( let class_attributes: Vec = Vec::new(); let mut static_methods = Vec::new(); + let active_generics: Vec = enum_def.parameters.iter().map(|p| p.name.clone()).collect(); + for variant in &enum_def.variants { let variant_name = variant.name(); @@ -2762,7 +2804,13 @@ fn generate_externally_tagged_factory_class( let method_name = to_snake_case(variant_name); let variant_class_name = format!("{}{}Variant", enum_name, to_pascal_case(variant_name)); - let method_params = generate_factory_method_params(variant)?; + let method_params = generate_factory_method_params( + variant, + schema, + implemented_types, + &active_generics, + used_type_vars, + )?; let method_args = generate_factory_method_args(variant)?; static_methods.push(format!( @@ -2789,7 +2837,13 @@ fn generate_externally_tagged_factory_class( Ok(factory_code) } -fn generate_factory_method_params(variant: &reflectapi_schema::Variant) -> anyhow::Result { +fn generate_factory_method_params( + variant: &reflectapi_schema::Variant, + schema: &Schema, + implemented_types: &BTreeMap, + active_generics: &[String], + used_type_vars: &mut BTreeSet, +) -> anyhow::Result { use reflectapi_schema::Fields; match &variant.fields { @@ -2800,10 +2854,23 @@ fn generate_factory_method_params(variant: &reflectapi_schema::Variant) -> anyho .enumerate() .map(|(i, field)| { let param_name = format!("field_{i}"); + let type_annotation = type_ref_to_python_type( + &field.type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + ) + .unwrap_or_else(|_| "Any".to_string()); + let full_type = if field.required { + type_annotation + } else { + format!("{type_annotation} | None") + }; if field.required { - param_name + format!("{param_name}: {full_type}") } else { - format!("{param_name} = None") + format!("{param_name}: {full_type} = None") } }) .collect(); @@ -2818,10 +2885,23 @@ fn generate_factory_method_params(variant: &reflectapi_schema::Variant) -> anyho for field in named_fields { let param_name = to_snake_case(field.serde_name()); + let type_annotation = type_ref_to_python_type( + &field.type_ref, + schema, + implemented_types, + active_generics, + used_type_vars, + ) + .unwrap_or_else(|_| "Any".to_string()); + let full_type = if field.required { + type_annotation + } else { + format!("{type_annotation} | None") + }; if field.required { - required_params.push(param_name); + required_params.push(format!("{param_name}: {full_type}")); } else { - optional_params.push(format!("{param_name} = None")); + optional_params.push(format!("{param_name}: {full_type} = None")); } } @@ -3046,8 +3126,10 @@ fn render_internally_tagged_enum_core( (false, None, field_type) }; - let (sanitized, alias) = - sanitize_field_name_with_alias(struct_field.name()); + let (sanitized, alias) = sanitize_field_name_with_alias( + struct_field.name(), + struct_field.serde_name(), + ); fields.push(templates::Field { name: sanitized, type_annotation: final_field_type, @@ -3111,7 +3193,8 @@ fn render_internally_tagged_enum_core( (false, None, field_type) }; - let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); + let (sanitized, alias) = + sanitize_field_name_with_alias(field.name(), field.serde_name()); fields.push(templates::Field { name: sanitized, type_annotation: final_field_type, @@ -3277,7 +3360,8 @@ fn render_untagged_enum( (false, None, field_type) }; - let (sanitized, alias) = sanitize_field_name_with_alias(field.name()); + let (sanitized, alias) = + sanitize_field_name_with_alias(field.name(), field.serde_name()); fields.push(templates::Field { name: sanitized, type_annotation: final_field_type, @@ -3992,17 +4076,35 @@ fn extract_error_suffix(error_name: &str) -> Option { } fn sanitize_field_name(s: &str) -> String { - to_valid_python_identifier(&to_snake_case(s)) + let mut result = to_valid_python_identifier(&to_snake_case(s)); + // Strip leading underscores - Pydantic v2 treats _-prefixed fields as private + result = result.trim_start_matches('_').to_string(); + if result.is_empty() { + // Edge case: name was all underscores + "field".to_string() + } else { + result + } } -fn sanitize_field_name_with_alias(s: &str) -> (String, Option) { - let snake_case = to_snake_case(s); +fn sanitize_field_name_with_alias(name: &str, serde_name: &str) -> (String, Option) { + let snake_case = to_snake_case(name); let sanitized = to_valid_python_identifier(&snake_case); - // If the sanitized name is different from the snake_case version, - // it means we had to modify it due to Python keywords/builtins - if sanitized != snake_case { - (sanitized, Some(snake_case)) + // Strip leading underscores - Pydantic v2 treats _-prefixed fields as private + let sanitized = sanitized.trim_start_matches('_').to_string(); + let sanitized = if sanitized.is_empty() { + // Edge case: name was all underscores + "field".to_string() + } else { + sanitized + }; + + // The wire name (serde_name) is what goes over JSON. + // We need an alias whenever the Python field name differs from the wire name. + let wire_name = serde_name; + if sanitized != wire_name { + (sanitized, Some(wire_name.to_string())) } else { (sanitized, None) } From 3566a68a4ee466c4fd370d94dbf904c1074c94ca Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 19:28:52 +1300 Subject: [PATCH 26/47] feat(python): add namespace classes mirroring Rust module structure Port the TypeScript/Rust namespace algorithm to Python codegen. Type definitions remain at module top-level with flat PascalCase names for Pydantic forward-reference resolution. Namespace alias classes provide dotted access paths mirroring the Rust module hierarchy: class reflectapi_demo: class tests: class serde: Offer = ReflectapiDemoTestsSerdeOffer OfferKind = ReflectapiDemoTestsSerdeOfferKind Users access types as: reflectapi_demo.tests.serde.Offer Type references in annotations, client methods, model_rebuild calls, and factory classes all use dotted paths. This matches the approach used by TypeScript (export namespace) and Rust (pub mod) backends. Implementation: - New Module struct + modules_from_rendered_types (ported from TS) - type_name_to_python_ref converts :: paths to dotted notation - Client signatures use dotted type references - Factory/testing utilities use namespaced names - Removed old generate_nested_class_structure dead code 125 snapshot files updated. --- docs/design/python-namespace-classes.md | 976 ++++++++++++++++++ reflectapi-demo/clients/python/generated.py | 711 +++++++------ reflectapi-demo/clients/python/uv.lock | 346 +++++++ ...tests__basic__reflectapi_deprecated-5.snap | 41 +- ...__basic__reflectapi_enum_documented-4.snap | 57 +- ...__reflectapi_enum_with_skip_variant-5.snap | 69 +- ...basic__reflectapi_struct_documented-4.snap | 27 +- ...sts__basic__reflectapi_struct_empty-5.snap | 39 +- ...i_struct_one_basic_field_static_str-4.snap | 37 +- ...ctapi_struct_one_basic_field_string-4.snap | 33 +- ..._basic_field_string_reflectapi_both-5.snap | 45 +- ...ield_string_reflectapi_both_equally-5.snap | 41 +- ...eld_string_reflectapi_both_equally2-4.snap | 29 +- ...ing_reflectapi_both_with_attributes-5.snap | 57 +- ...flectapi_struct_one_basic_field_u32-4.snap | 29 +- ...ts__basic__reflectapi_struct_option-5.snap | 39 +- ...sts__basic__reflectapi_struct_tuple-5.snap | 34 +- ...tapi_struct_with_additional_derives-5.snap | 66 +- ...ruct_with_all_primitive_type_fields-5.snap | 65 +- ...__basic__reflectapi_struct_with_arc-5.snap | 39 +- ...ectapi_struct_with_arc_pointer_only-5.snap | 41 +- ...i_struct_with_attributes_input_only-5.snap | 37 +- ..._struct_with_attributes_output_only-5.snap | 29 +- ...with_external_generic_type_fallback-5.snap | 45 +- ...ectapi_struct_with_fixed_size_array-5.snap | 41 +- ...sic__reflectapi_struct_with_hashmap-5.snap | 39 +- ...eflectapi_struct_with_hashset_field-5.snap | 41 +- ...i_struct_with_hashset_field_generic-5.snap | 45 +- ...asic__reflectapi_struct_with_nested-5.snap | 52 +- ...lectapi_struct_with_nested_external-5.snap | 58 +- ...reflectapi_struct_with_self_via_arc-5.snap | 41 +- ...__reflectapi_struct_with_skip_field-5.snap | 39 +- ...ectapi_struct_with_skip_field_input-5.snap | 61 +- ...ctapi_struct_with_skip_field_output-5.snap | 61 +- ...lectapi_struct_with_transform_array-5.snap | 41 +- ...flectapi_struct_with_transform_both-5.snap | 41 +- ...tapi_struct_with_transform_fallback-5.snap | 45 +- ...ruct_with_transform_fallback_nested-5.snap | 41 +- ...lectapi_struct_with_transform_input-5.snap | 61 +- ...ectapi_struct_with_transform_output-5.snap | 61 +- ...basic__reflectapi_struct_with_tuple-5.snap | 43 +- ...sic__reflectapi_struct_with_tuple12-5.snap | 41 +- ...__basic__reflectapi_struct_with_vec-5.snap | 39 +- ...reflectapi_struct_with_vec_external-5.snap | 58 +- ...__reflectapi_struct_with_vec_nested-5.snap | 56 +- ...sic__reflectapi_struct_with_vec_two-5.snap | 39 +- ...reflectapi_demo__tests__enums__enum-4.snap | 29 +- ...tapi_demo__tests__enums__enum_empty-4.snap | 27 +- ...demo__tests__enums__enum_rename_num-5.snap | 41 +- ...variant_and_fields_and_named_fields-4.snap | 64 +- ...num_with_discriminant_ignored_input-4.snap | 35 +- ...um_with_discriminant_ignored_output-4.snap | 39 +- ...enums__enum_with_discriminant_input-4.snap | 29 +- ...nums__enum_with_discriminant_output-4.snap | 37 +- ..._enum_with_empty_variant_and_fields-4.snap | 55 +- ...emo__tests__enums__enum_with_fields-4.snap | 60 +- ...o__tests__enums__enum_with_generics-4.snap | 59 +- ...nums__enum_with_generics_and_fields-4.snap | 61 +- ...enerics_and_fields_and_named_fields-4.snap | 66 +- ...lly_tagged_enum_with_tuple_variants-5.snap | 67 +- ...ally_tagged_enum_with_unit_variants-5.snap | 55 +- ...ics__struct_with_circular_reference-4.snap | 31 +- ...uct_with_circular_reference_generic-4.snap | 31 +- ...h_circular_reference_generic_parent-4.snap | 54 +- ...cular_reference_generic_without_box-4.snap | 35 +- ...eference_generic_without_box_parent-4.snap | 48 +- ...generic_without_box_parent_specific-4.snap | 44 +- ...__struct_with_nested_generic_struct-4.snap | 46 +- ...ct_with_nested_generic_struct_twice-4.snap | 46 +- ...enerics__struct_with_simple_generic-4.snap | 29 +- ...__generics__struct_with_vec_generic-4.snap | 33 +- ...cs__struct_with_vec_generic_generic-4.snap | 44 +- ...ct_with_vec_generic_generic_generic-4.snap | 44 +- ...adj_repr_enum_with_untagged_variant-5.snap | 59 +- ...ectapi_demo__tests__serde__datetime-5.snap | 57 +- ...e__empty_variants_adjacently_tagged-5.snap | 74 +- ...e__empty_variants_externally_tagged-5.snap | 74 +- ...e__empty_variants_internally_tagged-5.snap | 65 +- ...sts__serde__empty_variants_untagged-5.snap | 50 +- ...api_demo__tests__serde__enum_rename-5.snap | 41 +- ...demo__tests__serde__enum_rename_all-5.snap | 40 +- ...__serde__enum_rename_all_on_variant-5.snap | 76 +- ...s__serde__enum_rename_variant_field-5.snap | 61 +- ...ectapi_demo__tests__serde__enum_tag-5.snap | 59 +- ...emo__tests__serde__enum_tag_content-5.snap | 72 +- ..._serde__enum_tag_content_rename_all-5.snap | 74 +- ...i_demo__tests__serde__enum_untagged-5.snap | 41 +- ..._tests__serde__enum_with_field_skip-5.snap | 59 +- ...__enum_with_rename_to_invalid_chars-5.snap | 48 +- ...sts__serde__enum_with_variant_other-5.snap | 92 +- ...ests__serde__enum_with_variant_skip-5.snap | 39 +- ..._enum_with_variant_skip_deserialize-5.snap | 65 +- ...e__enum_with_variant_skip_serialize-5.snap | 66 +- ...__serde__enum_with_variant_untagged-5.snap | 63 +- ..._demo__tests__serde__external_impls-5.snap | 39 +- ...latten_adjacently_tagged_enum_field-5.snap | 77 +- ...latten_externally_tagged_enum_field-5.snap | 77 +- ...s__serde__flatten_internally_tagged-5.snap | 89 +- ...latten_internally_tagged_enum_field-5.snap | 72 +- ...pi_demo__tests__serde__flatten_unit-5.snap | 58 +- ..._serde__flatten_untagged_enum_field-5.snap | 54 +- ...tapi_demo__tests__serde__kebab_case-5.snap | 39 +- ...rde__nested_internally_tagged_enums-5.snap | 129 ++- ...ted_internally_tagged_enums_minimal-5.snap | 80 +- ..._newtype_variants_adjacently_tagged-5.snap | 93 +- ..._newtype_variants_externally_tagged-5.snap | 89 +- ..._newtype_variants_internally_tagged-5.snap | 85 +- ...api_demo__tests__serde__struct_from-5.snap | 50 +- ...api_demo__tests__serde__struct_into-5.snap | 50 +- ...i_demo__tests__serde__struct_rename-5.snap | 39 +- ...mo__tests__serde__struct_rename_all-5.snap | 39 +- ...erde__struct_rename_all_differently-5.snap | 61 +- ...erde__struct_rename_all_pascal_case-5.snap | 45 +- ...s__serde__struct_rename_differently-5.snap | 50 +- ...__tests__serde__struct_rename_field-5.snap | 61 +- ...repr_transparent_generic_inner_type-5.snap | 39 +- ...demo__tests__serde__struct_try_from-5.snap | 50 +- ...__tests__serde__struct_with_flatten-5.snap | 52 +- ...serde__struct_with_flatten_optional-5.snap | 58 +- ..._with_flatten_optional_and_required-5.snap | 69 +- ...struct_with_rename_to_invalid_chars-5.snap | 41 +- ...e__struct_with_rename_to_kebab_case-5.snap | 39 +- ...s__serde__struct_with_serde_default-5.snap | 65 +- ...ests__serde__struct_with_serde_skip-5.snap | 39 +- ..._struct_with_serde_skip_deserialize-5.snap | 65 +- ...e__struct_with_serde_skip_serialize-5.snap | 65 +- ...struct_with_serde_skip_serialize_if-5.snap | 65 +- ...ectapi_demo__tests__serde__timezone-5.snap | 39 +- reflectapi/src/codegen/python.rs | 605 ++++++----- 129 files changed, 6467 insertions(+), 2660 deletions(-) create mode 100644 docs/design/python-namespace-classes.md create mode 100644 reflectapi-demo/clients/python/uv.lock diff --git a/docs/design/python-namespace-classes.md b/docs/design/python-namespace-classes.md new file mode 100644 index 00000000..bcb4c06d --- /dev/null +++ b/docs/design/python-namespace-classes.md @@ -0,0 +1,976 @@ +# Design: Python Namespace Classes for Module-Structured Types + +## Problem Statement + +Rust types like `myapp::orders::v2::OrderStatus` currently produce Python class names +like `MyappOrdersV2OrderStatus` via the `improve_class_name` function, which +concatenates all `::` segments into PascalCase. This is unreadable and produces poor +developer experience. Meanwhile, the TypeScript codegen already emits nested +`namespace` blocks mirroring the Rust module structure, giving users +`myapp.orders.v2.OrderStatus`. + +## Goal + +Emit Python namespace classes that mirror the Rust module hierarchy: + +```python +class orders: + class v2: + class OrderStatus(BaseModel): + ... +``` + +Users write `orders.v2.OrderStatus` instead of `MyappOrdersV2OrderStatus`. + +--- + +## Current Architecture (Key Code Paths) + +### 1. `improve_class_name` (line ~3786) + +The single bottleneck where Rust qualified names become Python class names. +For `myapp::orders::v2::OrderStatus` it splits on `::`, PascalCases each segment, +and concatenates: `MyappOrdersV2OrderStatus`. + +### 2. `type_ref_to_python_type` (line ~4167) + +Resolves a `TypeReference` to a Python type string. For user-defined types (step 3, +line ~4259), it calls `improve_class_name(&type_ref.name)` to produce the class name +used in annotations. This is where `MyappOrdersV2OrderStatus` appears in field type +annotations. + +### 3. `generate` function (line ~1095) + +The main orchestrator. Key flow: +1. `schema.consolidate_types()` returns `Vec` of all qualified type names. +2. For each type, calls `improve_class_name(type_def.name())` to get the Python name. +3. `rendered_types: BTreeMap` maps Python class name -> rendered code. +4. Types are emitted top-level, then `model_rebuild()` calls, then factory classes. + +### 4. `rendered_types: BTreeMap` (line ~1248) + +Maps the flat Python class name (e.g., `MyappOrdersV2OrderStatus`) to its rendered +class definition string. Used for `model_rebuild()` calls and the testing module's +type list. + +### 5. TypeScript precedent (`modules_from_rendered_types`, typescript.rs:800) + +TypeScript already does exactly what we want: it splits qualified names on `::`, pops +the last segment as the type name, and walks the remaining segments to build a tree of +`Module { name, types, submodules }`. Rendering emits nested `export namespace` blocks. +Type references join `::` segments with `.` (typescript.rs:988). + +--- + +## Design + +### A. Namespace Extraction: `qualified_name_to_python` + +#### Core function signature + +```rust +/// Split a Rust qualified name into (namespace_path, leaf_name). +/// +/// After stripping `strip_prefix` (if it matches), the remaining `::` segments +/// become the namespace path, and the final segment is the leaf type name. +fn qualified_name_to_python( + name: &str, + strip_prefix: &str, +) -> (Vec, String) { + let working_name = if !strip_prefix.is_empty() { + let prefix_with_sep = if strip_prefix.ends_with("::") { + strip_prefix.to_string() + } else { + format!("{}::", strip_prefix) + }; + name.strip_prefix(&prefix_with_sep).unwrap_or(name) + } else { + name + }; + + let parts: Vec<&str> = working_name.split("::").collect(); + if parts.len() <= 1 { + // No module path -- top-level type + return (vec![], parts[0].to_string()); + } + + let leaf = parts.last().unwrap().to_string(); + let namespace: Vec = parts[..parts.len() - 1] + .iter() + .map(|s| s.to_string()) // keep original casing -- these become Python identifiers + .collect(); + + (namespace, leaf) +} +``` + +#### How `strip_prefix` is determined + +The demo app calls `builder.rename_types("reflectapi_demo::", "myapi::")`, which +transforms `reflectapi_demo::model::Pet` to `myapp::model::Pet`. After +`consolidate_types`, the qualified names already have the user's chosen prefix. + +The **common prefix** is the longest shared `::` prefix across all user-defined types. +For the demo, that's `myapi::`. We should compute this automatically: + +```rust +fn compute_common_prefix(type_names: &[String]) -> String { + // Filter to only user-defined types (exclude std::, reflectapi::, chrono::, etc.) + let user_types: Vec<&str> = type_names.iter() + .map(|s| s.as_str()) + .filter(|n| !is_implemented_or_runtime_type(n)) + .collect(); + + if user_types.is_empty() { + return String::new(); + } + + // Split each into :: segments, find common prefix segments + let first_parts: Vec<&str> = user_types[0].split("::").collect(); + let mut common_len = first_parts.len().saturating_sub(1); // never include last (the type name itself) + + for name in &user_types[1..] { + let parts: Vec<&str> = name.split("::").collect(); + let max = parts.len().saturating_sub(1); + common_len = common_len.min(max); + for i in 0..common_len { + if parts[i] != first_parts[i] { + common_len = i; + break; + } + } + } + + if common_len == 0 { + return String::new(); + } + + first_parts[..common_len].join("::") +} +``` + +The `Config` should also accept an optional explicit `strip_prefix` override, since +the auto-detection can be surprising when a schema has types from many different crate +roots: + +```rust +pub struct Config { + // ... existing fields ... + /// Prefix to strip from Rust module paths when generating Python namespaces. + /// If None, the common prefix is auto-detected. + /// If Some(""), no prefix is stripped (all module segments become namespaces). + pub namespace_strip_prefix: Option, +} +``` + +#### Examples + +| Rust qualified name | strip_prefix | namespace_path | leaf_name | +|---|---|---|---| +| `myapp::orders::v2::OrderStatus` | `myapp` | `["orders", "v2"]` | `OrderStatus` | +| `myapp::model::Pet` | `myapp` | `["model"]` | `Pet` | +| `myapp::model::input::Pet` | `myapp` | `["model", "input"]` | `Pet` | +| `myapp::proto::PetsListRequest` | `myapp` | `["proto"]` | `PetsListRequest` | +| `OrderStatus` | `""` | `[]` | `OrderStatus` | +| `std::string::String` | `myapp` | (handled by implemented_types, never reaches this) | - | + +### B. Type Name Mapping: Replace `improve_class_name` + +#### New data structure: `TypeNameMapping` + +```rust +/// Pre-computed mapping from Rust qualified names to Python namespace + leaf names. +struct TypeNameMapping { + /// For each original Rust type name, the Python namespace path and leaf class name. + /// E.g., "myapp::orders::v2::OrderStatus" -> (["orders", "v2"], "OrderStatus") + entries: BTreeMap, String)>, + + /// The dotted Python reference string for each Rust type name. + /// E.g., "myapp::orders::v2::OrderStatus" -> "orders.v2.OrderStatus" + python_refs: BTreeMap, +} + +impl TypeNameMapping { + fn new( + all_type_names: &[String], + implemented_types: &BTreeMap, + strip_prefix: &str, + ) -> Self { + let mut entries = BTreeMap::new(); + let mut python_refs = BTreeMap::new(); + + for name in all_type_names { + if implemented_types.contains_key(name) { + continue; + } + + let (ns_path, leaf) = qualified_name_to_python(name, strip_prefix); + let dotted = if ns_path.is_empty() { + leaf.clone() + } else { + format!("{}.{}", ns_path.join("."), leaf) + }; + + entries.insert(name.clone(), (ns_path, leaf)); + python_refs.insert(name.clone(), dotted); + } + + Self { entries, python_refs } + } + + /// Get the Python reference string for use in type annotations. + /// Returns the dotted path like "orders.v2.OrderStatus". + fn python_ref(&self, rust_name: &str) -> Option<&str> { + self.python_refs.get(rust_name).map(|s| s.as_str()) + } + + /// Get the leaf class name (the name used in the class definition itself). + fn leaf_name(&self, rust_name: &str) -> Option<&str> { + self.entries.get(rust_name).map(|(_, leaf)| leaf.as_str()) + } + + /// Get the namespace path segments. + fn namespace_path(&self, rust_name: &str) -> Option<&[String]> { + self.entries.get(rust_name).map(|(ns, _)| ns.as_slice()) + } +} +``` + +#### Replace `improve_class_name` calls + +`improve_class_name` is called in ~15 places. It must be replaced by lookups into +`TypeNameMapping`: + +- **In class definitions** (the `class Foo(BaseModel):` line): use `leaf_name()`. + The class is *defined* inside its namespace wrapper, so only the leaf is needed. + +- **In type annotations** (field types, union members, function params/returns): use + `python_ref()`. This gives the fully-qualified dotted path like + `orders.v2.OrderStatus`. + +- **In variant class names** (e.g., `MyapiModelBehaviorAggressiveVariant`): these are + derived names. Since the enum itself has a namespace + leaf, the variant class should + live in the same namespace with name `{EnumLeaf}{VariantName}Variant`. E.g., + `BehaviorAggressiveVariant` inside namespace `model`. + +Concretely, every call site for `improve_class_name` must receive the `TypeNameMapping` +(or at least the original Rust qualified name) and choose between `leaf_name` and +`python_ref` depending on context. + +### C. Output Structure: Namespace Module Tree + +#### Data structure (mirroring TypeScript) + +```rust +/// A node in the Python namespace tree. +struct NamespaceNode { + name: String, + /// Rendered type definitions (class bodies) that belong directly to this namespace. + types: Vec, + /// Child namespaces. + children: BTreeMap, +} +``` + +#### Building the tree + +Identical to `modules_from_rendered_types` in TypeScript/Rust codegens: + +```rust +fn build_namespace_tree( + type_names: &[String], // original Rust qualified names + rendered_types: &mut BTreeMap, // leaf_name -> rendered code + mapping: &TypeNameMapping, +) -> NamespaceNode { + let mut root = NamespaceNode { + name: String::new(), + types: vec![], + children: BTreeMap::new(), + }; + + for rust_name in type_names { + if let Some((ns_path, _leaf)) = mapping.entries.get(rust_name) { + let mut node = &mut root; + for segment in ns_path { + node = node.children + .entry(segment.clone()) + .or_insert_with(|| NamespaceNode { + name: segment.clone(), + types: vec![], + children: BTreeMap::new(), + }); + } + // The key in rendered_types needs to be whatever we used when inserting. + // We'll use the dotted python ref as the key. + let python_ref = mapping.python_ref(rust_name).unwrap(); + if let Some(rendered) = rendered_types.remove(python_ref) { + node.types.push(rendered); + } + } + } + + root +} +``` + +#### Rendering the tree to Python + +```rust +impl NamespaceNode { + fn render(&self, indent: usize) -> String { + let pad = " ".repeat(indent); + let mut out = String::new(); + + if !self.name.is_empty() { + // Emit a namespace wrapper class + writeln!(out, "{}class {}:", pad, self.name).unwrap(); + writeln!(out, "{} \"\"\"Namespace for {} types.\"\"\"", pad, self.name).unwrap(); + writeln!(out).unwrap(); + } + + let inner_indent = if self.name.is_empty() { indent } else { indent + 1 }; + let inner_pad = " ".repeat(inner_indent); + + // Emit child namespaces first (they need to be defined before types that + // reference them, though with `from __future__ import annotations` this + // is less critical) + for child in self.children.values() { + out.push_str(&child.render(inner_indent)); + out.push('\n'); + } + + // Emit types in this namespace + for type_code in &self.types { + // Re-indent the rendered type code to sit inside the namespace class + for line in type_code.lines() { + if line.trim().is_empty() { + writeln!(out).unwrap(); + } else { + writeln!(out, "{}{}", inner_pad, line).unwrap(); + } + } + out.push('\n'); + } + + out + } +} +``` + +**Key insight about indentation**: Each type is currently rendered with zero +indentation (top-level class). When nesting inside namespace classes, we must +re-indent every line. This is a simple prepend of `" " * depth` to each +non-empty line. + +#### `from __future__ import annotations` + +The generated file already emits this at the top (line ~8 of generated.py): +```python +from __future__ import annotations +``` + +This means all annotations are strings, so forward references work without quotes. +A type defined later in the file can be referenced by an earlier type. This is +critical -- it means we don't need topological ordering between namespaces. + +#### `model_rebuild()` and namespace classes + +Currently `model_rebuild` calls look like: +```python +MyappOrdersV2OrderStatus.model_rebuild() +``` + +With namespaces, they become: +```python +orders.v2.OrderStatus.model_rebuild() +``` + +This works in Python because `orders.v2.OrderStatus` is a real class object +accessible via attribute lookup. Pydantic's `model_rebuild()` resolves forward +references in the class's module globals. The key requirement: the namespace classes +must be defined **before** `model_rebuild()` is called (which is already the case -- +model rebuilds happen after all type definitions). + +**Verified experimentally (Pydantic 2.12.5)**: Because the generated file uses +`from __future__ import annotations`, all annotations are stored as strings and +only evaluated when `model_rebuild()` is called. At that point, Pydantic evaluates +annotations in the module's global namespace, where all namespace classes are already +defined. This means: + +1. Forward references work even when a namespace class is referenced before its + definition in source order. +2. Cross-namespace references like `payments.PaymentInfo` resolve correctly because + `payments` is a module-global name. +3. `model_rebuild()` works **without** `_types_namespace` in the common case. + +For extra safety (e.g., if the generated file is imported piecemeal or types are +used in unusual evaluation contexts), we can optionally pass `_types_namespace`: + +```python +_ns = { + "orders": orders, + "payments": payments, + "OrderStatus": OrderStatus, # top-level types too + "ReflectapiOption": ReflectapiOption, + "ReflectapiEmpty": ReflectapiEmpty, +} +orders.v2.OrderStatus.model_rebuild(_types_namespace=_ns) +``` + +**Recommended approach**: Start with plain `model_rebuild()` (no `_types_namespace`). +If edge cases surface, add the namespace dict as a follow-up. The simpler generation +is preferred since it produces cleaner output and the experimental validation confirms +it works. + +### D. Reference Format: Changes to `type_ref_to_python_type` + +#### Current behavior + +At line ~4275: +```rust +let base_type = improve_class_name(&type_ref.name); +``` + +This produces `MyappOrdersV2OrderStatus`. + +#### New behavior + +Replace with a lookup into `TypeNameMapping`: + +```rust +// In type_ref_to_python_type, step 3 (user-defined type found in schema): +let base_type = mapping + .python_ref(&type_ref.name) + .unwrap_or_else(|| improve_class_name(&type_ref.name)); +// improve_class_name kept as fallback for unexpected types +``` + +This produces `orders.v2.OrderStatus` -- the dotted path. + +#### Cross-namespace references + +When type A in namespace `orders` references type B in namespace `payments`: + +```python +class orders: + class v2: + class OrderStatus(BaseModel): + payment: payments.PaymentInfo # cross-namespace ref +``` + +Because `from __future__ import annotations` is active, `payments.PaymentInfo` is a +string at class-definition time and only resolved during `model_rebuild()`. As long as +the `_types_namespace` dict contains `"payments": payments`, this resolves correctly. + +#### Same-namespace references + +When type A references type B in the same namespace: + +```python +class model: + class Pet(BaseModel): + kind: model.Kind # same-namespace, still use full dotted path +``` + +We always use the full dotted path from root, never relative paths. This is simpler +and avoids ambiguity. The alternative (using just `Kind` for same-namespace +references) would require tracking "current namespace" context through +`type_ref_to_python_type`, which is fragile and unnecessary given +`from __future__ import annotations`. + +### E. Client Methods + +#### Current behavior + +```python +class PetsClient: + async def list(self, ...) -> ApiResponse[MyapiProtoPaginated[MyapiModelOutputPet]]: + ... +``` + +#### New behavior + +```python +class PetsClient: + async def list(self, ...) -> ApiResponse[proto.Paginated[model.output.Pet]]: + ... +``` + +The change flows naturally through `render_function` -> `type_ref_to_python_type`, +which now returns dotted paths. No special handling needed for the client class itself. + +The client class is defined at top level (not inside a namespace), so it references +types using their full dotted paths from the module root. + +### F. Collision Handling + +#### Same leaf name, different namespaces (the happy path) + +``` +myapp::orders::OrderStatus -> orders.OrderStatus +myapp::payments::OrderStatus -> payments.OrderStatus +``` + +No collision. This is the entire point of namespacing. + +#### Same leaf name, same namespace + +This can happen if `consolidate_types` inserts `input`/`output` discriminators: + +``` +myapp::model::input::Pet -> model.input.Pet +myapp::model::output::Pet -> model.output.Pet +``` + +These end up in different sub-namespaces (`input` vs `output`), so no collision. + +#### True collision: same namespace, same leaf name + +This would require two types with identical Rust qualified names after stripping, +which `consolidate_types` prevents. But as a safety net: + +```rust +impl TypeNameMapping { + fn new(...) -> Self { + // ... build entries ... + + // Detect collisions: same (namespace_path, leaf_name) for different Rust names + let mut seen: BTreeMap<(Vec, String), String> = BTreeMap::new(); + for (rust_name, (ns_path, leaf)) in &entries { + let key = (ns_path.clone(), leaf.clone()); + if let Some(existing_rust_name) = seen.get(&key) { + // Collision! Disambiguate by prepending the distinguishing + // module segment to the leaf name. + // This is a fallback -- should rarely trigger. + // Strategy: use the full PascalCase concatenation for the + // colliding types (falling back to current behavior). + warn!("Python namespace collision: {} and {} both map to {}.{}", + existing_rust_name, rust_name, ns_path.join("."), leaf); + } + seen.insert(key, rust_name.clone()); + } + } +} +``` + +For the fallback, we can use the current `improve_class_name` behavior (PascalCase +concatenation) and place the type at the root level, or we can add a distinguishing +segment from the Rust name. This should be rare enough that a simple fallback suffices. + +#### Python keyword collisions in namespace names + +Namespace segments like `import`, `class`, `type` are Python keywords and can't be +class names. Apply `safe_python_identifier` to each namespace segment: + +```rust +let namespace: Vec = parts[..parts.len() - 1] + .iter() + .map(|s| safe_python_identifier(s)) + .collect(); +``` + +This might produce `type_` for a module named `type`. Acceptable trade-off. + +--- + +## Changes Required (Function by Function) + +### 1. `Config` struct (line ~19) + +Add: +```rust +pub namespace_strip_prefix: Option, +``` + +### 2. New: `TypeNameMapping` struct and `qualified_name_to_python` function + +As described above. Add these near `improve_class_name`. + +### 3. `generate` function (line ~1095) + +After `consolidate_types()`, before the rendering loop: + +```rust +let strip_prefix = config.namespace_strip_prefix.clone() + .unwrap_or_else(|| compute_common_prefix(&all_type_names)); +let type_mapping = TypeNameMapping::new(&all_type_names, &implemented_types, &strip_prefix); +``` + +Thread `type_mapping` through to all render functions and `type_ref_to_python_type`. + +Change `rendered_types` key from `improve_class_name(type_def.name())` to +`type_mapping.python_ref(original_type_name)`. + +Replace the current "Generate nested class structure" block (line ~1350-1355) with +the new namespace tree build + render. + +Change `model_rebuild()` emission to use dotted paths and pass `_types_namespace`. + +### 4. `improve_class_name` (line ~3786) + +Keep as a fallback for types not in the mapping (shouldn't happen, but defensive). +All call sites that currently use `improve_class_name` switch to `TypeNameMapping` +lookups: + +| Call site context | Use `leaf_name()` or `python_ref()`? | +|---|---| +| Class definition name (`class Foo(BaseModel)`) | `leaf_name()` | +| Type annotation in field | `python_ref()` | +| Union member name | `python_ref()` | +| Variant class name derivation | `leaf_name()` of parent + variant suffix | +| Factory class name | `python_ref()` of parent + `Factory` suffix | +| `model_rebuild()` call | `python_ref()` | +| Client return type | `python_ref()` | +| Testing module type list | `python_ref()` | + +### 5. `type_ref_to_python_type` (line ~4167) + +Add `type_mapping: &TypeNameMapping` parameter. At line ~4275: + +```rust +// Old: +let base_type = improve_class_name(&type_ref.name); +// New: +let base_type = type_mapping + .python_ref(&type_ref.name) + .map(|s| s.to_string()) + .unwrap_or_else(|| improve_class_name(&type_ref.name)); +``` + +### 6. `render_struct`, `render_enum_without_factory`, and all variant renderers + +These all call `improve_class_name(&def.name)` for the class name in the `class` +statement. Change to `type_mapping.leaf_name(&def.name)` since the class definition +lives inside its namespace wrapper. + +For variant class names derived from the parent enum, use: +```rust +let variant_class_name = format!( + "{}{}Variant", + type_mapping.leaf_name(&enum_def.name).unwrap(), + to_pascal_case(variant.name()), +); +``` + +### 7. `generate_nested_class_structure` and related functions (line ~3886) + +**Remove entirely**. This ad-hoc namespace grouping (hardcoded `MyapiModel` prefix +detection, manual `Pet` and `Kind` grouping) is replaced by the systematic namespace +tree. + +### 8. Templates: `DataClass`, `EnumClass`, etc. + +No changes needed to template structs themselves. They already take a `name: String` +field. We just pass the leaf name instead of the concatenated name. + +--- + +## Concrete Example + +### Input schema (after consolidate_types) + +Type names: +- `myapp::model::Pet` (struct, used as both input and output, so consolidate_types + will have split it) +- `myapp::model::input::Pet` (input variant) +- `myapp::model::output::Pet` (output variant) +- `myapp::model::Kind` (internally tagged enum) +- `myapp::model::KindDog` (variant struct) +- `myapp::model::KindCat` (variant struct) +- `myapp::proto::PetsListRequest` (struct) +- `myapp::proto::Paginated` (generic struct) +- `myapp::HealthCheckFail` (struct, shallow path) + +### Config + +```rust +namespace_strip_prefix: None // auto-detects "myapp" +``` + +### Computed mapping (strip_prefix = "myapp") + +| Rust name | namespace_path | leaf_name | python_ref | +|---|---|---|---| +| `myapp::model::input::Pet` | `["model", "input"]` | `Pet` | `model.input.Pet` | +| `myapp::model::output::Pet` | `["model", "output"]` | `Pet` | `model.output.Pet` | +| `myapp::model::Kind` | `["model"]` | `Kind` | `model.Kind` | +| `myapp::model::KindDog` | `["model"]` | `KindDog` | `model.KindDog` | +| `myapp::model::KindCat` | `["model"]` | `KindCat` | `model.KindCat` | +| `myapp::proto::PetsListRequest` | `["proto"]` | `PetsListRequest` | `proto.PetsListRequest` | +| `myapp::proto::Paginated` | `["proto"]` | `Paginated` | `proto.Paginated` | +| `myapp::HealthCheckFail` | `[]` | `HealthCheckFail` | `HealthCheckFail` | + +### Generated output (simplified) + +```python +from __future__ import annotations +# ... imports ... + + +class HealthCheckFail(BaseModel): + """Generated data model.""" + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class model: + """Namespace for model types.""" + + class input: + """Namespace for input types.""" + + class Pet(BaseModel): + """Input pet model.""" + model_config = ConfigDict(extra="ignore", populate_by_name=True) + name: str + kind: model.Kind + age: int | None = None + + class output: + """Namespace for output types.""" + + class Pet(BaseModel): + """Output pet model.""" + model_config = ConfigDict(extra="ignore", populate_by_name=True) + name: str + kind: model.Kind + age: int | None = None + + class KindDog(BaseModel): + """Dog variant""" + model_config = ConfigDict(extra="ignore", populate_by_name=True) + type: Literal["dog"] = "dog" + breed: str + + class KindCat(BaseModel): + """Cat variant""" + model_config = ConfigDict(extra="ignore", populate_by_name=True) + type: Literal["cat"] = "cat" + lives: int + + Kind = Union[model.KindDog, model.KindCat] + + +class proto: + """Namespace for proto types.""" + + class PetsListRequest(BaseModel): + """Generated data model.""" + model_config = ConfigDict(extra="ignore", populate_by_name=True) + cursor: str | None = None + limit: int | None = None + + class Paginated(BaseModel, Generic[T]): + """Generated data model.""" + model_config = ConfigDict(extra="ignore", populate_by_name=True) + items: list[T] + cursor: str | None = None + + +# Client classes +class AsyncPetsClient: + async def list(self, request: proto.PetsListRequest, ...) -> ApiResponse[proto.Paginated[model.output.Pet]]: + ... + + +# Rebuild models to resolve forward references +try: + HealthCheckFail.model_rebuild() + model.input.Pet.model_rebuild() + model.output.Pet.model_rebuild() + model.KindDog.model_rebuild() + model.KindCat.model_rebuild() + proto.PetsListRequest.model_rebuild() + proto.Paginated.model_rebuild() +except AttributeError: + pass +``` + +--- + +## Edge Cases + +### 1. Types with no module path + +`HealthCheckFail` (after stripping `myapp::`) has no `::` separators. It goes to the +root level with no namespace wrapper. This matches current behavior. + +### 2. Generic types across namespaces + +`proto.Paginated[model.output.Pet]` -- the generic parameter uses the full dotted path. +This works because `type_ref_to_python_type` recursively resolves arguments, and each +argument lookup produces a dotted path. + +### 3. Variant classes derived from enums + +Variant structs like `KindDog` already exist as separate types in the schema (after +consolidation). They get their own mapping entries and land in the same namespace as +their parent enum. Their names are already unique within the namespace because the +Rust names include the enum prefix. + +For *generated* variant classes (those created during `render_enum_without_factory` for +variants with fields), the naming uses `format!("{}{}Variant", leaf_name, variant)`. +These are emitted inline in the same rendered code block as the parent enum, so they +automatically land in the same namespace. + +### 4. Factory classes + +Factory classes are currently emitted after `model_rebuild()`. Their names should use +the dotted path: `model.KindFactory`. However, factories are generated as standalone +classes, not inside namespace wrappers. Two options: + +**Option A** (simpler): Keep factories at top level with dotted-path-derived names: +```python +class model_KindFactory: + ... +``` + +**Option B** (consistent): Generate factory classes inside the namespace tree too. +This requires either a second rendering pass or collecting factory code into the +namespace tree before rendering. + +**Recommendation**: Option B. Add factory code to the namespace node during the +factory generation phase, then render the full tree (including factories) at the end. +This keeps the API surface clean: `model.KindFactory`. + +### 5. `from __future__ import annotations` and namespace self-reference + +Inside `class model`, a type annotation `model.Kind` refers to the *enclosing class* +before it's fully defined. With `from __future__ import annotations`, this is fine +because the annotation is never evaluated at class-definition time. + +### 6. Empty namespace segments + +If `strip_prefix` removes all segments except the leaf, there's no namespace: +``` +strip_prefix = "myapp::model" +name = "myapp::model::Pet" +result = ([], "Pet") # top-level +``` + +This is correct behavior. + +### 7. Deeply nested namespaces + +``` +myapp::services::orders::v2::internal::OrderStatus +strip_prefix = "myapp" +result = (["services", "orders", "v2", "internal"], "OrderStatus") +``` + +Produces: +```python +class services: + class orders: + class v2: + class internal: + class OrderStatus(BaseModel): ... +``` + +This mirrors the Rust module structure faithfully. Users who want flatter namespaces +can use `rename_types` on the builder to collapse modules before codegen. + +### 8. Testing module + +The testing module currently lists type names for `MockClient`. Change from: +```python +types = ["MyappOrdersV2OrderStatus", ...] +``` +To: +```python +types = ["orders.v2.OrderStatus", ...] +``` + +The testing utilities need to be able to look up types by dotted path. This may +require the testing module to receive the `_ns` dict or use `eval()` on dotted paths. +Alternatively, build a flat lookup dict: + +```python +_all_types = { + "orders.v2.OrderStatus": orders.v2.OrderStatus, + "model.Pet": model.Pet, + ... +} +``` + +--- + +## Migration and Backwards Compatibility + +This is a **breaking change** to the generated Python API surface. Users referencing +`MyappModelPet` must change to `model.Pet`. + +**Mitigation options**: + +1. **Feature flag**: Add `pub use_namespaces: bool` to `Config` (default `false` + initially, flip to `true` in a major version). + +2. **Compatibility aliases**: After the namespace tree, emit: + ```python + # Backwards compatibility aliases + MyappModelPet = model.Pet + MyappModelKind = model.Kind + ``` + These can be gated behind a `Config` flag and deprecated. + +3. **Major version bump**: Since this is a new feature branch, ship it as part of + a major version release. + +**Recommendation**: Feature flag with default `true` for new users, but provide +the compatibility aliases for one major version cycle. + +--- + +## Key Architectural Decision: Render-then-Indent vs. Indent-Aware Rendering + +Two approaches for handling indentation inside namespace classes: + +**Approach 1: Render-then-Indent (recommended)** + +Types are rendered as top-level classes (zero indentation), same as today. The +namespace tree's `render()` method re-indents each line by prepending spaces. This +is how the TypeScript codegen works (namespace blocks wrap already-rendered types). + +Pros: +- Minimal changes to existing render functions. +- Template structs unchanged. +- Easy to reason about -- rendering and namespacing are separate concerns. + +Cons: +- Re-indentation is a string operation that happens after rendering. +- If any rendered code contains string literals with significant whitespace, the + re-indentation could corrupt them. In practice, Pydantic models don't have this. + +**Approach 2: Indent-Aware Rendering** + +Pass an `indent_level: usize` through all render functions and templates, so each +template emits code at the correct indentation depth from the start. + +Pros: +- No post-hoc string manipulation. +- Theoretically "cleaner" output. + +Cons: +- Massive refactor: every template's `render()` needs an indent parameter. +- Much larger diff for a marginal benefit. + +**Decision**: Approach 1. The TypeScript/Rust codegens both use this pattern +successfully. The re-indentation is trivial and well-contained in one function. + +--- + +## Implementation Order + +1. Add `qualified_name_to_python` and `compute_common_prefix` (pure functions, easy + to unit test). +2. Add `TypeNameMapping` struct. +3. Thread `TypeNameMapping` through `type_ref_to_python_type` (biggest refactor -- + touches many function signatures). +4. Build `NamespaceNode` tree and render function. +5. Wire into `generate`: replace `rendered_types` keying, replace + `generate_nested_class_structure`, update `model_rebuild` emission. +6. Update factory class generation to use namespace tree. +7. Update testing module. +8. Remove `generate_nested_class_structure`, `extract_namespace_from_type_name`, + `generate_namespace_class` (the old ad-hoc code). +9. Add `Config` fields and feature flag. +10. Update snapshot tests / demo generated.py. diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index 51b78fd8..825d85e4 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -51,77 +51,6 @@ class MyapiProtoPetsRemoveError(str, Enum): NOT_AUTHORIZED = "NotAuthorized" -class MyapiModelBehaviorAggressiveVariant(BaseModel): - """Aggressive variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: float - field_1: str - - -class MyapiModelBehaviorOtherVariant(BaseModel): - """Other variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - description: str - notes: str | None = None - - -# Externally tagged enum using RootModel -MyapiModelBehaviorVariants = Union[ - Literal["Calm"], MyapiModelBehaviorAggressiveVariant, MyapiModelBehaviorOtherVariant -] - - -class MyapiModelBehavior(RootModel[MyapiModelBehaviorVariants]): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance(data, MyapiModelBehaviorAggressiveVariant): - return data - if isinstance(data, MyapiModelBehaviorOtherVariant): - return data - - # Handle JSON data (for deserialization) - if isinstance(data, str) and data == "Calm": - return data - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Aggressive": - if isinstance(value, list): - return MyapiModelBehaviorAggressiveVariant( - field_0=value[0], field_1=value[1] - ) - else: - raise ValueError("Expected list for tuple variant Aggressive") - if key == "Other": - return MyapiModelBehaviorOtherVariant(**value) - - raise ValueError(f"Unknown variant for MyapiModelBehavior: {data}") - - @model_serializer - def _serialize_externally_tagged(self): - if self.root == "Calm": - return "Calm" - if isinstance(self.root, MyapiModelBehaviorAggressiveVariant): - return {"Aggressive": [self.root.field_0, self.root.field_1]} - if isinstance(self.root, MyapiModelBehaviorOtherVariant): - return {"Other": self.root.model_dump()} - - raise ValueError( - f"Cannot serialize MyapiModelBehavior variant: {type(self.root)}" - ) - - class MyapiProtoHeaders(BaseModel): """Generated data model.""" @@ -219,39 +148,6 @@ class MyapiProtoPaginated(BaseModel, Generic[T]): cursor: str | None = None -class MyapiModelKindDog(BaseModel): - """A dog""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["dog"] = "dog" - breed: str - - -class MyapiModelKindCat(BaseModel): - """A cat""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["cat"] = "cat" - lives: int - - -class MyapiModelKindBird(BaseModel): - """Test for unit variants in internally tagged enums""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["bird"] = "bird" - - -class MyapiModelKind(RootModel): - root: Annotated[ - Union[MyapiModelKindDog, MyapiModelKindCat, MyapiModelKindBird], - Field(discriminator="type"), - ] - - class MyapiProtoPetsListRequest(BaseModel): """Generated data model.""" @@ -302,7 +198,7 @@ class MyapiProtoValidationErrorValidationAVariant(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_0: MyapiProtoValidationA + field_0: myapi.proto.ValidationA # Externally tagged enum using RootModel @@ -341,39 +237,15 @@ def _serialize_externally_tagged(self): ) -class MyapiModelInputPet(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - kind: MyapiModelKind - age: int | None = None - updated_at: datetime | None = None - behaviors: list[MyapiModelBehavior] | None = None - - -class MyapiModelOutputPet(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - kind: MyapiModelKind - age: int | None = None - updated_at: datetime - behaviors: list[MyapiModelBehavior] | None = None - - class MyapiProtoPetsUpdateRequest(BaseModel): """Generated data model.""" model_config = ConfigDict(extra="ignore", populate_by_name=True) name: str - kind: MyapiModelKind | None = None + kind: myapi.model.Kind | None = None age: ReflectapiOption[int] = None - behaviors: ReflectapiOption[list[MyapiModelBehavior]] = None + behaviors: ReflectapiOption[list[myapi.model.Behavior]] = None class MyapiProtoPetsUpdateErrorValidationVariant(BaseModel): @@ -381,7 +253,7 @@ class MyapiProtoPetsUpdateErrorValidationVariant(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_0: list[MyapiProtoValidationError] + field_0: list[myapi.proto.ValidationError] # Externally tagged enum using RootModel @@ -432,6 +304,192 @@ def _serialize_externally_tagged(self): ) +class MyapiModelBehaviorAggressiveVariant(BaseModel): + """Aggressive variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: float + field_1: str + + +class MyapiModelBehaviorOtherVariant(BaseModel): + """Other variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + description: str + notes: str | None = None + + +# Externally tagged enum using RootModel +MyapiModelBehaviorVariants = Union[ + Literal["Calm"], MyapiModelBehaviorAggressiveVariant, MyapiModelBehaviorOtherVariant +] + + +class MyapiModelBehavior(RootModel[MyapiModelBehaviorVariants]): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance(data, MyapiModelBehaviorAggressiveVariant): + return data + if isinstance(data, MyapiModelBehaviorOtherVariant): + return data + + # Handle JSON data (for deserialization) + if isinstance(data, str) and data == "Calm": + return data + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Aggressive": + if isinstance(value, list): + return MyapiModelBehaviorAggressiveVariant( + field_0=value[0], field_1=value[1] + ) + else: + raise ValueError("Expected list for tuple variant Aggressive") + if key == "Other": + return MyapiModelBehaviorOtherVariant(**value) + + raise ValueError(f"Unknown variant for MyapiModelBehavior: {data}") + + @model_serializer + def _serialize_externally_tagged(self): + if self.root == "Calm": + return "Calm" + if isinstance(self.root, MyapiModelBehaviorAggressiveVariant): + return {"Aggressive": [self.root.field_0, self.root.field_1]} + if isinstance(self.root, MyapiModelBehaviorOtherVariant): + return {"Other": self.root.model_dump()} + + raise ValueError( + f"Cannot serialize MyapiModelBehavior variant: {type(self.root)}" + ) + + +class MyapiModelKindDog(BaseModel): + """A dog""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["dog"] = "dog" + breed: str + + +class MyapiModelKindCat(BaseModel): + """A cat""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["cat"] = "cat" + lives: int + + +class MyapiModelKindBird(BaseModel): + """Test for unit variants in internally tagged enums""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["bird"] = "bird" + + +class MyapiModelKind(RootModel): + root: Annotated[ + Union[MyapiModelKindDog, MyapiModelKindCat, MyapiModelKindBird], + Field(discriminator="type"), + ] + + +class MyapiModelInputPet(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + kind: myapi.model.Kind + age: int | None = None + updated_at: datetime | None = None + behaviors: list[myapi.model.Behavior] | None = None + + +class MyapiModelOutputPet(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + kind: myapi.model.Kind + age: int | None = None + updated_at: datetime + behaviors: list[myapi.model.Behavior] | None = None + + +# Namespace classes for dotted access to types +class myapi: + """Namespace for myapi types.""" + + HealthCheckFail = MyapiHealthCheckFail + + class proto: + """Namespace for proto types.""" + + PetsRemoveError = MyapiProtoPetsRemoveError + NOT_FOUND = NOT_FOUND + NOT_AUTHORIZED = NOT_AUTHORIZED + Headers = MyapiProtoHeaders + InternalError = MyapiProtoInternalError + PetsCreateErrorInvalidIdentityVariant = ( + MyapiProtoPetsCreateErrorInvalidIdentityVariant + ) + PetsCreateErrorVariants = MyapiProtoPetsCreateErrorVariants + PetsCreateError = MyapiProtoPetsCreateError + PetsRemoveRequest = MyapiProtoPetsRemoveRequest + ValidationA = MyapiProtoValidationA + Paginated = MyapiProtoPaginated + PetsListRequest = MyapiProtoPetsListRequest + PetsListErrorInvalidCursor = MyapiProtoPetsListErrorInvalidCursor + PetsListErrorUnauthorized = MyapiProtoPetsListErrorUnauthorized + PetsListErrorInternal = MyapiProtoPetsListErrorInternal + PetsListError = MyapiProtoPetsListError + ValidationErrorValidationAVariant = MyapiProtoValidationErrorValidationAVariant + ValidationErrorVariants = MyapiProtoValidationErrorVariants + ValidationError = MyapiProtoValidationError + PetsUpdateRequest = MyapiProtoPetsUpdateRequest + PetsUpdateErrorValidationVariant = MyapiProtoPetsUpdateErrorValidationVariant + PetsUpdateErrorVariants = MyapiProtoPetsUpdateErrorVariants + PetsUpdateError = MyapiProtoPetsUpdateError + + class model: + """Namespace for model types.""" + + BehaviorAggressiveVariant = MyapiModelBehaviorAggressiveVariant + BehaviorOtherVariant = MyapiModelBehaviorOtherVariant + BehaviorVariants = MyapiModelBehaviorVariants + Behavior = MyapiModelBehavior + KindDog = MyapiModelKindDog + KindCat = MyapiModelKindCat + KindBird = MyapiModelKindBird + Kind = MyapiModelKind + + class input: + """Namespace for input types.""" + + Pet = MyapiModelInputPet + + class output: + """Namespace for output types.""" + + Pet = MyapiModelOutputPet + + class AsyncHealthClient: """Async client for health operations.""" @@ -465,8 +523,8 @@ def __init__(self, client: AsyncClientBase) -> None: async def create( self, - data: Optional[MyapiModelInputPet] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.model.input.Pet] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Create a new pet @@ -490,8 +548,8 @@ async def create( async def delete( self, - data: Optional[MyapiProtoPetsRemoveRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.proto.PetsRemoveRequest] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Remove an existing pet @@ -525,12 +583,12 @@ async def delete( async def get_first( self, - headers: Optional[MyapiProtoHeaders] = None, - ) -> ApiResponse[MyapiModelOutputPet | None]: + headers: Optional[myapi.proto.Headers] = None, + ) -> ApiResponse[myapi.model.output.Pet | None]: """Fetch first pet, if any exists Returns: - ApiResponse[MyapiModelOutputPet | None]: Response containing MyapiModelOutputPet | None data + ApiResponse[myapi.model.output.Pet | None]: Response containing myapi.model.output.Pet | None data """ path = "/pets.get-first" @@ -540,21 +598,21 @@ async def get_first( path, params=params if params else None, headers_model=headers, - response_model=MyapiModelOutputPet | None, + response_model=myapi.model.output.Pet | None, ) async def list( self, - data: Optional[MyapiProtoPetsListRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, - ) -> ApiResponse[MyapiProtoPaginated[MyapiModelOutputPet]]: + data: Optional[myapi.proto.PetsListRequest] = None, + headers: Optional[myapi.proto.Headers] = None, + ) -> ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: """List available pets Args: data: Request data for the list operation. Returns: - ApiResponse[MyapiProtoPaginated[MyapiModelOutputPet]]: Response containing MyapiProtoPaginated[MyapiModelOutputPet] data + ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: Response containing myapi.proto.Paginated[myapi.model.output.Pet] data """ path = "/pets.list" @@ -565,13 +623,13 @@ async def list( params=params if params else None, json_model=data, headers_model=headers, - response_model=MyapiProtoPaginated[MyapiModelOutputPet], + response_model=myapi.proto.Paginated[myapi.model.output.Pet], ) async def remove( self, - data: Optional[MyapiProtoPetsRemoveRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.proto.PetsRemoveRequest] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Remove an existing pet @@ -595,8 +653,8 @@ async def remove( async def update( self, - data: Optional[MyapiProtoPetsUpdateRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.proto.PetsUpdateRequest] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Update an existing pet @@ -667,8 +725,8 @@ def __init__(self, client: ClientBase) -> None: def create( self, - data: Optional[MyapiModelInputPet] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.model.input.Pet] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Create a new pet @@ -692,8 +750,8 @@ def create( def delete( self, - data: Optional[MyapiProtoPetsRemoveRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.proto.PetsRemoveRequest] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Remove an existing pet @@ -727,12 +785,12 @@ def delete( def get_first( self, - headers: Optional[MyapiProtoHeaders] = None, - ) -> ApiResponse[MyapiModelOutputPet | None]: + headers: Optional[myapi.proto.Headers] = None, + ) -> ApiResponse[myapi.model.output.Pet | None]: """Fetch first pet, if any exists Returns: - ApiResponse[MyapiModelOutputPet | None]: Response containing MyapiModelOutputPet | None data + ApiResponse[myapi.model.output.Pet | None]: Response containing myapi.model.output.Pet | None data """ path = "/pets.get-first" @@ -742,21 +800,21 @@ def get_first( path, params=params if params else None, headers_model=headers, - response_model=MyapiModelOutputPet | None, + response_model=myapi.model.output.Pet | None, ) def list( self, - data: Optional[MyapiProtoPetsListRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, - ) -> ApiResponse[MyapiProtoPaginated[MyapiModelOutputPet]]: + data: Optional[myapi.proto.PetsListRequest] = None, + headers: Optional[myapi.proto.Headers] = None, + ) -> ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: """List available pets Args: data: Request data for the list operation. Returns: - ApiResponse[MyapiProtoPaginated[MyapiModelOutputPet]]: Response containing MyapiProtoPaginated[MyapiModelOutputPet] data + ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: Response containing myapi.proto.Paginated[myapi.model.output.Pet] data """ path = "/pets.list" @@ -767,13 +825,13 @@ def list( params=params if params else None, json_model=data, headers_model=headers, - response_model=MyapiProtoPaginated[MyapiModelOutputPet], + response_model=myapi.proto.Paginated[myapi.model.output.Pet], ) def remove( self, - data: Optional[MyapiProtoPetsRemoveRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.proto.PetsRemoveRequest] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Remove an existing pet @@ -797,8 +855,8 @@ def remove( def update( self, - data: Optional[MyapiProtoPetsUpdateRequest] = None, - headers: Optional[MyapiProtoHeaders] = None, + data: Optional[myapi.proto.PetsUpdateRequest] = None, + headers: Optional[myapi.proto.Headers] = None, ) -> ApiResponse[Any]: """Update an existing pet @@ -836,23 +894,6 @@ def __init__( self.pets = PetsClient(self) -# Nested class definitions for better organization - - -class Pet: - """Grouped types for better organization.""" - - Input = MyapiModelInputPet - Output = MyapiModelOutputPet - - class Kind: - """Kind variants for this type.""" - - Union = MyapiModelKind - Dog = MyapiModelKindDog - Cat = MyapiModelKindCat - - # External type definitions StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] @@ -861,272 +902,274 @@ class Kind: # Rebuild models to resolve forward references try: - MyapiHealthCheckFail.model_rebuild() - MyapiModelBehavior.model_rebuild() - MyapiModelInputPet.model_rebuild() - MyapiModelKind.model_rebuild() - MyapiModelOutputPet.model_rebuild() - MyapiProtoHeaders.model_rebuild() - MyapiProtoInternalError.model_rebuild() - MyapiProtoPaginated.model_rebuild() - MyapiProtoPetsCreateError.model_rebuild() - MyapiProtoPetsListError.model_rebuild() - MyapiProtoPetsListRequest.model_rebuild() - MyapiProtoPetsRemoveError.model_rebuild() - MyapiProtoPetsRemoveRequest.model_rebuild() - MyapiProtoPetsUpdateError.model_rebuild() - MyapiProtoPetsUpdateRequest.model_rebuild() - MyapiProtoValidationA.model_rebuild() - MyapiProtoValidationError.model_rebuild() + myapi.HealthCheckFail.model_rebuild() + myapi.model.Behavior.model_rebuild() + myapi.model.Kind.model_rebuild() + myapi.model.input.Pet.model_rebuild() + myapi.model.output.Pet.model_rebuild() + myapi.proto.Headers.model_rebuild() + myapi.proto.InternalError.model_rebuild() + myapi.proto.Paginated.model_rebuild() + myapi.proto.PetsCreateError.model_rebuild() + myapi.proto.PetsListError.model_rebuild() + myapi.proto.PetsListRequest.model_rebuild() + myapi.proto.PetsRemoveError.model_rebuild() + myapi.proto.PetsRemoveRequest.model_rebuild() + myapi.proto.PetsUpdateError.model_rebuild() + myapi.proto.PetsUpdateRequest.model_rebuild() + myapi.proto.ValidationA.model_rebuild() + myapi.proto.ValidationError.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class MyapiModelBehaviorFactory: - """Factory class for creating MyapiModelBehavior variants with ergonomic syntax. +class myapi_model_BehaviorFactory: + """Factory class for creating myapi.model.Behavior variants with ergonomic syntax. - MyapiModelBehavior variants + myapi.model.Behavior variants """ @staticmethod - def calm() -> MyapiModelBehavior: - """Creates the 'Calm' variant of the MyapiModelBehavior enum.""" - return MyapiModelBehavior("Calm") + def calm() -> myapi.model.Behavior: + """Creates the 'Calm' variant of the myapi.model.Behavior enum.""" + return myapi.model.Behavior("Calm") @staticmethod - def aggressive(field_0: float, field_1: str) -> MyapiModelBehavior: - """Creates the 'Aggressive' variant of the MyapiModelBehavior enum.""" - return MyapiModelBehavior( - MyapiModelBehaviorAggressiveVariant(field_0=field_0, field_1=field_1) + def aggressive(field_0: float, field_1: str) -> myapi.model.Behavior: + """Creates the 'Aggressive' variant of the myapi.model.Behavior enum.""" + return myapi.model.Behavior( + myapi.model.BehaviorAggressiveVariant(field_0=field_0, field_1=field_1) ) @staticmethod - def other(description: str, notes: str | None = None) -> MyapiModelBehavior: - """Creates the 'Other' variant of the MyapiModelBehavior enum.""" - return MyapiModelBehavior( - MyapiModelBehaviorOtherVariant(description=description, notes=notes) + def other(description: str, notes: str | None = None) -> myapi.model.Behavior: + """Creates the 'Other' variant of the myapi.model.Behavior enum.""" + return myapi.model.Behavior( + myapi.model.BehaviorOtherVariant(description=description, notes=notes) ) -class MyapiProtoPetsCreateErrorFactory: - """Factory class for creating MyapiProtoPetsCreateError variants with ergonomic syntax. +class myapi_proto_PetsCreateErrorFactory: + """Factory class for creating myapi.proto.PetsCreateError variants with ergonomic syntax. - MyapiProtoPetsCreateError variants + myapi.proto.PetsCreateError variants """ @staticmethod - def conflict() -> MyapiProtoPetsCreateError: - """Creates the 'Conflict' variant of the MyapiProtoPetsCreateError enum.""" - return MyapiProtoPetsCreateError("Conflict") + def conflict() -> myapi.proto.PetsCreateError: + """Creates the 'Conflict' variant of the myapi.proto.PetsCreateError enum.""" + return myapi.proto.PetsCreateError("Conflict") @staticmethod - def not_authorized() -> MyapiProtoPetsCreateError: - """Creates the 'NotAuthorized' variant of the MyapiProtoPetsCreateError enum.""" - return MyapiProtoPetsCreateError("NotAuthorized") + def not_authorized() -> myapi.proto.PetsCreateError: + """Creates the 'NotAuthorized' variant of the myapi.proto.PetsCreateError enum.""" + return myapi.proto.PetsCreateError("NotAuthorized") @staticmethod - def invalid_identity(message: str) -> MyapiProtoPetsCreateError: - """Creates the 'InvalidIdentity' variant of the MyapiProtoPetsCreateError enum.""" - return MyapiProtoPetsCreateError( - MyapiProtoPetsCreateErrorInvalidIdentityVariant(message=message) + def invalid_identity(message: str) -> myapi.proto.PetsCreateError: + """Creates the 'InvalidIdentity' variant of the myapi.proto.PetsCreateError enum.""" + return myapi.proto.PetsCreateError( + myapi.proto.PetsCreateErrorInvalidIdentityVariant(message=message) ) -class MyapiModelKindFactory: - """Factory class for creating MyapiModelKind variants with ergonomic syntax. +class myapi_model_KindFactory: + """Factory class for creating myapi.model.Kind variants with ergonomic syntax. - MyapiModelKind variants + myapi.model.Kind variants """ - BIRD = MyapiModelKindBird() + BIRD = myapi.model.KindBird() @staticmethod - def dog(breed: str) -> MyapiModelKindDog: - """Creates the 'dog' variant of the MyapiModelKind enum.""" - return MyapiModelKindDog(breed=breed) + def dog(breed: str) -> myapi.model.KindDog: + """Creates the 'dog' variant of the myapi.model.Kind enum.""" + return myapi.model.KindDog(breed=breed) @staticmethod - def cat(lives: int) -> MyapiModelKindCat: - """Creates the 'cat' variant of the MyapiModelKind enum.""" - return MyapiModelKindCat(lives=lives) + def cat(lives: int) -> myapi.model.KindCat: + """Creates the 'cat' variant of the myapi.model.Kind enum.""" + return myapi.model.KindCat(lives=lives) -class MyapiProtoPetsListErrorFactory: - """Factory class for creating MyapiProtoPetsListError variants with ergonomic syntax. +class myapi_proto_PetsListErrorFactory: + """Factory class for creating myapi.proto.PetsListError variants with ergonomic syntax. - MyapiProtoPetsListError variants + myapi.proto.PetsListError variants """ - INVALIDCURSOR = MyapiProtoPetsListErrorInvalidCursor() - UNAUTHORIZED = MyapiProtoPetsListErrorUnauthorized() + INVALIDCURSOR = myapi.proto.PetsListErrorInvalidCursor() + UNAUTHORIZED = myapi.proto.PetsListErrorUnauthorized() @staticmethod - def internal(field_0: MyapiProtoInternalError) -> MyapiProtoPetsListErrorInternal: - """Creates the 'Internal' variant of the MyapiProtoPetsListError enum.""" - return MyapiProtoPetsListErrorInternal(field_0=field_0) + def internal( + field_0: myapi.proto.InternalError, + ) -> myapi.proto.PetsListErrorInternal: + """Creates the 'Internal' variant of the myapi.proto.PetsListError enum.""" + return myapi.proto.PetsListErrorInternal(field_0=field_0) -class MyapiProtoValidationErrorFactory: - """Factory class for creating MyapiProtoValidationError variants with ergonomic syntax. +class myapi_proto_ValidationErrorFactory: + """Factory class for creating myapi.proto.ValidationError variants with ergonomic syntax. - MyapiProtoValidationError variants + myapi.proto.ValidationError variants """ @staticmethod - def validation_a(field_0: MyapiProtoValidationA) -> MyapiProtoValidationError: - """Creates the 'ValidationA' variant of the MyapiProtoValidationError enum.""" - return MyapiProtoValidationError( - MyapiProtoValidationErrorValidationAVariant(field_0=field_0) + def validation_a(field_0: myapi.proto.ValidationA) -> myapi.proto.ValidationError: + """Creates the 'ValidationA' variant of the myapi.proto.ValidationError enum.""" + return myapi.proto.ValidationError( + myapi.proto.ValidationErrorValidationAVariant(field_0=field_0) ) -class MyapiProtoPetsUpdateErrorFactory: - """Factory class for creating MyapiProtoPetsUpdateError variants with ergonomic syntax. +class myapi_proto_PetsUpdateErrorFactory: + """Factory class for creating myapi.proto.PetsUpdateError variants with ergonomic syntax. - MyapiProtoPetsUpdateError variants + myapi.proto.PetsUpdateError variants """ @staticmethod - def not_found() -> MyapiProtoPetsUpdateError: - """Creates the 'NotFound' variant of the MyapiProtoPetsUpdateError enum.""" - return MyapiProtoPetsUpdateError("NotFound") + def not_found() -> myapi.proto.PetsUpdateError: + """Creates the 'NotFound' variant of the myapi.proto.PetsUpdateError enum.""" + return myapi.proto.PetsUpdateError("NotFound") @staticmethod - def not_authorized() -> MyapiProtoPetsUpdateError: - """Creates the 'NotAuthorized' variant of the MyapiProtoPetsUpdateError enum.""" - return MyapiProtoPetsUpdateError("NotAuthorized") + def not_authorized() -> myapi.proto.PetsUpdateError: + """Creates the 'NotAuthorized' variant of the myapi.proto.PetsUpdateError enum.""" + return myapi.proto.PetsUpdateError("NotAuthorized") @staticmethod def validation( - field_0: list[MyapiProtoValidationError], - ) -> MyapiProtoPetsUpdateError: - """Creates the 'Validation' variant of the MyapiProtoPetsUpdateError enum.""" - return MyapiProtoPetsUpdateError( - MyapiProtoPetsUpdateErrorValidationVariant(field_0=field_0) + field_0: list[myapi.proto.ValidationError], + ) -> myapi.proto.PetsUpdateError: + """Creates the 'Validation' variant of the myapi.proto.PetsUpdateError enum.""" + return myapi.proto.PetsUpdateError( + myapi.proto.PetsUpdateErrorValidationVariant(field_0=field_0) ) # Testing utilities -def create_myapihealthcheckfail_response( - value: MyapiHealthCheckFail, -) -> ApiResponse[MyapiHealthCheckFail]: - """Create a mock ApiResponse for MyapiHealthCheckFail.""" +def create_myapi_healthcheckfail_response( + value: myapi.HealthCheckFail, +) -> ApiResponse[myapi.HealthCheckFail]: + """Create a mock ApiResponse for myapi.HealthCheckFail.""" return create_api_response(value) -def create_myapimodelbehavior_response( - value: MyapiModelBehavior, -) -> ApiResponse[MyapiModelBehavior]: - """Create a mock ApiResponse for MyapiModelBehavior.""" +def create_myapi_model_behavior_response( + value: myapi.model.Behavior, +) -> ApiResponse[myapi.model.Behavior]: + """Create a mock ApiResponse for myapi.model.Behavior.""" return create_api_response(value) -def create_myapimodelinputpet_response( - value: MyapiModelInputPet, -) -> ApiResponse[MyapiModelInputPet]: - """Create a mock ApiResponse for MyapiModelInputPet.""" +def create_myapi_model_kind_response( + value: myapi.model.Kind, +) -> ApiResponse[myapi.model.Kind]: + """Create a mock ApiResponse for myapi.model.Kind.""" return create_api_response(value) -def create_myapimodelkind_response( - value: MyapiModelKind, -) -> ApiResponse[MyapiModelKind]: - """Create a mock ApiResponse for MyapiModelKind.""" +def create_myapi_model_input_pet_response( + value: myapi.model.input.Pet, +) -> ApiResponse[myapi.model.input.Pet]: + """Create a mock ApiResponse for myapi.model.input.Pet.""" return create_api_response(value) -def create_myapimodeloutputpet_response( - value: MyapiModelOutputPet, -) -> ApiResponse[MyapiModelOutputPet]: - """Create a mock ApiResponse for MyapiModelOutputPet.""" +def create_myapi_model_output_pet_response( + value: myapi.model.output.Pet, +) -> ApiResponse[myapi.model.output.Pet]: + """Create a mock ApiResponse for myapi.model.output.Pet.""" return create_api_response(value) -def create_myapiprotoheaders_response( - value: MyapiProtoHeaders, -) -> ApiResponse[MyapiProtoHeaders]: - """Create a mock ApiResponse for MyapiProtoHeaders.""" +def create_myapi_proto_headers_response( + value: myapi.proto.Headers, +) -> ApiResponse[myapi.proto.Headers]: + """Create a mock ApiResponse for myapi.proto.Headers.""" return create_api_response(value) -def create_myapiprotointernalerror_response( - value: MyapiProtoInternalError, -) -> ApiResponse[MyapiProtoInternalError]: - """Create a mock ApiResponse for MyapiProtoInternalError.""" +def create_myapi_proto_internalerror_response( + value: myapi.proto.InternalError, +) -> ApiResponse[myapi.proto.InternalError]: + """Create a mock ApiResponse for myapi.proto.InternalError.""" return create_api_response(value) -def create_myapiprotopaginated_response( - value: MyapiProtoPaginated, -) -> ApiResponse[MyapiProtoPaginated]: - """Create a mock ApiResponse for MyapiProtoPaginated.""" +def create_myapi_proto_paginated_response( + value: myapi.proto.Paginated, +) -> ApiResponse[myapi.proto.Paginated]: + """Create a mock ApiResponse for myapi.proto.Paginated.""" return create_api_response(value) -def create_myapiprotopetscreateerror_response( - value: MyapiProtoPetsCreateError, -) -> ApiResponse[MyapiProtoPetsCreateError]: - """Create a mock ApiResponse for MyapiProtoPetsCreateError.""" +def create_myapi_proto_petscreateerror_response( + value: myapi.proto.PetsCreateError, +) -> ApiResponse[myapi.proto.PetsCreateError]: + """Create a mock ApiResponse for myapi.proto.PetsCreateError.""" return create_api_response(value) -def create_myapiprotopetslisterror_response( - value: MyapiProtoPetsListError, -) -> ApiResponse[MyapiProtoPetsListError]: - """Create a mock ApiResponse for MyapiProtoPetsListError.""" +def create_myapi_proto_petslisterror_response( + value: myapi.proto.PetsListError, +) -> ApiResponse[myapi.proto.PetsListError]: + """Create a mock ApiResponse for myapi.proto.PetsListError.""" return create_api_response(value) -def create_myapiprotopetslistrequest_response( - value: MyapiProtoPetsListRequest, -) -> ApiResponse[MyapiProtoPetsListRequest]: - """Create a mock ApiResponse for MyapiProtoPetsListRequest.""" +def create_myapi_proto_petslistrequest_response( + value: myapi.proto.PetsListRequest, +) -> ApiResponse[myapi.proto.PetsListRequest]: + """Create a mock ApiResponse for myapi.proto.PetsListRequest.""" return create_api_response(value) -def create_myapiprotopetsremoveerror_response( - value: MyapiProtoPetsRemoveError, -) -> ApiResponse[MyapiProtoPetsRemoveError]: - """Create a mock ApiResponse for MyapiProtoPetsRemoveError.""" +def create_myapi_proto_petsremoveerror_response( + value: myapi.proto.PetsRemoveError, +) -> ApiResponse[myapi.proto.PetsRemoveError]: + """Create a mock ApiResponse for myapi.proto.PetsRemoveError.""" return create_api_response(value) -def create_myapiprotopetsremoverequest_response( - value: MyapiProtoPetsRemoveRequest, -) -> ApiResponse[MyapiProtoPetsRemoveRequest]: - """Create a mock ApiResponse for MyapiProtoPetsRemoveRequest.""" +def create_myapi_proto_petsremoverequest_response( + value: myapi.proto.PetsRemoveRequest, +) -> ApiResponse[myapi.proto.PetsRemoveRequest]: + """Create a mock ApiResponse for myapi.proto.PetsRemoveRequest.""" return create_api_response(value) -def create_myapiprotopetsupdateerror_response( - value: MyapiProtoPetsUpdateError, -) -> ApiResponse[MyapiProtoPetsUpdateError]: - """Create a mock ApiResponse for MyapiProtoPetsUpdateError.""" +def create_myapi_proto_petsupdateerror_response( + value: myapi.proto.PetsUpdateError, +) -> ApiResponse[myapi.proto.PetsUpdateError]: + """Create a mock ApiResponse for myapi.proto.PetsUpdateError.""" return create_api_response(value) -def create_myapiprotopetsupdaterequest_response( - value: MyapiProtoPetsUpdateRequest, -) -> ApiResponse[MyapiProtoPetsUpdateRequest]: - """Create a mock ApiResponse for MyapiProtoPetsUpdateRequest.""" +def create_myapi_proto_petsupdaterequest_response( + value: myapi.proto.PetsUpdateRequest, +) -> ApiResponse[myapi.proto.PetsUpdateRequest]: + """Create a mock ApiResponse for myapi.proto.PetsUpdateRequest.""" return create_api_response(value) -def create_myapiprotovalidationa_response( - value: MyapiProtoValidationA, -) -> ApiResponse[MyapiProtoValidationA]: - """Create a mock ApiResponse for MyapiProtoValidationA.""" +def create_myapi_proto_validationa_response( + value: myapi.proto.ValidationA, +) -> ApiResponse[myapi.proto.ValidationA]: + """Create a mock ApiResponse for myapi.proto.ValidationA.""" return create_api_response(value) -def create_myapiprotovalidationerror_response( - value: MyapiProtoValidationError, -) -> ApiResponse[MyapiProtoValidationError]: - """Create a mock ApiResponse for MyapiProtoValidationError.""" +def create_myapi_proto_validationerror_response( + value: myapi.proto.ValidationError, +) -> ApiResponse[myapi.proto.ValidationError]: + """Create a mock ApiResponse for myapi.proto.ValidationError.""" return create_api_response(value) diff --git a/reflectapi-demo/clients/python/uv.lock b/reflectapi-demo/clients/python/uv.lock new file mode 100644 index 00000000..07ae0558 --- /dev/null +++ b/reflectapi-demo/clients/python/uv.lock @@ -0,0 +1,346 @@ +version = 1 +revision = 3 +requires-python = ">=3.12" + +[[package]] +name = "annotated-types" +version = "0.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081, upload-time = "2024-05-20T21:33:25.928Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" }, +] + +[[package]] +name = "anyio" +version = "4.13.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "idna" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/14/2c5dd9f512b66549ae92767a9c7b330ae88e1932ca57876909410251fe13/anyio-4.13.0.tar.gz", hash = "sha256:334b70e641fd2221c1505b3890c69882fe4a2df910cba14d97019b90b24439dc", size = 231622, upload-time = "2026-03-24T12:59:09.671Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/da/42/e921fccf5015463e32a3cf6ee7f980a6ed0f395ceeaa45060b61d86486c2/anyio-4.13.0-py3-none-any.whl", hash = "sha256:08b310f9e24a9594186fd75b4f73f4a4152069e3853f1ed8bfbf58369f4ad708", size = 114353, upload-time = "2026-03-24T12:59:08.246Z" }, +] + +[[package]] +name = "certifi" +version = "2026.2.25" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/af/2d/7bf41579a8986e348fa033a31cdd0e4121114f6bce2457e8876010b092dd/certifi-2026.2.25.tar.gz", hash = "sha256:e887ab5cee78ea814d3472169153c2d12cd43b14bd03329a39a9c6e2e80bfba7", size = 155029, upload-time = "2026-02-25T02:54:17.342Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9a/3c/c17fb3ca2d9c3acff52e30b309f538586f9f5b9c9cf454f3845fc9af4881/certifi-2026.2.25-py3-none-any.whl", hash = "sha256:027692e4402ad994f1c42e52a4997a9763c646b73e4096e4d5d6db8af1d6f0fa", size = 153684, upload-time = "2026-02-25T02:54:15.766Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "h11" +version = "0.16.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/01/ee/02a2c011bdab74c6fb3c75474d40b3052059d95df7e73351460c8588d963/h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1", size = 101250, upload-time = "2025-04-24T03:35:25.427Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, +] + +[[package]] +name = "httpcore" +version = "1.0.9" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "certifi" }, + { name = "h11" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/94/82699a10bca87a5556c9c59b5963f2d039dbd239f25bc2a63907a05a14cb/httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8", size = 85484, upload-time = "2025-04-24T22:06:22.219Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7e/f5/f66802a942d491edb555dd61e3a9961140fd64c90bce1eafd741609d334d/httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55", size = 78784, upload-time = "2025-04-24T22:06:20.566Z" }, +] + +[[package]] +name = "httpx" +version = "0.28.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "certifi" }, + { name = "httpcore" }, + { name = "idna" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406, upload-time = "2024-12-06T15:37:23.222Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517, upload-time = "2024-12-06T15:37:21.509Z" }, +] + +[[package]] +name = "idna" +version = "3.11" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582, upload-time = "2025-10-12T14:55:20.501Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008, upload-time = "2025-10-12T14:55:18.883Z" }, +] + +[[package]] +name = "iniconfig" +version = "2.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503, upload-time = "2025-10-18T21:55:43.219Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" }, +] + +[[package]] +name = "packaging" +version = "26.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/65/ee/299d360cdc32edc7d2cf530f3accf79c4fca01e96ffc950d8a52213bd8e4/packaging-26.0.tar.gz", hash = "sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4", size = 143416, upload-time = "2026-01-21T20:50:39.064Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b7/b9/c538f279a4e237a006a2c98387d081e9eb060d203d8ed34467cc0f0b9b53/packaging-26.0-py3-none-any.whl", hash = "sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529", size = 74366, upload-time = "2026-01-21T20:50:37.788Z" }, +] + +[[package]] +name = "pluggy" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412, upload-time = "2025-05-15T12:30:07.975Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, +] + +[[package]] +name = "pydantic" +version = "2.12.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "annotated-types" }, + { name = "pydantic-core" }, + { name = "typing-extensions" }, + { name = "typing-inspection" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/69/44/36f1a6e523abc58ae5f928898e4aca2e0ea509b5aa6f6f392a5d882be928/pydantic-2.12.5.tar.gz", hash = "sha256:4d351024c75c0f085a9febbb665ce8c0c6ec5d30e903bdb6394b7ede26aebb49", size = 821591, upload-time = "2025-11-26T15:11:46.471Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5a/87/b70ad306ebb6f9b585f114d0ac2137d792b48be34d732d60e597c2f8465a/pydantic-2.12.5-py3-none-any.whl", hash = "sha256:e561593fccf61e8a20fc46dfc2dfe075b8be7d0188df33f221ad1f0139180f9d", size = 463580, upload-time = "2025-11-26T15:11:44.605Z" }, +] + +[[package]] +name = "pydantic-core" +version = "2.41.5" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/71/70/23b021c950c2addd24ec408e9ab05d59b035b39d97cdc1130e1bce647bb6/pydantic_core-2.41.5.tar.gz", hash = "sha256:08daa51ea16ad373ffd5e7606252cc32f07bc72b28284b6bc9c6df804816476e", size = 460952, upload-time = "2025-11-04T13:43:49.098Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5f/5d/5f6c63eebb5afee93bcaae4ce9a898f3373ca23df3ccaef086d0233a35a7/pydantic_core-2.41.5-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f41a7489d32336dbf2199c8c0a215390a751c5b014c2c1c5366e817202e9cdf7", size = 2110990, upload-time = "2025-11-04T13:39:58.079Z" }, + { url = "https://files.pythonhosted.org/packages/aa/32/9c2e8ccb57c01111e0fd091f236c7b371c1bccea0fa85247ac55b1e2b6b6/pydantic_core-2.41.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:070259a8818988b9a84a449a2a7337c7f430a22acc0859c6b110aa7212a6d9c0", size = 1896003, upload-time = "2025-11-04T13:39:59.956Z" }, + { url = "https://files.pythonhosted.org/packages/68/b8/a01b53cb0e59139fbc9e4fda3e9724ede8de279097179be4ff31f1abb65a/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e96cea19e34778f8d59fe40775a7a574d95816eb150850a85a7a4c8f4b94ac69", size = 1919200, upload-time = "2025-11-04T13:40:02.241Z" }, + { url = "https://files.pythonhosted.org/packages/38/de/8c36b5198a29bdaade07b5985e80a233a5ac27137846f3bc2d3b40a47360/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed2e99c456e3fadd05c991f8f437ef902e00eedf34320ba2b0842bd1c3ca3a75", size = 2052578, upload-time = "2025-11-04T13:40:04.401Z" }, + { url = "https://files.pythonhosted.org/packages/00/b5/0e8e4b5b081eac6cb3dbb7e60a65907549a1ce035a724368c330112adfdd/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:65840751b72fbfd82c3c640cff9284545342a4f1eb1586ad0636955b261b0b05", size = 2208504, upload-time = "2025-11-04T13:40:06.072Z" }, + { url = "https://files.pythonhosted.org/packages/77/56/87a61aad59c7c5b9dc8caad5a41a5545cba3810c3e828708b3d7404f6cef/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e536c98a7626a98feb2d3eaf75944ef6f3dbee447e1f841eae16f2f0a72d8ddc", size = 2335816, upload-time = "2025-11-04T13:40:07.835Z" }, + { url = "https://files.pythonhosted.org/packages/0d/76/941cc9f73529988688a665a5c0ecff1112b3d95ab48f81db5f7606f522d3/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eceb81a8d74f9267ef4081e246ffd6d129da5d87e37a77c9bde550cb04870c1c", size = 2075366, upload-time = "2025-11-04T13:40:09.804Z" }, + { url = "https://files.pythonhosted.org/packages/d3/43/ebef01f69baa07a482844faaa0a591bad1ef129253ffd0cdaa9d8a7f72d3/pydantic_core-2.41.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d38548150c39b74aeeb0ce8ee1d8e82696f4a4e16ddc6de7b1d8823f7de4b9b5", size = 2171698, upload-time = "2025-11-04T13:40:12.004Z" }, + { url = "https://files.pythonhosted.org/packages/b1/87/41f3202e4193e3bacfc2c065fab7706ebe81af46a83d3e27605029c1f5a6/pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:c23e27686783f60290e36827f9c626e63154b82b116d7fe9adba1fda36da706c", size = 2132603, upload-time = "2025-11-04T13:40:13.868Z" }, + { url = "https://files.pythonhosted.org/packages/49/7d/4c00df99cb12070b6bccdef4a195255e6020a550d572768d92cc54dba91a/pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:482c982f814460eabe1d3bb0adfdc583387bd4691ef00b90575ca0d2b6fe2294", size = 2329591, upload-time = "2025-11-04T13:40:15.672Z" }, + { url = "https://files.pythonhosted.org/packages/cc/6a/ebf4b1d65d458f3cda6a7335d141305dfa19bdc61140a884d165a8a1bbc7/pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:bfea2a5f0b4d8d43adf9d7b8bf019fb46fdd10a2e5cde477fbcb9d1fa08c68e1", size = 2319068, upload-time = "2025-11-04T13:40:17.532Z" }, + { url = "https://files.pythonhosted.org/packages/49/3b/774f2b5cd4192d5ab75870ce4381fd89cf218af999515baf07e7206753f0/pydantic_core-2.41.5-cp312-cp312-win32.whl", hash = "sha256:b74557b16e390ec12dca509bce9264c3bbd128f8a2c376eaa68003d7f327276d", size = 1985908, upload-time = "2025-11-04T13:40:19.309Z" }, + { url = "https://files.pythonhosted.org/packages/86/45/00173a033c801cacf67c190fef088789394feaf88a98a7035b0e40d53dc9/pydantic_core-2.41.5-cp312-cp312-win_amd64.whl", hash = "sha256:1962293292865bca8e54702b08a4f26da73adc83dd1fcf26fbc875b35d81c815", size = 2020145, upload-time = "2025-11-04T13:40:21.548Z" }, + { url = "https://files.pythonhosted.org/packages/f9/22/91fbc821fa6d261b376a3f73809f907cec5ca6025642c463d3488aad22fb/pydantic_core-2.41.5-cp312-cp312-win_arm64.whl", hash = "sha256:1746d4a3d9a794cacae06a5eaaccb4b8643a131d45fbc9af23e353dc0a5ba5c3", size = 1976179, upload-time = "2025-11-04T13:40:23.393Z" }, + { url = "https://files.pythonhosted.org/packages/87/06/8806241ff1f70d9939f9af039c6c35f2360cf16e93c2ca76f184e76b1564/pydantic_core-2.41.5-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:941103c9be18ac8daf7b7adca8228f8ed6bb7a1849020f643b3a14d15b1924d9", size = 2120403, upload-time = "2025-11-04T13:40:25.248Z" }, + { url = "https://files.pythonhosted.org/packages/94/02/abfa0e0bda67faa65fef1c84971c7e45928e108fe24333c81f3bfe35d5f5/pydantic_core-2.41.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:112e305c3314f40c93998e567879e887a3160bb8689ef3d2c04b6cc62c33ac34", size = 1896206, upload-time = "2025-11-04T13:40:27.099Z" }, + { url = "https://files.pythonhosted.org/packages/15/df/a4c740c0943e93e6500f9eb23f4ca7ec9bf71b19e608ae5b579678c8d02f/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cbaad15cb0c90aa221d43c00e77bb33c93e8d36e0bf74760cd00e732d10a6a0", size = 1919307, upload-time = "2025-11-04T13:40:29.806Z" }, + { url = "https://files.pythonhosted.org/packages/9a/e3/6324802931ae1d123528988e0e86587c2072ac2e5394b4bc2bc34b61ff6e/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:03ca43e12fab6023fc79d28ca6b39b05f794ad08ec2feccc59a339b02f2b3d33", size = 2063258, upload-time = "2025-11-04T13:40:33.544Z" }, + { url = "https://files.pythonhosted.org/packages/c9/d4/2230d7151d4957dd79c3044ea26346c148c98fbf0ee6ebd41056f2d62ab5/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dc799088c08fa04e43144b164feb0c13f9a0bc40503f8df3e9fde58a3c0c101e", size = 2214917, upload-time = "2025-11-04T13:40:35.479Z" }, + { url = "https://files.pythonhosted.org/packages/e6/9f/eaac5df17a3672fef0081b6c1bb0b82b33ee89aa5cec0d7b05f52fd4a1fa/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:97aeba56665b4c3235a0e52b2c2f5ae9cd071b8a8310ad27bddb3f7fb30e9aa2", size = 2332186, upload-time = "2025-11-04T13:40:37.436Z" }, + { url = "https://files.pythonhosted.org/packages/cf/4e/35a80cae583a37cf15604b44240e45c05e04e86f9cfd766623149297e971/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:406bf18d345822d6c21366031003612b9c77b3e29ffdb0f612367352aab7d586", size = 2073164, upload-time = "2025-11-04T13:40:40.289Z" }, + { url = "https://files.pythonhosted.org/packages/bf/e3/f6e262673c6140dd3305d144d032f7bd5f7497d3871c1428521f19f9efa2/pydantic_core-2.41.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b93590ae81f7010dbe380cdeab6f515902ebcbefe0b9327cc4804d74e93ae69d", size = 2179146, upload-time = "2025-11-04T13:40:42.809Z" }, + { url = "https://files.pythonhosted.org/packages/75/c7/20bd7fc05f0c6ea2056a4565c6f36f8968c0924f19b7d97bbfea55780e73/pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:01a3d0ab748ee531f4ea6c3e48ad9dac84ddba4b0d82291f87248f2f9de8d740", size = 2137788, upload-time = "2025-11-04T13:40:44.752Z" }, + { url = "https://files.pythonhosted.org/packages/3a/8d/34318ef985c45196e004bc46c6eab2eda437e744c124ef0dbe1ff2c9d06b/pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:6561e94ba9dacc9c61bce40e2d6bdc3bfaa0259d3ff36ace3b1e6901936d2e3e", size = 2340133, upload-time = "2025-11-04T13:40:46.66Z" }, + { url = "https://files.pythonhosted.org/packages/9c/59/013626bf8c78a5a5d9350d12e7697d3d4de951a75565496abd40ccd46bee/pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:915c3d10f81bec3a74fbd4faebe8391013ba61e5a1a8d48c4455b923bdda7858", size = 2324852, upload-time = "2025-11-04T13:40:48.575Z" }, + { url = "https://files.pythonhosted.org/packages/1a/d9/c248c103856f807ef70c18a4f986693a46a8ffe1602e5d361485da502d20/pydantic_core-2.41.5-cp313-cp313-win32.whl", hash = "sha256:650ae77860b45cfa6e2cdafc42618ceafab3a2d9a3811fcfbd3bbf8ac3c40d36", size = 1994679, upload-time = "2025-11-04T13:40:50.619Z" }, + { url = "https://files.pythonhosted.org/packages/9e/8b/341991b158ddab181cff136acd2552c9f35bd30380422a639c0671e99a91/pydantic_core-2.41.5-cp313-cp313-win_amd64.whl", hash = "sha256:79ec52ec461e99e13791ec6508c722742ad745571f234ea6255bed38c6480f11", size = 2019766, upload-time = "2025-11-04T13:40:52.631Z" }, + { url = "https://files.pythonhosted.org/packages/73/7d/f2f9db34af103bea3e09735bb40b021788a5e834c81eedb541991badf8f5/pydantic_core-2.41.5-cp313-cp313-win_arm64.whl", hash = "sha256:3f84d5c1b4ab906093bdc1ff10484838aca54ef08de4afa9de0f5f14d69639cd", size = 1981005, upload-time = "2025-11-04T13:40:54.734Z" }, + { url = "https://files.pythonhosted.org/packages/ea/28/46b7c5c9635ae96ea0fbb779e271a38129df2550f763937659ee6c5dbc65/pydantic_core-2.41.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:3f37a19d7ebcdd20b96485056ba9e8b304e27d9904d233d7b1015db320e51f0a", size = 2119622, upload-time = "2025-11-04T13:40:56.68Z" }, + { url = "https://files.pythonhosted.org/packages/74/1a/145646e5687e8d9a1e8d09acb278c8535ebe9e972e1f162ed338a622f193/pydantic_core-2.41.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1d1d9764366c73f996edd17abb6d9d7649a7eb690006ab6adbda117717099b14", size = 1891725, upload-time = "2025-11-04T13:40:58.807Z" }, + { url = "https://files.pythonhosted.org/packages/23/04/e89c29e267b8060b40dca97bfc64a19b2a3cf99018167ea1677d96368273/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25e1c2af0fce638d5f1988b686f3b3ea8cd7de5f244ca147c777769e798a9cd1", size = 1915040, upload-time = "2025-11-04T13:41:00.853Z" }, + { url = "https://files.pythonhosted.org/packages/84/a3/15a82ac7bd97992a82257f777b3583d3e84bdb06ba6858f745daa2ec8a85/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:506d766a8727beef16b7adaeb8ee6217c64fc813646b424d0804d67c16eddb66", size = 2063691, upload-time = "2025-11-04T13:41:03.504Z" }, + { url = "https://files.pythonhosted.org/packages/74/9b/0046701313c6ef08c0c1cf0e028c67c770a4e1275ca73131563c5f2a310a/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4819fa52133c9aa3c387b3328f25c1facc356491e6135b459f1de698ff64d869", size = 2213897, upload-time = "2025-11-04T13:41:05.804Z" }, + { url = "https://files.pythonhosted.org/packages/8a/cd/6bac76ecd1b27e75a95ca3a9a559c643b3afcd2dd62086d4b7a32a18b169/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2b761d210c9ea91feda40d25b4efe82a1707da2ef62901466a42492c028553a2", size = 2333302, upload-time = "2025-11-04T13:41:07.809Z" }, + { url = "https://files.pythonhosted.org/packages/4c/d2/ef2074dc020dd6e109611a8be4449b98cd25e1b9b8a303c2f0fca2f2bcf7/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22f0fb8c1c583a3b6f24df2470833b40207e907b90c928cc8d3594b76f874375", size = 2064877, upload-time = "2025-11-04T13:41:09.827Z" }, + { url = "https://files.pythonhosted.org/packages/18/66/e9db17a9a763d72f03de903883c057b2592c09509ccfe468187f2a2eef29/pydantic_core-2.41.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2782c870e99878c634505236d81e5443092fba820f0373997ff75f90f68cd553", size = 2180680, upload-time = "2025-11-04T13:41:12.379Z" }, + { url = "https://files.pythonhosted.org/packages/d3/9e/3ce66cebb929f3ced22be85d4c2399b8e85b622db77dad36b73c5387f8f8/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0177272f88ab8312479336e1d777f6b124537d47f2123f89cb37e0accea97f90", size = 2138960, upload-time = "2025-11-04T13:41:14.627Z" }, + { url = "https://files.pythonhosted.org/packages/a6/62/205a998f4327d2079326b01abee48e502ea739d174f0a89295c481a2272e/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:63510af5e38f8955b8ee5687740d6ebf7c2a0886d15a6d65c32814613681bc07", size = 2339102, upload-time = "2025-11-04T13:41:16.868Z" }, + { url = "https://files.pythonhosted.org/packages/3c/0d/f05e79471e889d74d3d88f5bd20d0ed189ad94c2423d81ff8d0000aab4ff/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:e56ba91f47764cc14f1daacd723e3e82d1a89d783f0f5afe9c364b8bb491ccdb", size = 2326039, upload-time = "2025-11-04T13:41:18.934Z" }, + { url = "https://files.pythonhosted.org/packages/ec/e1/e08a6208bb100da7e0c4b288eed624a703f4d129bde2da475721a80cab32/pydantic_core-2.41.5-cp314-cp314-win32.whl", hash = "sha256:aec5cf2fd867b4ff45b9959f8b20ea3993fc93e63c7363fe6851424c8a7e7c23", size = 1995126, upload-time = "2025-11-04T13:41:21.418Z" }, + { url = "https://files.pythonhosted.org/packages/48/5d/56ba7b24e9557f99c9237e29f5c09913c81eeb2f3217e40e922353668092/pydantic_core-2.41.5-cp314-cp314-win_amd64.whl", hash = "sha256:8e7c86f27c585ef37c35e56a96363ab8de4e549a95512445b85c96d3e2f7c1bf", size = 2015489, upload-time = "2025-11-04T13:41:24.076Z" }, + { url = "https://files.pythonhosted.org/packages/4e/bb/f7a190991ec9e3e0ba22e4993d8755bbc4a32925c0b5b42775c03e8148f9/pydantic_core-2.41.5-cp314-cp314-win_arm64.whl", hash = "sha256:e672ba74fbc2dc8eea59fb6d4aed6845e6905fc2a8afe93175d94a83ba2a01a0", size = 1977288, upload-time = "2025-11-04T13:41:26.33Z" }, + { url = "https://files.pythonhosted.org/packages/92/ed/77542d0c51538e32e15afe7899d79efce4b81eee631d99850edc2f5e9349/pydantic_core-2.41.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8566def80554c3faa0e65ac30ab0932b9e3a5cd7f8323764303d468e5c37595a", size = 2120255, upload-time = "2025-11-04T13:41:28.569Z" }, + { url = "https://files.pythonhosted.org/packages/bb/3d/6913dde84d5be21e284439676168b28d8bbba5600d838b9dca99de0fad71/pydantic_core-2.41.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b80aa5095cd3109962a298ce14110ae16b8c1aece8b72f9dafe81cf597ad80b3", size = 1863760, upload-time = "2025-11-04T13:41:31.055Z" }, + { url = "https://files.pythonhosted.org/packages/5a/f0/e5e6b99d4191da102f2b0eb9687aaa7f5bea5d9964071a84effc3e40f997/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3006c3dd9ba34b0c094c544c6006cc79e87d8612999f1a5d43b769b89181f23c", size = 1878092, upload-time = "2025-11-04T13:41:33.21Z" }, + { url = "https://files.pythonhosted.org/packages/71/48/36fb760642d568925953bcc8116455513d6e34c4beaa37544118c36aba6d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72f6c8b11857a856bcfa48c86f5368439f74453563f951e473514579d44aa612", size = 2053385, upload-time = "2025-11-04T13:41:35.508Z" }, + { url = "https://files.pythonhosted.org/packages/20/25/92dc684dd8eb75a234bc1c764b4210cf2646479d54b47bf46061657292a8/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5cb1b2f9742240e4bb26b652a5aeb840aa4b417c7748b6f8387927bc6e45e40d", size = 2218832, upload-time = "2025-11-04T13:41:37.732Z" }, + { url = "https://files.pythonhosted.org/packages/e2/09/f53e0b05023d3e30357d82eb35835d0f6340ca344720a4599cd663dca599/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd3d54f38609ff308209bd43acea66061494157703364ae40c951f83ba99a1a9", size = 2327585, upload-time = "2025-11-04T13:41:40Z" }, + { url = "https://files.pythonhosted.org/packages/aa/4e/2ae1aa85d6af35a39b236b1b1641de73f5a6ac4d5a7509f77b814885760c/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ff4321e56e879ee8d2a879501c8e469414d948f4aba74a2d4593184eb326660", size = 2041078, upload-time = "2025-11-04T13:41:42.323Z" }, + { url = "https://files.pythonhosted.org/packages/cd/13/2e215f17f0ef326fc72afe94776edb77525142c693767fc347ed6288728d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0d2568a8c11bf8225044aa94409e21da0cb09dcdafe9ecd10250b2baad531a9", size = 2173914, upload-time = "2025-11-04T13:41:45.221Z" }, + { url = "https://files.pythonhosted.org/packages/02/7a/f999a6dcbcd0e5660bc348a3991c8915ce6599f4f2c6ac22f01d7a10816c/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:a39455728aabd58ceabb03c90e12f71fd30fa69615760a075b9fec596456ccc3", size = 2129560, upload-time = "2025-11-04T13:41:47.474Z" }, + { url = "https://files.pythonhosted.org/packages/3a/b1/6c990ac65e3b4c079a4fb9f5b05f5b013afa0f4ed6780a3dd236d2cbdc64/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:239edca560d05757817c13dc17c50766136d21f7cd0fac50295499ae24f90fdf", size = 2329244, upload-time = "2025-11-04T13:41:49.992Z" }, + { url = "https://files.pythonhosted.org/packages/d9/02/3c562f3a51afd4d88fff8dffb1771b30cfdfd79befd9883ee094f5b6c0d8/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:2a5e06546e19f24c6a96a129142a75cee553cc018ffee48a460059b1185f4470", size = 2331955, upload-time = "2025-11-04T13:41:54.079Z" }, + { url = "https://files.pythonhosted.org/packages/5c/96/5fb7d8c3c17bc8c62fdb031c47d77a1af698f1d7a406b0f79aaa1338f9ad/pydantic_core-2.41.5-cp314-cp314t-win32.whl", hash = "sha256:b4ececa40ac28afa90871c2cc2b9ffd2ff0bf749380fbdf57d165fd23da353aa", size = 1988906, upload-time = "2025-11-04T13:41:56.606Z" }, + { url = "https://files.pythonhosted.org/packages/22/ed/182129d83032702912c2e2d8bbe33c036f342cc735737064668585dac28f/pydantic_core-2.41.5-cp314-cp314t-win_amd64.whl", hash = "sha256:80aa89cad80b32a912a65332f64a4450ed00966111b6615ca6816153d3585a8c", size = 1981607, upload-time = "2025-11-04T13:41:58.889Z" }, + { url = "https://files.pythonhosted.org/packages/9f/ed/068e41660b832bb0b1aa5b58011dea2a3fe0ba7861ff38c4d4904c1c1a99/pydantic_core-2.41.5-cp314-cp314t-win_arm64.whl", hash = "sha256:35b44f37a3199f771c3eaa53051bc8a70cd7b54f333531c59e29fd4db5d15008", size = 1974769, upload-time = "2025-11-04T13:42:01.186Z" }, + { url = "https://files.pythonhosted.org/packages/09/32/59b0c7e63e277fa7911c2fc70ccfb45ce4b98991e7ef37110663437005af/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:7da7087d756b19037bc2c06edc6c170eeef3c3bafcb8f532ff17d64dc427adfd", size = 2110495, upload-time = "2025-11-04T13:42:49.689Z" }, + { url = "https://files.pythonhosted.org/packages/aa/81/05e400037eaf55ad400bcd318c05bb345b57e708887f07ddb2d20e3f0e98/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:aabf5777b5c8ca26f7824cb4a120a740c9588ed58df9b2d196ce92fba42ff8dc", size = 1915388, upload-time = "2025-11-04T13:42:52.215Z" }, + { url = "https://files.pythonhosted.org/packages/6e/0d/e3549b2399f71d56476b77dbf3cf8937cec5cd70536bdc0e374a421d0599/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c007fe8a43d43b3969e8469004e9845944f1a80e6acd47c150856bb87f230c56", size = 1942879, upload-time = "2025-11-04T13:42:56.483Z" }, + { url = "https://files.pythonhosted.org/packages/f7/07/34573da085946b6a313d7c42f82f16e8920bfd730665de2d11c0c37a74b5/pydantic_core-2.41.5-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:76d0819de158cd855d1cbb8fcafdf6f5cf1eb8e470abe056d5d161106e38062b", size = 2139017, upload-time = "2025-11-04T13:42:59.471Z" }, +] + +[[package]] +name = "pygments" +version = "2.19.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631, upload-time = "2025-06-21T13:39:12.283Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217, upload-time = "2025-06-21T13:39:07.939Z" }, +] + +[[package]] +name = "pytest" +version = "9.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d1/db/7ef3487e0fb0049ddb5ce41d3a49c235bf9ad299b6a25d5780a89f19230f/pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11", size = 1568901, upload-time = "2025-12-06T21:30:51.014Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801, upload-time = "2025-12-06T21:30:49.154Z" }, +] + +[[package]] +name = "pytest-asyncio" +version = "1.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pytest" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/90/2c/8af215c0f776415f3590cac4f9086ccefd6fd463befeae41cd4d3f193e5a/pytest_asyncio-1.3.0.tar.gz", hash = "sha256:d7f52f36d231b80ee124cd216ffb19369aa168fc10095013c6b014a34d3ee9e5", size = 50087, upload-time = "2025-11-10T16:07:47.256Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e5/35/f8b19922b6a25bc0880171a2f1a003eaeb93657475193ab516fd87cac9da/pytest_asyncio-1.3.0-py3-none-any.whl", hash = "sha256:611e26147c7f77640e6d0a92a38ed17c3e9848063698d5c93d5aa7aa11cebff5", size = 15075, upload-time = "2025-11-10T16:07:45.537Z" }, +] + +[[package]] +name = "reflectapi-demo-python-client" +version = "0.1.0" +source = { editable = "." } +dependencies = [ + { name = "reflectapi-runtime" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-asyncio" }, + { name = "ruff" }, +] + +[package.metadata] +requires-dist = [{ name = "reflectapi-runtime", editable = "../../../reflectapi-python-runtime" }] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.0.0" }, + { name = "pytest-asyncio", specifier = ">=0.21.0" }, + { name = "ruff", specifier = ">=0.12.5" }, +] + +[[package]] +name = "reflectapi-runtime" +version = "0.1.0" +source = { editable = "../../../reflectapi-python-runtime" } +dependencies = [ + { name = "httpx" }, + { name = "pydantic" }, +] + +[package.metadata] +requires-dist = [ + { name = "httpx", specifier = ">=0.25.0" }, + { name = "hypothesis", marker = "extra == 'dev'", specifier = ">=6.0.0" }, + { name = "hypothesis", marker = "extra == 'test'", specifier = ">=6.0.0" }, + { name = "mypy", marker = "extra == 'dev'", specifier = ">=1.5.0" }, + { name = "pydantic", specifier = ">=2.0.0" }, + { name = "pytest", marker = "extra == 'dev'", specifier = ">=7.0.0" }, + { name = "pytest", marker = "extra == 'test'", specifier = ">=7.0.0" }, + { name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.21.0" }, + { name = "pytest-asyncio", marker = "extra == 'test'", specifier = ">=0.21.0" }, + { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=4.0.0" }, + { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.1.0" }, +] +provides-extras = ["dev", "test"] + +[package.metadata.requires-dev] +dev = [ + { name = "mypy", specifier = ">=1.17.0" }, + { name = "pytest", specifier = ">=8.4.1" }, + { name = "pytest-asyncio", specifier = ">=1.1.0" }, + { name = "pytest-cov", specifier = ">=6.2.1" }, + { name = "ruff", specifier = ">=0.12.5" }, + { name = "ty", specifier = ">=0.0.1a16" }, +] + +[[package]] +name = "ruff" +version = "0.15.8" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/14/b0/73cf7550861e2b4824950b8b52eebdcc5adc792a00c514406556c5b80817/ruff-0.15.8.tar.gz", hash = "sha256:995f11f63597ee362130d1d5a327a87cb6f3f5eae3094c620bcc632329a4d26e", size = 4610921, upload-time = "2026-03-26T18:39:38.675Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4a/92/c445b0cd6da6e7ae51e954939cb69f97e008dbe750cfca89b8cedc081be7/ruff-0.15.8-py3-none-linux_armv6l.whl", hash = "sha256:cbe05adeba76d58162762d6b239c9056f1a15a55bd4b346cfd21e26cd6ad7bc7", size = 10527394, upload-time = "2026-03-26T18:39:41.566Z" }, + { url = "https://files.pythonhosted.org/packages/eb/92/f1c662784d149ad1414cae450b082cf736430c12ca78367f20f5ed569d65/ruff-0.15.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:d3e3d0b6ba8dca1b7ef9ab80a28e840a20070c4b62e56d675c24f366ef330570", size = 10905693, upload-time = "2026-03-26T18:39:30.364Z" }, + { url = "https://files.pythonhosted.org/packages/ca/f2/7a631a8af6d88bcef997eb1bf87cc3da158294c57044aafd3e17030613de/ruff-0.15.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:6ee3ae5c65a42f273f126686353f2e08ff29927b7b7e203b711514370d500de3", size = 10323044, upload-time = "2026-03-26T18:39:33.37Z" }, + { url = "https://files.pythonhosted.org/packages/67/18/1bf38e20914a05e72ef3b9569b1d5c70a7ef26cd188d69e9ca8ef588d5bf/ruff-0.15.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fdce027ada77baa448077ccc6ebb2fa9c3c62fd110d8659d601cf2f475858d94", size = 10629135, upload-time = "2026-03-26T18:39:44.142Z" }, + { url = "https://files.pythonhosted.org/packages/d2/e9/138c150ff9af60556121623d41aba18b7b57d95ac032e177b6a53789d279/ruff-0.15.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:12e617fc01a95e5821648a6df341d80456bd627bfab8a829f7cfc26a14a4b4a3", size = 10348041, upload-time = "2026-03-26T18:39:52.178Z" }, + { url = "https://files.pythonhosted.org/packages/02/f1/5bfb9298d9c323f842c5ddeb85f1f10ef51516ac7a34ba446c9347d898df/ruff-0.15.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:432701303b26416d22ba696c39f2c6f12499b89093b61360abc34bcc9bf07762", size = 11121987, upload-time = "2026-03-26T18:39:55.195Z" }, + { url = "https://files.pythonhosted.org/packages/10/11/6da2e538704e753c04e8d86b1fc55712fdbdcc266af1a1ece7a51fff0d10/ruff-0.15.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d910ae974b7a06a33a057cb87d2a10792a3b2b3b35e33d2699fdf63ec8f6b17a", size = 11951057, upload-time = "2026-03-26T18:39:19.18Z" }, + { url = "https://files.pythonhosted.org/packages/83/f0/c9208c5fd5101bf87002fed774ff25a96eea313d305f1e5d5744698dc314/ruff-0.15.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2033f963c43949d51e6fdccd3946633c6b37c484f5f98c3035f49c27395a8ab8", size = 11464613, upload-time = "2026-03-26T18:40:06.301Z" }, + { url = "https://files.pythonhosted.org/packages/f8/22/d7f2fabdba4fae9f3b570e5605d5eb4500dcb7b770d3217dca4428484b17/ruff-0.15.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0f29b989a55572fb885b77464cf24af05500806ab4edf9a0fd8977f9759d85b1", size = 11257557, upload-time = "2026-03-26T18:39:57.972Z" }, + { url = "https://files.pythonhosted.org/packages/71/8c/382a9620038cf6906446b23ce8632ab8c0811b8f9d3e764f58bedd0c9a6f/ruff-0.15.8-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:ac51d486bf457cdc985a412fb1801b2dfd1bd8838372fc55de64b1510eff4bec", size = 11169440, upload-time = "2026-03-26T18:39:22.205Z" }, + { url = "https://files.pythonhosted.org/packages/4d/0d/0994c802a7eaaf99380085e4e40c845f8e32a562e20a38ec06174b52ef24/ruff-0.15.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c9861eb959edab053c10ad62c278835ee69ca527b6dcd72b47d5c1e5648964f6", size = 10605963, upload-time = "2026-03-26T18:39:46.682Z" }, + { url = "https://files.pythonhosted.org/packages/19/aa/d624b86f5b0aad7cef6bbf9cd47a6a02dfdc4f72c92a337d724e39c9d14b/ruff-0.15.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8d9a5b8ea13f26ae90838afc33f91b547e61b794865374f114f349e9036835fb", size = 10357484, upload-time = "2026-03-26T18:39:49.176Z" }, + { url = "https://files.pythonhosted.org/packages/35/c3/e0b7835d23001f7d999f3895c6b569927c4d39912286897f625736e1fd04/ruff-0.15.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c2a33a529fb3cbc23a7124b5c6ff121e4d6228029cba374777bd7649cc8598b8", size = 10830426, upload-time = "2026-03-26T18:40:03.702Z" }, + { url = "https://files.pythonhosted.org/packages/f0/51/ab20b322f637b369383adc341d761eaaa0f0203d6b9a7421cd6e783d81b9/ruff-0.15.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:75e5cd06b1cf3f47a3996cfc999226b19aa92e7cce682dcd62f80d7035f98f49", size = 11345125, upload-time = "2026-03-26T18:39:27.799Z" }, + { url = "https://files.pythonhosted.org/packages/37/e6/90b2b33419f59d0f2c4c8a48a4b74b460709a557e8e0064cf33ad894f983/ruff-0.15.8-py3-none-win32.whl", hash = "sha256:bc1f0a51254ba21767bfa9a8b5013ca8149dcf38092e6a9eb704d876de94dc34", size = 10571959, upload-time = "2026-03-26T18:39:36.117Z" }, + { url = "https://files.pythonhosted.org/packages/1f/a2/ef467cb77099062317154c63f234b8a7baf7cb690b99af760c5b68b9ee7f/ruff-0.15.8-py3-none-win_amd64.whl", hash = "sha256:04f79eff02a72db209d47d665ba7ebcad609d8918a134f86cb13dd132159fc89", size = 11743893, upload-time = "2026-03-26T18:39:25.01Z" }, + { url = "https://files.pythonhosted.org/packages/15/e2/77be4fff062fa78d9b2a4dea85d14785dac5f1d0c1fb58ed52331f0ebe28/ruff-0.15.8-py3-none-win_arm64.whl", hash = "sha256:cf891fa8e3bb430c0e7fac93851a5978fc99c8fa2c053b57b118972866f8e5f2", size = 11048175, upload-time = "2026-03-26T18:40:01.06Z" }, +] + +[[package]] +name = "typing-extensions" +version = "4.15.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391, upload-time = "2025-08-25T13:49:26.313Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" }, +] + +[[package]] +name = "typing-inspection" +version = "0.4.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949, upload-time = "2025-10-01T02:14:41.687Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611, upload-time = "2025-10-01T02:14:40.154Z" }, +] diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap index 0b644ae4..8364088f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap @@ -35,6 +35,21 @@ class ReflectapiDemoTestsBasicStructWithDeprecatedField(BaseModel): h: int = Field(serialization_alias="_h", validation_alias="_h") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + StructWithDeprecatedField = ( + ReflectapiDemoTestsBasicStructWithDeprecatedField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +58,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicStructWithDeprecatedField] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicStructWithDeprecatedField]: + data: Optional[reflectapi_demo.tests.basic.StructWithDeprecatedField] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.StructWithDeprecatedField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicStructWithDeprecatedField]: Response containing ReflectapiDemoTestsBasicStructWithDeprecatedField data + ApiResponse[reflectapi_demo.tests.basic.StructWithDeprecatedField]: Response containing reflectapi_demo.tests.basic.StructWithDeprecatedField data """ path = "/inout_test" @@ -61,7 +76,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicStructWithDeprecatedField, + response_model=reflectapi_demo.tests.basic.StructWithDeprecatedField, ) @@ -86,15 +101,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicStructWithDeprecatedField] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicStructWithDeprecatedField]: + data: Optional[reflectapi_demo.tests.basic.StructWithDeprecatedField] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.StructWithDeprecatedField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicStructWithDeprecatedField]: Response containing ReflectapiDemoTestsBasicStructWithDeprecatedField data + ApiResponse[reflectapi_demo.tests.basic.StructWithDeprecatedField]: Response containing reflectapi_demo.tests.basic.StructWithDeprecatedField data """ path = "/inout_test" @@ -104,7 +119,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicStructWithDeprecatedField, + response_model=reflectapi_demo.tests.basic.StructWithDeprecatedField, ) @@ -129,7 +144,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicStructWithDeprecatedField.model_rebuild() + reflectapi_demo.tests.basic.StructWithDeprecatedField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +154,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicstructwithdeprecatedfield_response( - value: ReflectapiDemoTestsBasicStructWithDeprecatedField, -) -> ApiResponse[ReflectapiDemoTestsBasicStructWithDeprecatedField]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicStructWithDeprecatedField.""" +def create_reflectapi_demo_tests_basic_structwithdeprecatedfield_response( + value: reflectapi_demo.tests.basic.StructWithDeprecatedField, +) -> ApiResponse[reflectapi_demo.tests.basic.StructWithDeprecatedField]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.StructWithDeprecatedField.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap index e139a64a..81a64347 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap @@ -120,6 +120,29 @@ class ReflectapiDemoTestsBasicTestEnumDocumented( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + T = T + TestEnumDocumentedVariant1Variant = ( + ReflectapiDemoTestsBasicTestEnumDocumentedVariant1Variant + ) + TestEnumDocumentedVariant2Variant = ( + ReflectapiDemoTestsBasicTestEnumDocumentedVariant2Variant + ) + TestEnumDocumentedVariants = ( + ReflectapiDemoTestsBasicTestEnumDocumentedVariants + ) + TestEnumDocumented = ReflectapiDemoTestsBasicTestEnumDocumented + + class AsyncInputClient: """Async client for input_ operations.""" @@ -128,7 +151,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestEnumDocumented[int]] = None, + data: Optional[reflectapi_demo.tests.basic.TestEnumDocumented[int]] = None, ) -> ApiResponse[Any]: """ @@ -171,7 +194,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestEnumDocumented[int]] = None, + data: Optional[reflectapi_demo.tests.basic.TestEnumDocumented[int]] = None, ) -> ApiResponse[Any]: """ @@ -214,34 +237,34 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestEnumDocumented.model_rebuild() + reflectapi_demo.tests.basic.TestEnumDocumented.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsBasicTestEnumDocumentedFactory: - """Factory class for creating ReflectapiDemoTestsBasicTestEnumDocumented variants with ergonomic syntax. +class reflectapi_demo_tests_basic_TestEnumDocumentedFactory: + """Factory class for creating reflectapi_demo.tests.basic.TestEnumDocumented variants with ergonomic syntax. Some Enum docs more """ @staticmethod - def variant1(field_0: T) -> ReflectapiDemoTestsBasicTestEnumDocumented[T]: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsBasicTestEnumDocumented enum.""" - return ReflectapiDemoTestsBasicTestEnumDocumented( - ReflectapiDemoTestsBasicTestEnumDocumentedVariant1Variant[T]( + def variant1(field_0: T) -> reflectapi_demo.tests.basic.TestEnumDocumented[T]: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.basic.TestEnumDocumented enum.""" + return reflectapi_demo.tests.basic.TestEnumDocumented( + reflectapi_demo.tests.basic.TestEnumDocumentedVariant1Variant[T]( field_0=field_0 ) ) @staticmethod - def variant2(named_field: T) -> ReflectapiDemoTestsBasicTestEnumDocumented[T]: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsBasicTestEnumDocumented enum.""" - return ReflectapiDemoTestsBasicTestEnumDocumented( - ReflectapiDemoTestsBasicTestEnumDocumentedVariant2Variant[T]( + def variant2(named_field: T) -> reflectapi_demo.tests.basic.TestEnumDocumented[T]: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.basic.TestEnumDocumented enum.""" + return reflectapi_demo.tests.basic.TestEnumDocumented( + reflectapi_demo.tests.basic.TestEnumDocumentedVariant2Variant[T]( named_field=named_field ) ) @@ -250,10 +273,10 @@ class ReflectapiDemoTestsBasicTestEnumDocumentedFactory: # Testing utilities -def create_reflectapidemotestsbasictestenumdocumented_response( - value: ReflectapiDemoTestsBasicTestEnumDocumented, -) -> ApiResponse[ReflectapiDemoTestsBasicTestEnumDocumented]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestEnumDocumented.""" +def create_reflectapi_demo_tests_basic_testenumdocumented_response( + value: reflectapi_demo.tests.basic.TestEnumDocumented, +) -> ApiResponse[reflectapi_demo.tests.basic.TestEnumDocumented]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestEnumDocumented.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap index ad213c69..6ba6e5d3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap @@ -40,6 +40,35 @@ class ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant(str, Enum): O = "O" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithSkipVariant = ( + ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant + ) + A = A + I = I + + class output: + """Namespace for output types.""" + + TestEnumWithSkipVariant = ( + ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant + ) + A = A + O = O + + class AsyncInoutClient: """Async client for inout operations.""" @@ -48,15 +77,17 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant]: + data: Optional[ + reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant]: Response containing ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant data + ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: Response containing reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant data """ path = "/inout_test" @@ -66,7 +97,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant, + response_model=reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant, ) @@ -91,15 +122,17 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant]: + data: Optional[ + reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant]: Response containing ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant data + ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: Response containing reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant data """ path = "/inout_test" @@ -109,7 +142,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant, + response_model=reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant, ) @@ -134,8 +167,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant.model_rebuild() - ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant.model_rebuild() + reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant.model_rebuild() + reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -145,17 +178,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicinputtestenumwithskipvariant_response( - value: ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant, -) -> ApiResponse[ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant.""" +def create_reflectapi_demo_tests_basic_input_testenumwithskipvariant_response( + value: reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant, +) -> ApiResponse[reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant.""" return create_api_response(value) -def create_reflectapidemotestsbasicoutputtestenumwithskipvariant_response( - value: ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant, -) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant.""" +def create_reflectapi_demo_tests_basic_output_testenumwithskipvariant_response( + value: reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant, +) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap index 45a62884..23d14461 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap @@ -35,6 +35,19 @@ class ReflectapiDemoTestsBasicTestStructDocumented(BaseModel): f: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructDocumented = ReflectapiDemoTestsBasicTestStructDocumented + + class AsyncInputClient: """Async client for input_ operations.""" @@ -43,7 +56,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructDocumented] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructDocumented] = None, ) -> ApiResponse[Any]: """ @@ -86,7 +99,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructDocumented] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructDocumented] = None, ) -> ApiResponse[Any]: """ @@ -129,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructDocumented.model_rebuild() + reflectapi_demo.tests.basic.TestStructDocumented.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructdocumented_response( - value: ReflectapiDemoTestsBasicTestStructDocumented, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructDocumented]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructDocumented.""" +def create_reflectapi_demo_tests_basic_teststructdocumented_response( + value: reflectapi_demo.tests.basic.TestStructDocumented, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructDocumented]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructDocumented.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap index b3e15219..37cf89da 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap @@ -31,6 +31,19 @@ class ReflectapiDemoTestsBasicTestStructEmpty(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructEmpty = ReflectapiDemoTestsBasicTestStructEmpty + + class AsyncInoutClient: """Async client for inout operations.""" @@ -39,15 +52,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructEmpty] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructEmpty]: + data: Optional[reflectapi_demo.tests.basic.TestStructEmpty] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructEmpty]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructEmpty]: Response containing ReflectapiDemoTestsBasicTestStructEmpty data + ApiResponse[reflectapi_demo.tests.basic.TestStructEmpty]: Response containing reflectapi_demo.tests.basic.TestStructEmpty data """ path = "/inout_test" @@ -57,7 +70,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructEmpty, + response_model=reflectapi_demo.tests.basic.TestStructEmpty, ) @@ -82,15 +95,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructEmpty] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructEmpty]: + data: Optional[reflectapi_demo.tests.basic.TestStructEmpty] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructEmpty]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructEmpty]: Response containing ReflectapiDemoTestsBasicTestStructEmpty data + ApiResponse[reflectapi_demo.tests.basic.TestStructEmpty]: Response containing reflectapi_demo.tests.basic.TestStructEmpty data """ path = "/inout_test" @@ -100,7 +113,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructEmpty, + response_model=reflectapi_demo.tests.basic.TestStructEmpty, ) @@ -125,7 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructEmpty.model_rebuild() + reflectapi_demo.tests.basic.TestStructEmpty.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -135,10 +148,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructempty_response( - value: ReflectapiDemoTestsBasicTestStructEmpty, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructEmpty]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructEmpty.""" +def create_reflectapi_demo_tests_basic_teststructempty_response( + value: reflectapi_demo.tests.basic.TestStructEmpty, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructEmpty]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructEmpty.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap index 4dc4723d..51800b93 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr(BaseModel): f: str = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldStaticStr = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr + ) + + class AsyncOutputClient: """Async client for output operations.""" @@ -41,11 +56,11 @@ class AsyncOutputClient: async def test( self, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr]: """ Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr]: Response containing ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr data + ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr]: Response containing reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr data """ path = "/output_test" @@ -54,7 +69,7 @@ class AsyncOutputClient: "POST", path, params=params if params else None, - response_model=ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr, + response_model=reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr, ) @@ -79,11 +94,11 @@ class OutputClient: def test( self, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr]: """ Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr]: Response containing ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr data + ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr]: Response containing reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr data """ path = "/output_test" @@ -92,7 +107,7 @@ class OutputClient: "POST", path, params=params if params else None, - response_model=ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr, + response_model=reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr, ) @@ -117,7 +132,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr.model_rebuild() + reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -127,10 +142,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructonebasicfieldstaticstr_response( - value: ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr.""" +def create_reflectapi_demo_tests_basic_teststructonebasicfieldstaticstr_response( + value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap index e3f12ea8..6385fcbe 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldString(BaseModel): f: str = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldString = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldString + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -41,7 +56,9 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructOneBasicFieldString] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldString + ] = None, ) -> ApiResponse[Any]: """ @@ -84,7 +101,9 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructOneBasicFieldString] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldString + ] = None, ) -> ApiResponse[Any]: """ @@ -127,7 +146,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructOneBasicFieldString.model_rebuild() + reflectapi_demo.tests.basic.TestStructOneBasicFieldString.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +156,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructonebasicfieldstring_response( - value: ReflectapiDemoTestsBasicTestStructOneBasicFieldString, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldString]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructOneBasicFieldString.""" +def create_reflectapi_demo_tests_basic_teststructonebasicfieldstring_response( + value: reflectapi_demo.tests.basic.TestStructOneBasicFieldString, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldString]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldString.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap index 9c776eab..61f8d500 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth(BaseModel f: str = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldStringReflectBoth = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,16 +57,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth]: + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth]: Response containing ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth data + ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: Response containing reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth data """ path = "/inout_test" @@ -61,7 +78,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth, + response_model=reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth, ) @@ -87,16 +104,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth]: + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth]: Response containing ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth data + ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: Response containing reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth data """ path = "/inout_test" @@ -106,7 +125,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth, + response_model=reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth, ) @@ -131,7 +150,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth.model_rebuild() + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -141,10 +160,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructonebasicfieldstringreflectboth_response( - value: ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth.""" +def create_reflectapi_demo_tests_basic_teststructonebasicfieldstringreflectboth_response( + value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap index 9083d6c7..d5034188 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap @@ -35,6 +35,21 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldStringReflectBothEqually = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -44,10 +59,10 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ] = None, ) -> ApiResponse[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ]: """ @@ -55,7 +70,7 @@ class AsyncInoutClient: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually]: Response containing ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually data + ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually]: Response containing reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually data """ path = "/inout_test" @@ -65,7 +80,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually, + response_model=reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually, ) @@ -91,10 +106,10 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ] = None, ) -> ApiResponse[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ]: """ @@ -102,7 +117,7 @@ class InoutClient: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually]: Response containing ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually data + ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually]: Response containing reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually data """ path = "/inout_test" @@ -112,7 +127,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually, + response_model=reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually, ) @@ -137,7 +152,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually.model_rebuild() + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -147,12 +162,12 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructonebasicfieldstringreflectbothequally_response( - value: ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually, +def create_reflectapi_demo_tests_basic_teststructonebasicfieldstringreflectbothequally_response( + value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually, ) -> ApiResponse[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually.""" + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap index c707126d..58e343c1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap @@ -35,6 +35,21 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldStringReflectBothEqually = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -44,7 +59,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ] = None, ) -> ApiResponse[Any]: """ @@ -89,7 +104,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ] = None, ) -> ApiResponse[Any]: """ @@ -133,7 +148,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually.model_rebuild() + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -143,12 +158,12 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructonebasicfieldstringreflectbothequally_response( - value: ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually, +def create_reflectapi_demo_tests_basic_teststructonebasicfieldstringreflectbothequally_response( + value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually, ) -> ApiResponse[ - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually ]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually.""" + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap index 2e448b75..2c1bbc11 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap @@ -45,6 +45,27 @@ class ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDiff f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructOneBasicFieldStringReflectBothDifferently = ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently + + class output: + """Namespace for output types.""" + + TestStructOneBasicFieldStringReflectBothDifferently = ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently + + class AsyncInoutClient: """Async client for inout operations.""" @@ -54,10 +75,10 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently + reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently ] = None, ) -> ApiResponse[ - ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently + reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently ]: """ @@ -65,7 +86,7 @@ class AsyncInoutClient: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently]: Response containing ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently]: Response containing reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently data """ path = "/inout_test" @@ -75,7 +96,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently, + response_model=reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently, ) @@ -101,10 +122,10 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently + reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently ] = None, ) -> ApiResponse[ - ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently + reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently ]: """ @@ -112,7 +133,7 @@ class InoutClient: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently]: Response containing ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently]: Response containing reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently data """ path = "/inout_test" @@ -122,7 +143,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently, + response_model=reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently, ) @@ -147,8 +168,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() - ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() + reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -158,21 +179,21 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicinputteststructonebasicfieldstringreflectbothdifferently_response( - value: ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently, +def create_reflectapi_demo_tests_basic_input_teststructonebasicfieldstringreflectbothdifferently_response( + value: reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently, ) -> ApiResponse[ - ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently + reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently ]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently.""" + """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently.""" return create_api_response(value) -def create_reflectapidemotestsbasicoutputteststructonebasicfieldstringreflectbothdifferently_response( - value: ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently, +def create_reflectapi_demo_tests_basic_output_teststructonebasicfieldstringreflectbothdifferently_response( + value: reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently, ) -> ApiResponse[ - ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently + reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently ]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently.""" + """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap index ceacd550..a71d467c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructOneBasicFieldU32(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldU32 = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldU32 + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -41,7 +56,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructOneBasicFieldU32] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldU32] = None, ) -> ApiResponse[Any]: """ @@ -84,7 +99,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructOneBasicFieldU32] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldU32] = None, ) -> ApiResponse[Any]: """ @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructOneBasicFieldU32.model_rebuild() + reflectapi_demo.tests.basic.TestStructOneBasicFieldU32.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructonebasicfieldu32_response( - value: ReflectapiDemoTestsBasicTestStructOneBasicFieldU32, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOneBasicFieldU32]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructOneBasicFieldU32.""" +def create_reflectapi_demo_tests_basic_teststructonebasicfieldu32_response( + value: reflectapi_demo.tests.basic.TestStructOneBasicFieldU32, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldU32]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldU32.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap index 5d6cc2c7..5ff0434e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap @@ -34,6 +34,19 @@ class ReflectapiDemoTestsBasicTestStructOption(BaseModel): f: int | None = Field(default=None, serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOption = ReflectapiDemoTestsBasicTestStructOption + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,15 +55,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructOption] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOption]: + data: Optional[reflectapi_demo.tests.basic.TestStructOption] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOption]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOption]: Response containing ReflectapiDemoTestsBasicTestStructOption data + ApiResponse[reflectapi_demo.tests.basic.TestStructOption]: Response containing reflectapi_demo.tests.basic.TestStructOption data """ path = "/inout_test" @@ -60,7 +73,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructOption, + response_model=reflectapi_demo.tests.basic.TestStructOption, ) @@ -85,15 +98,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructOption] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOption]: + data: Optional[reflectapi_demo.tests.basic.TestStructOption] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOption]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructOption]: Response containing ReflectapiDemoTestsBasicTestStructOption data + ApiResponse[reflectapi_demo.tests.basic.TestStructOption]: Response containing reflectapi_demo.tests.basic.TestStructOption data """ path = "/inout_test" @@ -103,7 +116,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructOption, + response_model=reflectapi_demo.tests.basic.TestStructOption, ) @@ -128,7 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructOption.model_rebuild() + reflectapi_demo.tests.basic.TestStructOption.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -138,10 +151,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructoption_response( - value: ReflectapiDemoTestsBasicTestStructOption, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructOption]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructOption.""" +def create_reflectapi_demo_tests_basic_teststructoption_response( + value: reflectapi_demo.tests.basic.TestStructOption, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOption]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOption.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap index 335bc671..fddba93f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap @@ -34,6 +34,18 @@ class ReflectapiDemoTestsBasicTestStructTuple(BaseModel): 1: str +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + TestStructTuple = ReflectapiDemoTestsBasicTestStructTuple + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,15 +54,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructTuple] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructTuple]: + data: Optional[reflectapi_demo.tests.basic.TestStructTuple] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructTuple]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructTuple]: Response containing ReflectapiDemoTestsBasicTestStructTuple data + ApiResponse[reflectapi_demo.tests.basic.TestStructTuple]: Response containing reflectapi_demo.tests.basic.TestStructTuple data """ path = "/inout_test" @@ -60,7 +72,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructTuple, + response_model=reflectapi_demo.tests.basic.TestStructTuple, ) @@ -86,15 +98,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructTuple] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructTuple]: + data: Optional[reflectapi_demo.tests.basic.TestStructTuple] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructTuple]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructTuple]: Response containing ReflectapiDemoTestsBasicTestStructTuple data + ApiResponse[reflectapi_demo.tests.basic.TestStructTuple]: Response containing reflectapi_demo.tests.basic.TestStructTuple data """ path = "/inout_test" @@ -104,7 +116,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructTuple, + response_model=reflectapi_demo.tests.basic.TestStructTuple, ) @@ -130,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructTuple.model_rebuild() + reflectapi_demo.tests.basic.TestStructTuple.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -140,8 +152,8 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructtuple_response(value: ReflectapiDemoTestsBasicTestStructTuple) -> ApiResponse[ReflectapiDemoTestsBasicTestStructTuple]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructTuple.""" +def create_reflectapi_demo_tests_basic_teststructtuple_response(value: reflectapi_demo.tests.basic.TestStructTuple) -> ApiResponse[reflectapi_demo.tests.basic.TestStructTuple]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructTuple.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap index 18f2661b..7748dcfe 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap @@ -44,8 +44,24 @@ class ReflectapiDemoTestsBasicTest(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) us: list[None] - xs: list[ReflectapiDemoTestsBasicX] - ys: list[ReflectapiDemoTestsBasicY] + xs: list[reflectapi_demo.tests.basic.X] + ys: list[reflectapi_demo.tests.basic.Y] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + X = ReflectapiDemoTestsBasicX + Y = ReflectapiDemoTestsBasicY + Y = Y + Test = ReflectapiDemoTestsBasicTest class AsyncInoutClient: @@ -56,15 +72,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTest]: + data: Optional[reflectapi_demo.tests.basic.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTest]: Response containing ReflectapiDemoTestsBasicTest data + ApiResponse[reflectapi_demo.tests.basic.Test]: Response containing reflectapi_demo.tests.basic.Test data """ path = "/inout_test" @@ -74,7 +90,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTest, + response_model=reflectapi_demo.tests.basic.Test, ) @@ -99,15 +115,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTest]: + data: Optional[reflectapi_demo.tests.basic.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTest]: Response containing ReflectapiDemoTestsBasicTest data + ApiResponse[reflectapi_demo.tests.basic.Test]: Response containing reflectapi_demo.tests.basic.Test data """ path = "/inout_test" @@ -117,7 +133,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTest, + response_model=reflectapi_demo.tests.basic.Test, ) @@ -142,9 +158,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTest.model_rebuild() - ReflectapiDemoTestsBasicX.model_rebuild() - ReflectapiDemoTestsBasicY.model_rebuild() + reflectapi_demo.tests.basic.Test.model_rebuild() + reflectapi_demo.tests.basic.X.model_rebuild() + reflectapi_demo.tests.basic.Y.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -154,24 +170,24 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasictest_response( - value: ReflectapiDemoTestsBasicTest, -) -> ApiResponse[ReflectapiDemoTestsBasicTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTest.""" +def create_reflectapi_demo_tests_basic_test_response( + value: reflectapi_demo.tests.basic.Test, +) -> ApiResponse[reflectapi_demo.tests.basic.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.Test.""" return create_api_response(value) -def create_reflectapidemotestsbasicx_response( - value: ReflectapiDemoTestsBasicX, -) -> ApiResponse[ReflectapiDemoTestsBasicX]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicX.""" +def create_reflectapi_demo_tests_basic_x_response( + value: reflectapi_demo.tests.basic.X, +) -> ApiResponse[reflectapi_demo.tests.basic.X]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.X.""" return create_api_response(value) -def create_reflectapidemotestsbasicy_response( - value: ReflectapiDemoTestsBasicY, -) -> ApiResponse[ReflectapiDemoTestsBasicY]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicY.""" +def create_reflectapi_demo_tests_basic_y_response( + value: reflectapi_demo.tests.basic.Y, +) -> ApiResponse[reflectapi_demo.tests.basic.Y]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.Y.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap index 84b4a475..de60d3e1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap @@ -59,37 +59,37 @@ class ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields(BaseModel): f_hashset: bytes = Field( serialization_alias="_f_hashset", validation_alias="_f_hashset" ) - f_tuple: StdTupleTuple2[int, str] = Field( + f_tuple: std.tuple.Tuple2[int, str] = Field( serialization_alias="_f_tuple", validation_alias="_f_tuple" ) - f_tuple3: StdTupleTuple3[int, str, int] = Field( + f_tuple3: std.tuple.Tuple3[int, str, int] = Field( serialization_alias="_f_tuple3", validation_alias="_f_tuple3" ) - f_tuple4: StdTupleTuple4[int, str, int, str] = Field( + f_tuple4: std.tuple.Tuple4[int, str, int, str] = Field( serialization_alias="_f_tuple4", validation_alias="_f_tuple4" ) - f_tuple5: StdTupleTuple5[int, str, int, str, int] = Field( + f_tuple5: std.tuple.Tuple5[int, str, int, str, int] = Field( serialization_alias="_f_tuple5", validation_alias="_f_tuple5" ) - f_tuple6: StdTupleTuple6[int, str, int, str, int, str] = Field( + f_tuple6: std.tuple.Tuple6[int, str, int, str, int, str] = Field( serialization_alias="_f_tuple6", validation_alias="_f_tuple6" ) - f_tuple7: StdTupleTuple7[int, str, int, str, int, str, int] = Field( + f_tuple7: std.tuple.Tuple7[int, str, int, str, int, str, int] = Field( serialization_alias="_f_tuple7", validation_alias="_f_tuple7" ) - f_tuple8: StdTupleTuple8[int, str, int, str, int, str, int, str] = Field( + f_tuple8: std.tuple.Tuple8[int, str, int, str, int, str, int, str] = Field( serialization_alias="_f_tuple8", validation_alias="_f_tuple8" ) - f_tuple9: StdTupleTuple9[int, str, int, str, int, str, int, str, int] = Field( + f_tuple9: std.tuple.Tuple9[int, str, int, str, int, str, int, str, int] = Field( serialization_alias="_f_tuple9", validation_alias="_f_tuple9" ) - f_tuple10: StdTupleTuple10[int, str, int, str, int, str, int, str, int, str] = ( + f_tuple10: std.tuple.Tuple10[int, str, int, str, int, str, int, str, int, str] = ( Field(serialization_alias="_f_tuple10", validation_alias="_f_tuple10") ) - f_tuple11: StdTupleTuple11[ + f_tuple11: std.tuple.Tuple11[ int, str, int, str, int, str, int, str, int, str, int ] = Field(serialization_alias="_f_tuple11", validation_alias="_f_tuple11") - f_tuple12: StdTupleTuple12[ + f_tuple12: std.tuple.Tuple12[ int, str, int, str, int, str, int, str, int, str, int, str ] = Field(serialization_alias="_f_tuple12", validation_alias="_f_tuple12") f_array: bytes = Field(serialization_alias="_f_array", validation_alias="_f_array") @@ -114,7 +114,7 @@ class ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields(BaseModel): f_pointer_weak: int = Field( serialization_alias="_f_pointer_weak", validation_alias="_f_pointer_weak" ) - f_phantomdata: StdMarkerPhantomData[int] = Field( + f_phantomdata: std.marker.PhantomData[int] = Field( serialization_alias="_f_phantomdata", validation_alias="_f_phantomdata" ) f_infallible: ReflectapiInfallible = Field( @@ -122,6 +122,21 @@ class ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithAllPrimitiveTypeFields = ( + ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -131,16 +146,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields + reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields]: Response containing ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: Response containing reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields data """ path = "/inout_test" @@ -150,7 +165,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields, + response_model=reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields, ) @@ -176,16 +191,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields + reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields]: Response containing ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: Response containing reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields data """ path = "/inout_test" @@ -195,7 +210,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields, + response_model=reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields, ) @@ -220,7 +235,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -230,10 +245,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithallprimitivetypefields_response( - value: ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields.""" +def create_reflectapi_demo_tests_basic_teststructwithallprimitivetypefields_response( + value: reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap index 26585d35..dfa5d819 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap @@ -33,6 +33,19 @@ class ReflectapiDemoTestsBasicTestStructWithArc(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithArc = ReflectapiDemoTestsBasicTestStructWithArc + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +54,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithArc] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithArc]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithArc] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArc]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithArc]: Response containing ReflectapiDemoTestsBasicTestStructWithArc data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithArc]: Response containing reflectapi_demo.tests.basic.TestStructWithArc data """ path = "/inout_test" @@ -59,7 +72,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithArc, + response_model=reflectapi_demo.tests.basic.TestStructWithArc, ) @@ -84,15 +97,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithArc] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithArc]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithArc] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArc]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithArc]: Response containing ReflectapiDemoTestsBasicTestStructWithArc data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithArc]: Response containing reflectapi_demo.tests.basic.TestStructWithArc data """ path = "/inout_test" @@ -102,7 +115,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithArc, + response_model=reflectapi_demo.tests.basic.TestStructWithArc, ) @@ -127,7 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithArc.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithArc.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +150,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwitharc_response( - value: ReflectapiDemoTestsBasicTestStructWithArc, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithArc]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithArc.""" +def create_reflectapi_demo_tests_basic_teststructwitharc_response( + value: reflectapi_demo.tests.basic.TestStructWithArc, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArc]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithArc.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap index 216fd73c..032dcaca 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap @@ -35,6 +35,21 @@ class ReflectapiDemoTestsBasicTestStructWithArcPointerOnly(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithArcPointerOnly = ( + ReflectapiDemoTestsBasicTestStructWithArcPointerOnly + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +58,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithArcPointerOnly] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithArcPointerOnly]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithArcPointerOnly]: Response containing ReflectapiDemoTestsBasicTestStructWithArcPointerOnly data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly]: Response containing reflectapi_demo.tests.basic.TestStructWithArcPointerOnly data """ path = "/inout_test" @@ -61,7 +76,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithArcPointerOnly, + response_model=reflectapi_demo.tests.basic.TestStructWithArcPointerOnly, ) @@ -86,15 +101,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithArcPointerOnly] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithArcPointerOnly]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithArcPointerOnly]: Response containing ReflectapiDemoTestsBasicTestStructWithArcPointerOnly data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly]: Response containing reflectapi_demo.tests.basic.TestStructWithArcPointerOnly data """ path = "/inout_test" @@ -104,7 +119,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithArcPointerOnly, + response_model=reflectapi_demo.tests.basic.TestStructWithArcPointerOnly, ) @@ -129,7 +144,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithArcPointerOnly.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithArcPointerOnly.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +154,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwitharcpointeronly_response( - value: ReflectapiDemoTestsBasicTestStructWithArcPointerOnly, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithArcPointerOnly]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithArcPointerOnly.""" +def create_reflectapi_demo_tests_basic_teststructwitharcpointeronly_response( + value: reflectapi_demo.tests.basic.TestStructWithArcPointerOnly, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithArcPointerOnly.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap index 1a6b8429..61248284 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly(BaseModel): f: str = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithAttributesInputOnly = ( + ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,14 +57,14 @@ class AsyncInoutClient: async def test( self, data: Optional[str] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly]: Response containing ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly]: Response containing reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly data """ path = "/inout_test" @@ -59,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_data=data, - response_model=ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly, + response_model=reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly, ) @@ -85,14 +100,14 @@ class InoutClient: def test( self, data: Optional[str] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly]: Response containing ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly]: Response containing reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly data """ path = "/inout_test" @@ -102,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_data=data, - response_model=ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly, + response_model=reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly, ) @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithattributesinputonly_response( - value: ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly.""" +def create_reflectapi_demo_tests_basic_teststructwithattributesinputonly_response( + value: reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap index 163576ae..f685b5ab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly(BaseModel): f: str = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithAttributesOutputOnly = ( + ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,7 +57,7 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly + reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly ] = None, ) -> ApiResponse[str]: """ @@ -87,7 +102,7 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly + reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly ] = None, ) -> ApiResponse[str]: """ @@ -131,7 +146,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -141,10 +156,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithattributesoutputonly_response( - value: ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly.""" +def create_reflectapi_demo_tests_basic_teststructwithattributesoutputonly_response( + value: reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap index c2aeff1e..0af5f5a7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback(BaseMode data: dict[str, int] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithExternalGenericTypeFallback = ( + ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,16 +57,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback]: + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback]: Response containing ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: Response containing reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback data """ path = "/inout_test" @@ -61,7 +78,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback, + response_model=reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback, ) @@ -87,16 +104,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback]: + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback]: Response containing ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: Response containing reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback data """ path = "/inout_test" @@ -106,7 +125,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback, + response_model=reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback, ) @@ -131,7 +150,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -141,10 +160,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithexternalgenerictypefallback_response( - value: ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback.""" +def create_reflectapi_demo_tests_basic_teststructwithexternalgenerictypefallback_response( + value: reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap index 9c3cc1be..558388c5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithFixedSizeArray(BaseModel): f: bytes = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithFixedSizeArray = ( + ReflectapiDemoTestsBasicTestStructWithFixedSizeArray + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithFixedSizeArray] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithFixedSizeArray]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithFixedSizeArray]: Response containing ReflectapiDemoTestsBasicTestStructWithFixedSizeArray data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray]: Response containing reflectapi_demo.tests.basic.TestStructWithFixedSizeArray data """ path = "/inout_test" @@ -59,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithFixedSizeArray, + response_model=reflectapi_demo.tests.basic.TestStructWithFixedSizeArray, ) @@ -84,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithFixedSizeArray] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithFixedSizeArray]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithFixedSizeArray]: Response containing ReflectapiDemoTestsBasicTestStructWithFixedSizeArray data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray]: Response containing reflectapi_demo.tests.basic.TestStructWithFixedSizeArray data """ path = "/inout_test" @@ -102,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithFixedSizeArray, + response_model=reflectapi_demo.tests.basic.TestStructWithFixedSizeArray, ) @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithFixedSizeArray.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithFixedSizeArray.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithfixedsizearray_response( - value: ReflectapiDemoTestsBasicTestStructWithFixedSizeArray, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithFixedSizeArray]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithFixedSizeArray.""" +def create_reflectapi_demo_tests_basic_teststructwithfixedsizearray_response( + value: reflectapi_demo.tests.basic.TestStructWithFixedSizeArray, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithFixedSizeArray.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap index 3ec4638f..e6a1f34d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap @@ -33,6 +33,19 @@ class ReflectapiDemoTestsBasicTestStructWithHashMap(BaseModel): f: dict[int, str] = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithHashMap = ReflectapiDemoTestsBasicTestStructWithHashMap + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +54,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithHashMap] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashMap]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithHashMap] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashMap]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashMap]: Response containing ReflectapiDemoTestsBasicTestStructWithHashMap data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashMap]: Response containing reflectapi_demo.tests.basic.TestStructWithHashMap data """ path = "/inout_test" @@ -59,7 +72,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithHashMap, + response_model=reflectapi_demo.tests.basic.TestStructWithHashMap, ) @@ -84,15 +97,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithHashMap] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashMap]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithHashMap] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashMap]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashMap]: Response containing ReflectapiDemoTestsBasicTestStructWithHashMap data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashMap]: Response containing reflectapi_demo.tests.basic.TestStructWithHashMap data """ path = "/inout_test" @@ -102,7 +115,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithHashMap, + response_model=reflectapi_demo.tests.basic.TestStructWithHashMap, ) @@ -127,7 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithHashMap.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithHashMap.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +150,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithhashmap_response( - value: ReflectapiDemoTestsBasicTestStructWithHashMap, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashMap]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithHashMap.""" +def create_reflectapi_demo_tests_basic_teststructwithhashmap_response( + value: reflectapi_demo.tests.basic.TestStructWithHashMap, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashMap]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithHashMap.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap index 4ab1aa0d..d59c7e24 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap @@ -35,6 +35,21 @@ class ReflectapiDemoTestsBasicTestStructWithHashSetField(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithHashSetField = ( + ReflectapiDemoTestsBasicTestStructWithHashSetField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +58,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithHashSetField] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetField]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithHashSetField] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetField]: Response containing ReflectapiDemoTestsBasicTestStructWithHashSetField data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetField]: Response containing reflectapi_demo.tests.basic.TestStructWithHashSetField data """ path = "/inout_test" @@ -61,7 +76,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithHashSetField, + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetField, ) @@ -86,15 +101,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithHashSetField] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetField]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithHashSetField] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetField]: Response containing ReflectapiDemoTestsBasicTestStructWithHashSetField data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetField]: Response containing reflectapi_demo.tests.basic.TestStructWithHashSetField data """ path = "/inout_test" @@ -104,7 +119,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithHashSetField, + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetField, ) @@ -129,7 +144,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithHashSetField.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithHashSetField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +154,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithhashsetfield_response( - value: ReflectapiDemoTestsBasicTestStructWithHashSetField, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetField]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithHashSetField.""" +def create_reflectapi_demo_tests_basic_teststructwithhashsetfield_response( + value: reflectapi_demo.tests.basic.TestStructWithHashSetField, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetField]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithHashSetField.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap index 6c15280d..72d90627 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap @@ -41,6 +41,21 @@ class ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric(BaseModel, Gener ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithHashSetFieldGeneric = ( + ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -50,16 +65,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str] + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str]]: + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str]]: Response containing ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str] data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]]: Response containing reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] data """ path = "/inout_test" @@ -69,7 +86,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[ + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[ str ], ) @@ -97,16 +114,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str] + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str]]: + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str]]: Response containing ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[str] data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]]: Response containing reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] data """ path = "/inout_test" @@ -116,7 +135,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric[ + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[ str ], ) @@ -143,7 +162,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -153,10 +172,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithhashsetfieldgeneric_response( - value: ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric.""" +def create_reflectapi_demo_tests_basic_teststructwithhashsetfieldgeneric_response( + value: reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap index 8494e79f..1fce7bb2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap @@ -38,11 +38,25 @@ class ReflectapiDemoTestsBasicTestStructWithNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsBasicTestStructNested = Field( + f: reflectapi_demo.tests.basic.TestStructNested = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructNested = ReflectapiDemoTestsBasicTestStructNested + TestStructWithNested = ReflectapiDemoTestsBasicTestStructWithNested + + class AsyncInoutClient: """Async client for inout operations.""" @@ -51,15 +65,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithNested] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithNested]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithNested] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNested]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithNested]: Response containing ReflectapiDemoTestsBasicTestStructWithNested data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithNested]: Response containing reflectapi_demo.tests.basic.TestStructWithNested data """ path = "/inout_test" @@ -69,7 +83,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithNested, + response_model=reflectapi_demo.tests.basic.TestStructWithNested, ) @@ -94,15 +108,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithNested] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithNested]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithNested] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNested]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithNested]: Response containing ReflectapiDemoTestsBasicTestStructWithNested data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithNested]: Response containing reflectapi_demo.tests.basic.TestStructWithNested data """ path = "/inout_test" @@ -112,7 +126,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithNested, + response_model=reflectapi_demo.tests.basic.TestStructWithNested, ) @@ -137,8 +151,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructNested.model_rebuild() - ReflectapiDemoTestsBasicTestStructWithNested.model_rebuild() + reflectapi_demo.tests.basic.TestStructNested.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +162,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructnested_response( - value: ReflectapiDemoTestsBasicTestStructNested, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructNested.""" +def create_reflectapi_demo_tests_basic_teststructnested_response( + value: reflectapi_demo.tests.basic.TestStructNested, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructNested.""" return create_api_response(value) -def create_reflectapidemotestsbasicteststructwithnested_response( - value: ReflectapiDemoTestsBasicTestStructWithNested, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithNested.""" +def create_reflectapi_demo_tests_basic_teststructwithnested_response( + value: reflectapi_demo.tests.basic.TestStructWithNested, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithNested.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap index 7fb841a2..48359eb5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap @@ -38,11 +38,31 @@ class ReflectapiDemoTestsBasicTestStructWithNestedExternal(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsTestLibTestStructNested = Field( + f: reflectapi_demo.tests.test_lib.TestStructNested = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class test_lib: + """Namespace for test_lib types.""" + + TestStructNested = ReflectapiDemoTestsTestLibTestStructNested + + class basic: + """Namespace for basic types.""" + + TestStructWithNestedExternal = ( + ReflectapiDemoTestsBasicTestStructWithNestedExternal + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -51,15 +71,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithNestedExternal] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithNestedExternal]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithNestedExternal] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNestedExternal]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithNestedExternal]: Response containing ReflectapiDemoTestsBasicTestStructWithNestedExternal data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithNestedExternal]: Response containing reflectapi_demo.tests.basic.TestStructWithNestedExternal data """ path = "/inout_test" @@ -69,7 +89,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithNestedExternal, + response_model=reflectapi_demo.tests.basic.TestStructWithNestedExternal, ) @@ -94,15 +114,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithNestedExternal] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithNestedExternal]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithNestedExternal] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNestedExternal]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithNestedExternal]: Response containing ReflectapiDemoTestsBasicTestStructWithNestedExternal data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithNestedExternal]: Response containing reflectapi_demo.tests.basic.TestStructWithNestedExternal data """ path = "/inout_test" @@ -112,7 +132,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithNestedExternal, + response_model=reflectapi_demo.tests.basic.TestStructWithNestedExternal, ) @@ -137,8 +157,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithNestedExternal.model_rebuild() - ReflectapiDemoTestsTestLibTestStructNested.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithNestedExternal.model_rebuild() + reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +168,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithnestedexternal_response( - value: ReflectapiDemoTestsBasicTestStructWithNestedExternal, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithNestedExternal]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithNestedExternal.""" +def create_reflectapi_demo_tests_basic_teststructwithnestedexternal_response( + value: reflectapi_demo.tests.basic.TestStructWithNestedExternal, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNestedExternal]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithNestedExternal.""" return create_api_response(value) -def create_reflectapidemoteststestlibteststructnested_response( - value: ReflectapiDemoTestsTestLibTestStructNested, -) -> ApiResponse[ReflectapiDemoTestsTestLibTestStructNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsTestLibTestStructNested.""" +def create_reflectapi_demo_tests_test_lib_teststructnested_response( + value: reflectapi_demo.tests.test_lib.TestStructNested, +) -> ApiResponse[reflectapi_demo.tests.test_lib.TestStructNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.test_lib.TestStructNested.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap index 0da1cef3..11b35713 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap @@ -30,11 +30,24 @@ class ReflectapiDemoTestsBasicTestStructWithSelfViaArc(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsBasicTestStructWithSelfViaArc = Field( + f: reflectapi_demo.tests.basic.TestStructWithSelfViaArc = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithSelfViaArc = ReflectapiDemoTestsBasicTestStructWithSelfViaArc + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithSelfViaArc] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithSelfViaArc]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithSelfViaArc] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSelfViaArc]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithSelfViaArc]: Response containing ReflectapiDemoTestsBasicTestStructWithSelfViaArc data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithSelfViaArc]: Response containing reflectapi_demo.tests.basic.TestStructWithSelfViaArc data """ path = "/inout_test" @@ -61,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithSelfViaArc, + response_model=reflectapi_demo.tests.basic.TestStructWithSelfViaArc, ) @@ -86,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithSelfViaArc] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithSelfViaArc]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithSelfViaArc] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSelfViaArc]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithSelfViaArc]: Response containing ReflectapiDemoTestsBasicTestStructWithSelfViaArc data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithSelfViaArc]: Response containing reflectapi_demo.tests.basic.TestStructWithSelfViaArc data """ path = "/inout_test" @@ -104,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithSelfViaArc, + response_model=reflectapi_demo.tests.basic.TestStructWithSelfViaArc, ) @@ -129,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithSelfViaArc.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithSelfViaArc.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithselfviaarc_response( - value: ReflectapiDemoTestsBasicTestStructWithSelfViaArc, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithSelfViaArc]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithSelfViaArc.""" +def create_reflectapi_demo_tests_basic_teststructwithselfviaarc_response( + value: reflectapi_demo.tests.basic.TestStructWithSelfViaArc, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSelfViaArc]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithSelfViaArc.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap index 1b4a2e4f..97231dd1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap @@ -31,6 +31,19 @@ class ReflectapiDemoTestsBasicTestStructWithSkipField(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithSkipField = ReflectapiDemoTestsBasicTestStructWithSkipField + + class AsyncInoutClient: """Async client for inout operations.""" @@ -39,15 +52,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithSkipField] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithSkipField]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithSkipField] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSkipField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithSkipField]: Response containing ReflectapiDemoTestsBasicTestStructWithSkipField data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithSkipField]: Response containing reflectapi_demo.tests.basic.TestStructWithSkipField data """ path = "/inout_test" @@ -57,7 +70,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithSkipField, + response_model=reflectapi_demo.tests.basic.TestStructWithSkipField, ) @@ -82,15 +95,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithSkipField] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithSkipField]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithSkipField] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSkipField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithSkipField]: Response containing ReflectapiDemoTestsBasicTestStructWithSkipField data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithSkipField]: Response containing reflectapi_demo.tests.basic.TestStructWithSkipField data """ path = "/inout_test" @@ -100,7 +113,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithSkipField, + response_model=reflectapi_demo.tests.basic.TestStructWithSkipField, ) @@ -125,7 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithSkipField.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithSkipField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -135,10 +148,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithskipfield_response( - value: ReflectapiDemoTestsBasicTestStructWithSkipField, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithSkipField]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithSkipField.""" +def create_reflectapi_demo_tests_basic_teststructwithskipfield_response( + value: reflectapi_demo.tests.basic.TestStructWithSkipField, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSkipField]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithSkipField.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap index 8aacadc3..80addd5a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap @@ -39,6 +39,31 @@ class ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSkipFieldInput = ( + ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput + ) + + class output: + """Namespace for output types.""" + + TestStructWithSkipFieldInput = ( + ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -48,16 +73,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput data """ path = "/inout_test" @@ -67,7 +92,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput, ) @@ -93,16 +118,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput data """ path = "/inout_test" @@ -112,7 +137,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput, ) @@ -137,8 +162,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput.model_rebuild() - ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput.model_rebuild() + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +173,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicinputteststructwithskipfieldinput_response( - value: ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput, -) -> ApiResponse[ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput.""" +def create_reflectapi_demo_tests_basic_input_teststructwithskipfieldinput_response( + value: reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput, +) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput.""" return create_api_response(value) -def create_reflectapidemotestsbasicoutputteststructwithskipfieldinput_response( - value: ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput, -) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput.""" +def create_reflectapi_demo_tests_basic_output_teststructwithskipfieldinput_response( + value: reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput, +) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap index 89907177..fd8a5d42 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap @@ -39,6 +39,31 @@ class ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class output: + """Namespace for output types.""" + + TestStructWithSkipFieldOutput = ( + ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput + ) + + class input: + """Namespace for input types.""" + + TestStructWithSkipFieldOutput = ( + ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -48,16 +73,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput data """ path = "/inout_test" @@ -67,7 +92,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput, ) @@ -93,16 +118,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput data """ path = "/inout_test" @@ -112,7 +137,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput, ) @@ -137,8 +162,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput.model_rebuild() - ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput.model_rebuild() + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +173,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicinputteststructwithskipfieldoutput_response( - value: ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput, -) -> ApiResponse[ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput.""" +def create_reflectapi_demo_tests_basic_input_teststructwithskipfieldoutput_response( + value: reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput, +) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput.""" return create_api_response(value) -def create_reflectapidemotestsbasicoutputteststructwithskipfieldoutput_response( - value: ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput, -) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput.""" +def create_reflectapi_demo_tests_basic_output_teststructwithskipfieldoutput_response( + value: reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput, +) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap index 943380af..a646c2e0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithTransformArray(BaseModel): f: bytes = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformArray = ( + ReflectapiDemoTestsBasicTestStructWithTransformArray + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTransformArray] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformArray]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformArray] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformArray]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformArray]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformArray data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformArray]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformArray data """ path = "/inout_test" @@ -59,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformArray, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformArray, ) @@ -84,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTransformArray] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformArray]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformArray] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformArray]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformArray]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformArray data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformArray]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformArray data """ path = "/inout_test" @@ -102,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformArray, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformArray, ) @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithTransformArray.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithTransformArray.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithtransformarray_response( - value: ReflectapiDemoTestsBasicTestStructWithTransformArray, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformArray]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithTransformArray.""" +def create_reflectapi_demo_tests_basic_teststructwithtransformarray_response( + value: reflectapi_demo.tests.basic.TestStructWithTransformArray, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformArray]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformArray.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap index b4497e0c..f49c339d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithTransformBoth(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformBoth = ( + ReflectapiDemoTestsBasicTestStructWithTransformBoth + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTransformBoth] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformBoth]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformBoth] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformBoth]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformBoth]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformBoth data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformBoth]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformBoth data """ path = "/inout_test" @@ -59,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformBoth, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformBoth, ) @@ -84,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTransformBoth] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformBoth]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformBoth] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformBoth]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformBoth]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformBoth data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformBoth]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformBoth data """ path = "/inout_test" @@ -102,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformBoth, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformBoth, ) @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithTransformBoth.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithTransformBoth.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithtransformboth_response( - value: ReflectapiDemoTestsBasicTestStructWithTransformBoth, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformBoth]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithTransformBoth.""" +def create_reflectapi_demo_tests_basic_teststructwithtransformboth_response( + value: reflectapi_demo.tests.basic.TestStructWithTransformBoth, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformBoth]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformBoth.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap index 2cf400f9..f054e077 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithTransformFallback(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformFallback = ( + ReflectapiDemoTestsBasicTestStructWithTransformFallback + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +56,17 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTransformFallback] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallback]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithTransformFallback + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallback]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformFallback data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformFallback data """ path = "/inout_test" @@ -59,7 +76,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformFallback, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformFallback, ) @@ -84,15 +101,17 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTransformFallback] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallback]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithTransformFallback + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallback]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformFallback data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformFallback data """ path = "/inout_test" @@ -102,7 +121,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformFallback, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformFallback, ) @@ -127,7 +146,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithTransformFallback.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithTransformFallback.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +156,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithtransformfallback_response( - value: ReflectapiDemoTestsBasicTestStructWithTransformFallback, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallback]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithTransformFallback.""" +def create_reflectapi_demo_tests_basic_teststructwithtransformfallback_response( + value: reflectapi_demo.tests.basic.TestStructWithTransformFallback, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformFallback.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap index 3fc75ec2..fde2fe04 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformFallbackNested = ( + ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,16 +57,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested + reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested data """ path = "/inout_test" @@ -61,7 +76,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested, ) @@ -87,16 +102,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested + reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested]: + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested]: Response containing ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: Response containing reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested data """ path = "/inout_test" @@ -106,7 +121,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested, + response_model=reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested, ) @@ -131,7 +146,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -141,10 +156,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithtransformfallbacknested_response( - value: ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested.""" +def create_reflectapi_demo_tests_basic_teststructwithtransformfallbacknested_response( + value: reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap index 292ff821..793a2748 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap @@ -41,6 +41,31 @@ class ReflectapiDemoTestsBasicOutputTestStructWithTransformInput(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructWithTransformInput = ( + ReflectapiDemoTestsBasicInputTestStructWithTransformInput + ) + + class output: + """Namespace for output types.""" + + TestStructWithTransformInput = ( + ReflectapiDemoTestsBasicOutputTestStructWithTransformInput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -50,16 +75,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithTransformInput + reflectapi_demo.tests.basic.input.TestStructWithTransformInput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformInput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformInput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithTransformInput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithTransformInput data """ path = "/inout_test" @@ -69,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithTransformInput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithTransformInput, ) @@ -95,16 +120,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithTransformInput + reflectapi_demo.tests.basic.input.TestStructWithTransformInput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformInput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformInput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithTransformInput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithTransformInput data """ path = "/inout_test" @@ -114,7 +139,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithTransformInput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithTransformInput, ) @@ -139,8 +164,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicInputTestStructWithTransformInput.model_rebuild() - ReflectapiDemoTestsBasicOutputTestStructWithTransformInput.model_rebuild() + reflectapi_demo.tests.basic.input.TestStructWithTransformInput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithTransformInput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -150,17 +175,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicinputteststructwithtransforminput_response( - value: ReflectapiDemoTestsBasicInputTestStructWithTransformInput, -) -> ApiResponse[ReflectapiDemoTestsBasicInputTestStructWithTransformInput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicInputTestStructWithTransformInput.""" +def create_reflectapi_demo_tests_basic_input_teststructwithtransforminput_response( + value: reflectapi_demo.tests.basic.input.TestStructWithTransformInput, +) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithTransformInput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithTransformInput.""" return create_api_response(value) -def create_reflectapidemotestsbasicoutputteststructwithtransforminput_response( - value: ReflectapiDemoTestsBasicOutputTestStructWithTransformInput, -) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformInput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicOutputTestStructWithTransformInput.""" +def create_reflectapi_demo_tests_basic_output_teststructwithtransforminput_response( + value: reflectapi_demo.tests.basic.output.TestStructWithTransformInput, +) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithTransformInput.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap index 8010b727..7f2e71bf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap @@ -41,6 +41,31 @@ class ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructWithTransformOutput = ( + ReflectapiDemoTestsBasicInputTestStructWithTransformOutput + ) + + class output: + """Namespace for output types.""" + + TestStructWithTransformOutput = ( + ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -50,16 +75,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithTransformOutput + reflectapi_demo.tests.basic.input.TestStructWithTransformOutput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithTransformOutput data """ path = "/inout_test" @@ -69,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithTransformOutput, ) @@ -95,16 +120,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsBasicInputTestStructWithTransformOutput + reflectapi_demo.tests.basic.input.TestStructWithTransformOutput ] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput]: + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput]: Response containing ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput data + ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: Response containing reflectapi_demo.tests.basic.output.TestStructWithTransformOutput data """ path = "/inout_test" @@ -114,7 +139,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput, + response_model=reflectapi_demo.tests.basic.output.TestStructWithTransformOutput, ) @@ -139,8 +164,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicInputTestStructWithTransformOutput.model_rebuild() - ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput.model_rebuild() + reflectapi_demo.tests.basic.input.TestStructWithTransformOutput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithTransformOutput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -150,17 +175,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicinputteststructwithtransformoutput_response( - value: ReflectapiDemoTestsBasicInputTestStructWithTransformOutput, -) -> ApiResponse[ReflectapiDemoTestsBasicInputTestStructWithTransformOutput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicInputTestStructWithTransformOutput.""" +def create_reflectapi_demo_tests_basic_input_teststructwithtransformoutput_response( + value: reflectapi_demo.tests.basic.input.TestStructWithTransformOutput, +) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithTransformOutput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithTransformOutput.""" return create_api_response(value) -def create_reflectapidemotestsbasicoutputteststructwithtransformoutput_response( - value: ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput, -) -> ApiResponse[ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput.""" +def create_reflectapi_demo_tests_basic_output_teststructwithtransformoutput_response( + value: reflectapi_demo.tests.basic.output.TestStructWithTransformOutput, +) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithTransformOutput.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap index 55e07271..1dd108d0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap @@ -30,7 +30,22 @@ class ReflectapiDemoTestsBasicTestStructWithTuple(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: StdTupleTuple2[int, str] = Field(serialization_alias="_f", validation_alias="_f") + f: std.tuple.Tuple2[int, str] = Field( + serialization_alias="_f", validation_alias="_f" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTuple = ReflectapiDemoTestsBasicTestStructWithTuple class AsyncInoutClient: @@ -41,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTuple] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTuple] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple]: Response containing ReflectapiDemoTestsBasicTestStructWithTuple data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple]: Response containing reflectapi_demo.tests.basic.TestStructWithTuple data """ path = "/inout_test" @@ -59,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTuple, + response_model=reflectapi_demo.tests.basic.TestStructWithTuple, ) @@ -84,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTuple] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTuple] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple]: Response containing ReflectapiDemoTestsBasicTestStructWithTuple data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple]: Response containing reflectapi_demo.tests.basic.TestStructWithTuple data """ path = "/inout_test" @@ -102,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTuple, + response_model=reflectapi_demo.tests.basic.TestStructWithTuple, ) @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithTuple.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithTuple.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithtuple_response( - value: ReflectapiDemoTestsBasicTestStructWithTuple, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithTuple.""" +def create_reflectapi_demo_tests_basic_teststructwithtuple_response( + value: reflectapi_demo.tests.basic.TestStructWithTuple, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTuple.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap index 0df7793d..44e10f8b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap @@ -30,11 +30,24 @@ class ReflectapiDemoTestsBasicTestStructWithTuple12(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: StdTupleTuple12[int, str, int, str, int, str, int, str, int, str, int, str] = ( + f: std.tuple.Tuple12[int, str, int, str, int, str, int, str, int, str, int, str] = ( Field(serialization_alias="_f", validation_alias="_f") ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTuple12 = ReflectapiDemoTestsBasicTestStructWithTuple12 + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTuple12] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple12]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTuple12] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple12]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple12]: Response containing ReflectapiDemoTestsBasicTestStructWithTuple12 data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple12]: Response containing reflectapi_demo.tests.basic.TestStructWithTuple12 data """ path = "/inout_test" @@ -61,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTuple12, + response_model=reflectapi_demo.tests.basic.TestStructWithTuple12, ) @@ -86,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithTuple12] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple12]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithTuple12] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple12]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple12]: Response containing ReflectapiDemoTestsBasicTestStructWithTuple12 data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple12]: Response containing reflectapi_demo.tests.basic.TestStructWithTuple12 data """ path = "/inout_test" @@ -104,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithTuple12, + response_model=reflectapi_demo.tests.basic.TestStructWithTuple12, ) @@ -129,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithTuple12.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithTuple12.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithtuple12_response( - value: ReflectapiDemoTestsBasicTestStructWithTuple12, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithTuple12]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithTuple12.""" +def create_reflectapi_demo_tests_basic_teststructwithtuple12_response( + value: reflectapi_demo.tests.basic.TestStructWithTuple12, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple12]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTuple12.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap index ef7ad6fa..1b3b07c2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap @@ -33,6 +33,19 @@ class ReflectapiDemoTestsBasicTestStructWithVec(BaseModel): f: bytes = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithVec = ReflectapiDemoTestsBasicTestStructWithVec + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +54,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVec] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVec]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVec] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVec]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVec]: Response containing ReflectapiDemoTestsBasicTestStructWithVec data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVec]: Response containing reflectapi_demo.tests.basic.TestStructWithVec data """ path = "/inout_test" @@ -59,7 +72,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVec, + response_model=reflectapi_demo.tests.basic.TestStructWithVec, ) @@ -84,15 +97,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVec] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVec]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVec] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVec]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVec]: Response containing ReflectapiDemoTestsBasicTestStructWithVec data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVec]: Response containing reflectapi_demo.tests.basic.TestStructWithVec data """ path = "/inout_test" @@ -102,7 +115,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVec, + response_model=reflectapi_demo.tests.basic.TestStructWithVec, ) @@ -127,7 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithVec.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithVec.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +150,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithvec_response( - value: ReflectapiDemoTestsBasicTestStructWithVec, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVec]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithVec.""" +def create_reflectapi_demo_tests_basic_teststructwithvec_response( + value: reflectapi_demo.tests.basic.TestStructWithVec, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVec]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVec.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap index f1002968..e9c4a6cf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap @@ -38,11 +38,31 @@ class ReflectapiDemoTestsBasicTestStructWithVecExternal(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: list[ReflectapiDemoTestsTestLibTestStructNested] = Field( + f: list[reflectapi_demo.tests.test_lib.TestStructNested] = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class test_lib: + """Namespace for test_lib types.""" + + TestStructNested = ReflectapiDemoTestsTestLibTestStructNested + + class basic: + """Namespace for basic types.""" + + TestStructWithVecExternal = ( + ReflectapiDemoTestsBasicTestStructWithVecExternal + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -51,15 +71,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVecExternal] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecExternal]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVecExternal] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecExternal]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecExternal]: Response containing ReflectapiDemoTestsBasicTestStructWithVecExternal data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecExternal]: Response containing reflectapi_demo.tests.basic.TestStructWithVecExternal data """ path = "/inout_test" @@ -69,7 +89,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVecExternal, + response_model=reflectapi_demo.tests.basic.TestStructWithVecExternal, ) @@ -94,15 +114,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVecExternal] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecExternal]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVecExternal] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecExternal]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecExternal]: Response containing ReflectapiDemoTestsBasicTestStructWithVecExternal data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecExternal]: Response containing reflectapi_demo.tests.basic.TestStructWithVecExternal data """ path = "/inout_test" @@ -112,7 +132,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVecExternal, + response_model=reflectapi_demo.tests.basic.TestStructWithVecExternal, ) @@ -137,8 +157,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithVecExternal.model_rebuild() - ReflectapiDemoTestsTestLibTestStructNested.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithVecExternal.model_rebuild() + reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +168,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithvecexternal_response( - value: ReflectapiDemoTestsBasicTestStructWithVecExternal, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecExternal]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithVecExternal.""" +def create_reflectapi_demo_tests_basic_teststructwithvecexternal_response( + value: reflectapi_demo.tests.basic.TestStructWithVecExternal, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecExternal]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVecExternal.""" return create_api_response(value) -def create_reflectapidemoteststestlibteststructnested_response( - value: ReflectapiDemoTestsTestLibTestStructNested, -) -> ApiResponse[ReflectapiDemoTestsTestLibTestStructNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsTestLibTestStructNested.""" +def create_reflectapi_demo_tests_test_lib_teststructnested_response( + value: reflectapi_demo.tests.test_lib.TestStructNested, +) -> ApiResponse[reflectapi_demo.tests.test_lib.TestStructNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.test_lib.TestStructNested.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap index 9710ea03..31fb48ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap @@ -38,11 +38,29 @@ class ReflectapiDemoTestsBasicTestStructWithVecNested(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: list[list[ReflectapiDemoTestsTestLibTestStructNested]] = Field( + f: list[list[reflectapi_demo.tests.test_lib.TestStructNested]] = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class test_lib: + """Namespace for test_lib types.""" + + TestStructNested = ReflectapiDemoTestsTestLibTestStructNested + + class basic: + """Namespace for basic types.""" + + TestStructWithVecNested = ReflectapiDemoTestsBasicTestStructWithVecNested + + class AsyncInoutClient: """Async client for inout operations.""" @@ -51,15 +69,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVecNested] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecNested]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVecNested] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecNested]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecNested]: Response containing ReflectapiDemoTestsBasicTestStructWithVecNested data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecNested]: Response containing reflectapi_demo.tests.basic.TestStructWithVecNested data """ path = "/inout_test" @@ -69,7 +87,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVecNested, + response_model=reflectapi_demo.tests.basic.TestStructWithVecNested, ) @@ -94,15 +112,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVecNested] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecNested]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVecNested] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecNested]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecNested]: Response containing ReflectapiDemoTestsBasicTestStructWithVecNested data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecNested]: Response containing reflectapi_demo.tests.basic.TestStructWithVecNested data """ path = "/inout_test" @@ -112,7 +130,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVecNested, + response_model=reflectapi_demo.tests.basic.TestStructWithVecNested, ) @@ -137,8 +155,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithVecNested.model_rebuild() - ReflectapiDemoTestsTestLibTestStructNested.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithVecNested.model_rebuild() + reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +166,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithvecnested_response( - value: ReflectapiDemoTestsBasicTestStructWithVecNested, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithVecNested.""" +def create_reflectapi_demo_tests_basic_teststructwithvecnested_response( + value: reflectapi_demo.tests.basic.TestStructWithVecNested, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVecNested.""" return create_api_response(value) -def create_reflectapidemoteststestlibteststructnested_response( - value: ReflectapiDemoTestsTestLibTestStructNested, -) -> ApiResponse[ReflectapiDemoTestsTestLibTestStructNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsTestLibTestStructNested.""" +def create_reflectapi_demo_tests_test_lib_teststructnested_response( + value: reflectapi_demo.tests.test_lib.TestStructNested, +) -> ApiResponse[reflectapi_demo.tests.test_lib.TestStructNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.test_lib.TestStructNested.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap index d5c9e22d..cd3b96af 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap @@ -34,6 +34,19 @@ class ReflectapiDemoTestsBasicTestStructWithVecTwo(BaseModel): f2: list[int] = Field(serialization_alias="_f2", validation_alias="_f2") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithVecTwo = ReflectapiDemoTestsBasicTestStructWithVecTwo + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,15 +55,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVecTwo] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecTwo]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVecTwo] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecTwo]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecTwo]: Response containing ReflectapiDemoTestsBasicTestStructWithVecTwo data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecTwo]: Response containing reflectapi_demo.tests.basic.TestStructWithVecTwo data """ path = "/inout_test" @@ -60,7 +73,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVecTwo, + response_model=reflectapi_demo.tests.basic.TestStructWithVecTwo, ) @@ -85,15 +98,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsBasicTestStructWithVecTwo] = None, - ) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecTwo]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithVecTwo] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecTwo]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecTwo]: Response containing ReflectapiDemoTestsBasicTestStructWithVecTwo data + ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecTwo]: Response containing reflectapi_demo.tests.basic.TestStructWithVecTwo data """ path = "/inout_test" @@ -103,7 +116,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsBasicTestStructWithVecTwo, + response_model=reflectapi_demo.tests.basic.TestStructWithVecTwo, ) @@ -128,7 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsBasicTestStructWithVecTwo.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithVecTwo.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -138,10 +151,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsbasicteststructwithvectwo_response( - value: ReflectapiDemoTestsBasicTestStructWithVecTwo, -) -> ApiResponse[ReflectapiDemoTestsBasicTestStructWithVecTwo]: - """Create a mock ApiResponse for ReflectapiDemoTestsBasicTestStructWithVecTwo.""" +def create_reflectapi_demo_tests_basic_teststructwithvectwo_response( + value: reflectapi_demo.tests.basic.TestStructWithVecTwo, +) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecTwo]: + """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVecTwo.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap index 411d85ef..2f4b34aa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsEnumsTestEnum(str, Enum): VARIANT2 = "Variant2" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnum = ReflectapiDemoTestsEnumsTestEnum + VARIANT1 = VARIANT1 + VARIANT2 = VARIANT2 + + class AsyncInputClient: """Async client for input_ operations.""" @@ -41,7 +56,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnum] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnum] = None, ) -> ApiResponse[Any]: """ @@ -84,7 +99,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnum] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnum] = None, ) -> ApiResponse[Any]: """ @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnum.model_rebuild() + reflectapi_demo.tests.enums.TestEnum.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsenumstestenum_response( - value: ReflectapiDemoTestsEnumsTestEnum, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnum]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnum.""" +def create_reflectapi_demo_tests_enums_testenum_response( + value: reflectapi_demo.tests.enums.TestEnum, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnum]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnum.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap index 494235d6..0ef5cc2d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap @@ -32,6 +32,19 @@ class ReflectapiDemoTestsEnumsTestEnumEmpty(str, Enum): pass +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumEmpty = ReflectapiDemoTestsEnumsTestEnumEmpty + + class AsyncInputClient: """Async client for input_ operations.""" @@ -40,7 +53,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumEmpty] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumEmpty] = None, ) -> ApiResponse[Any]: """ @@ -83,7 +96,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumEmpty] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumEmpty] = None, ) -> ApiResponse[Any]: """ @@ -126,7 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumEmpty.model_rebuild() + reflectapi_demo.tests.enums.TestEnumEmpty.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -136,10 +149,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsenumstestenumempty_response( - value: ReflectapiDemoTestsEnumsTestEnumEmpty, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumEmpty]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumEmpty.""" +def create_reflectapi_demo_tests_enums_testenumempty_response( + value: reflectapi_demo.tests.enums.TestEnumEmpty, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumEmpty]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumEmpty.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap index 23c1d29f..5a18561b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsEnumsNums(str, Enum): A = "A" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + Nums = ReflectapiDemoTestsEnumsNums + ZERO = ZERO + A = A + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsNums] = None, - ) -> ApiResponse[ReflectapiDemoTestsEnumsNums]: + data: Optional[reflectapi_demo.tests.enums.Nums] = None, + ) -> ApiResponse[reflectapi_demo.tests.enums.Nums]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsEnumsNums]: Response containing ReflectapiDemoTestsEnumsNums data + ApiResponse[reflectapi_demo.tests.enums.Nums]: Response containing reflectapi_demo.tests.enums.Nums data """ path = "/inout_test" @@ -59,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsEnumsNums, + response_model=reflectapi_demo.tests.enums.Nums, ) @@ -84,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsNums] = None, - ) -> ApiResponse[ReflectapiDemoTestsEnumsNums]: + data: Optional[reflectapi_demo.tests.enums.Nums] = None, + ) -> ApiResponse[reflectapi_demo.tests.enums.Nums]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsEnumsNums]: Response containing ReflectapiDemoTestsEnumsNums data + ApiResponse[reflectapi_demo.tests.enums.Nums]: Response containing reflectapi_demo.tests.enums.Nums data """ path = "/inout_test" @@ -102,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsEnumsNums, + response_model=reflectapi_demo.tests.enums.Nums, ) @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsNums.model_rebuild() + reflectapi_demo.tests.enums.Nums.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsenumsnums_response( - value: ReflectapiDemoTestsEnumsNums, -) -> ApiResponse[ReflectapiDemoTestsEnumsNums]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsNums.""" +def create_reflectapi_demo_tests_enums_nums_response( + value: reflectapi_demo.tests.enums.Nums, +) -> ApiResponse[reflectapi_demo.tests.enums.Nums]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.Nums.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap index 154f10f0..3726085e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap @@ -130,6 +130,24 @@ class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant = ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant + TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant = ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant + TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariants = ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariants + TestEnumWithBasicVariantAndFieldsAndNamedFields = ( + ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -139,7 +157,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields ] = None, ) -> ApiResponse[Any]: """ @@ -184,7 +202,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields ] = None, ) -> ApiResponse[Any]: """ @@ -228,35 +246,37 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsFactory: - """Factory class for creating ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields variants with ergonomic syntax. +class reflectapi_demo_tests_enums_TestEnumWithBasicVariantAndFieldsAndNamedFieldsFactory: + """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields variants with ergonomic syntax. - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields variants + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields variants """ @staticmethod def variant0() -> ( - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields ): - """Creates the 'Variant0' variant of the ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields( - "Variant0" + """Creates the 'Variant0' variant of the reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" + return ( + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields( + "Variant0" + ) ) @staticmethod def variant1( field_0: int, field_1: str - ) -> ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields( - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant( + ) -> reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields( + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant( field_0=field_0, field_1=field_1 ) ) @@ -264,10 +284,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsFac @staticmethod def variant2( field1: int, field2: str - ) -> ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields( - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant( + ) -> reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields( + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant( field1=field1, field2=field2 ) ) @@ -276,12 +296,12 @@ class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsFac # Testing utilities -def create_reflectapidemotestsenumstestenumwithbasicvariantandfieldsandnamedfields_response( - value: ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields, +def create_reflectapi_demo_tests_enums_testenumwithbasicvariantandfieldsandnamedfields_response( + value: reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields, ) -> ApiResponse[ - ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields + reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields ]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields.""" + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap index 5b61e26e..27979d57 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap @@ -33,6 +33,23 @@ class ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored(str, Enum): VARIANT2 = "Variant2" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumWithDiscriminantIgnored = ( + ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored + ) + VARIANT1 = VARIANT1 + VARIANT2 = VARIANT2 + + class AsyncInputClient: """Async client for input_ operations.""" @@ -41,7 +58,9 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored] = None, + data: Optional[ + reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored + ] = None, ) -> ApiResponse[Any]: """ @@ -84,7 +103,9 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored] = None, + data: Optional[ + reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored + ] = None, ) -> ApiResponse[Any]: """ @@ -127,7 +148,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +158,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsenumstestenumwithdiscriminantignored_response( - value: ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored.""" +def create_reflectapi_demo_tests_enums_testenumwithdiscriminantignored_response( + value: reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap index 7a57760a..ec834d5f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap @@ -33,6 +33,23 @@ class ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored(str, Enum): VARIANT2 = "Variant2" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumWithDiscriminantIgnored = ( + ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored + ) + VARIANT1 = VARIANT1 + VARIANT2 = VARIANT2 + + class AsyncOutputClient: """Async client for output operations.""" @@ -41,11 +58,11 @@ class AsyncOutputClient: async def test( self, - ) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored]: + ) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: """ Returns: - ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored]: Response containing ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored data + ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: Response containing reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored data """ path = "/output_test" @@ -54,7 +71,7 @@ class AsyncOutputClient: "POST", path, params=params if params else None, - response_model=ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored, + response_model=reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored, ) @@ -79,11 +96,11 @@ class OutputClient: def test( self, - ) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored]: + ) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: """ Returns: - ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored]: Response containing ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored data + ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: Response containing reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored data """ path = "/output_test" @@ -92,7 +109,7 @@ class OutputClient: "POST", path, params=params if params else None, - response_model=ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored, + response_model=reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored, ) @@ -117,7 +134,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -127,10 +144,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsenumstestenumwithdiscriminantignored_response( - value: ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored.""" +def create_reflectapi_demo_tests_enums_testenumwithdiscriminantignored_response( + value: reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap index d8743926..1ddc5e5a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap @@ -39,6 +39,21 @@ class ReflectapiDemoTestsEnumsTestEnumWithDiscriminant(IntEnum): """""" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumWithDiscriminant = ReflectapiDemoTestsEnumsTestEnumWithDiscriminant + VARIANT1 = VARIANT1 + VARIANT2 = VARIANT2 + + class AsyncInputClient: """Async client for input_ operations.""" @@ -47,7 +62,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumWithDiscriminant] = None, ) -> ApiResponse[Any]: """ @@ -90,7 +105,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumWithDiscriminant] = None, ) -> ApiResponse[Any]: """ @@ -133,7 +148,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithDiscriminant.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithDiscriminant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -143,10 +158,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsenumstestenumwithdiscriminant_response( - value: ReflectapiDemoTestsEnumsTestEnumWithDiscriminant, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithDiscriminant.""" +def create_reflectapi_demo_tests_enums_testenumwithdiscriminant_response( + value: reflectapi_demo.tests.enums.TestEnumWithDiscriminant, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminant.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap index bedd7024..9aa41ad4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap @@ -39,6 +39,21 @@ class ReflectapiDemoTestsEnumsTestEnumWithDiscriminant(IntEnum): """""" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumWithDiscriminant = ReflectapiDemoTestsEnumsTestEnumWithDiscriminant + VARIANT1 = VARIANT1 + VARIANT2 = VARIANT2 + + class AsyncOutputClient: """Async client for output operations.""" @@ -47,11 +62,11 @@ class AsyncOutputClient: async def test( self, - ) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant]: + ) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: """ Returns: - ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant]: Response containing ReflectapiDemoTestsEnumsTestEnumWithDiscriminant data + ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: Response containing reflectapi_demo.tests.enums.TestEnumWithDiscriminant data """ path = "/output_test" @@ -60,7 +75,7 @@ class AsyncOutputClient: "POST", path, params=params if params else None, - response_model=ReflectapiDemoTestsEnumsTestEnumWithDiscriminant, + response_model=reflectapi_demo.tests.enums.TestEnumWithDiscriminant, ) @@ -85,11 +100,11 @@ class OutputClient: def test( self, - ) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant]: + ) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: """ Returns: - ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant]: Response containing ReflectapiDemoTestsEnumsTestEnumWithDiscriminant data + ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: Response containing reflectapi_demo.tests.enums.TestEnumWithDiscriminant data """ path = "/output_test" @@ -98,7 +113,7 @@ class OutputClient: "POST", path, params=params if params else None, - response_model=ReflectapiDemoTestsEnumsTestEnumWithDiscriminant, + response_model=reflectapi_demo.tests.enums.TestEnumWithDiscriminant, ) @@ -123,7 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithDiscriminant.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithDiscriminant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -133,10 +148,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsenumstestenumwithdiscriminant_response( - value: ReflectapiDemoTestsEnumsTestEnumWithDiscriminant, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithDiscriminant]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithDiscriminant.""" +def create_reflectapi_demo_tests_enums_testenumwithdiscriminant_response( + value: reflectapi_demo.tests.enums.TestEnumWithDiscriminant, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminant.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap index 7426bfc8..01b15363 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap @@ -98,6 +98,27 @@ class ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumWithEmptyVariantAndFieldsVariant2Variant = ( + ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsVariant2Variant + ) + TestEnumWithEmptyVariantAndFieldsVariants = ( + ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsVariants + ) + TestEnumWithEmptyVariantAndFields = ( + ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -107,7 +128,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields + reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields ] = None, ) -> ApiResponse[Any]: """ @@ -152,7 +173,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields + reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields ] = None, ) -> ApiResponse[Any]: """ @@ -196,31 +217,31 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsFactory: - """Factory class for creating ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields variants with ergonomic syntax. +class reflectapi_demo_tests_enums_TestEnumWithEmptyVariantAndFieldsFactory: + """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields variants with ergonomic syntax. - ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields variants + reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields variants """ @staticmethod - def variant1() -> ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields("Variant1") + def variant1() -> reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields("Variant1") @staticmethod def variant2( field_0: int, - ) -> ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields( - ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsVariant2Variant( + ) -> reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields( + reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFieldsVariant2Variant( field_0=field_0 ) ) @@ -229,10 +250,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsFactory: # Testing utilities -def create_reflectapidemotestsenumstestenumwithemptyvariantandfields_response( - value: ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields.""" +def create_reflectapi_demo_tests_enums_testenumwithemptyvariantandfields_response( + value: reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap index 69281c91..c0028b14 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap @@ -110,6 +110,28 @@ class ReflectapiDemoTestsEnumsTestEnumWithFields( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + TestEnumWithFieldsVariant1Variant = ( + ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant1Variant + ) + TestEnumWithFieldsVariant2Variant = ( + ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant2Variant + ) + TestEnumWithFieldsVariants = ( + ReflectapiDemoTestsEnumsTestEnumWithFieldsVariants + ) + TestEnumWithFields = ReflectapiDemoTestsEnumsTestEnumWithFields + + class AsyncInputClient: """Async client for input_ operations.""" @@ -118,7 +140,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithFields] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumWithFields] = None, ) -> ApiResponse[Any]: """ @@ -161,7 +183,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithFields] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumWithFields] = None, ) -> ApiResponse[Any]: """ @@ -204,33 +226,35 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithFields.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsTestEnumWithFieldsFactory: - """Factory class for creating ReflectapiDemoTestsEnumsTestEnumWithFields variants with ergonomic syntax. +class reflectapi_demo_tests_enums_TestEnumWithFieldsFactory: + """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithFields variants with ergonomic syntax. - ReflectapiDemoTestsEnumsTestEnumWithFields variants + reflectapi_demo.tests.enums.TestEnumWithFields variants """ @staticmethod - def variant1(field_0: int) -> ReflectapiDemoTestsEnumsTestEnumWithFields: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithFields( - ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant1Variant(field_0=field_0) + def variant1(field_0: int) -> reflectapi_demo.tests.enums.TestEnumWithFields: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithFields( + reflectapi_demo.tests.enums.TestEnumWithFieldsVariant1Variant( + field_0=field_0 + ) ) @staticmethod def variant2( field_0: str, field_1: float - ) -> ReflectapiDemoTestsEnumsTestEnumWithFields: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithFields( - ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant2Variant( + ) -> reflectapi_demo.tests.enums.TestEnumWithFields: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithFields( + reflectapi_demo.tests.enums.TestEnumWithFieldsVariant2Variant( field_0=field_0, field_1=field_1 ) ) @@ -239,10 +263,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithFieldsFactory: # Testing utilities -def create_reflectapidemotestsenumstestenumwithfields_response( - value: ReflectapiDemoTestsEnumsTestEnumWithFields, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithFields]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithFields.""" +def create_reflectapi_demo_tests_enums_testenumwithfields_response( + value: reflectapi_demo.tests.enums.TestEnumWithFields, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithFields]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithFields.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap index 38c6ac6f..37b1622e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap @@ -131,6 +131,29 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenerics( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + T = T + TestEnumWithGenericsVariant1Variant = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant1Variant + ) + TestEnumWithGenericsVariant2Variant = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant2Variant + ) + TestEnumWithGenericsVariants = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsVariants + ) + TestEnumWithGenerics = ReflectapiDemoTestsEnumsTestEnumWithGenerics + + class AsyncInputClient: """Async client for input_ operations.""" @@ -139,7 +162,7 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithGenerics[int]] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumWithGenerics[int]] = None, ) -> ApiResponse[Any]: """ @@ -182,7 +205,7 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsTestEnumWithGenerics[int]] = None, + data: Optional[reflectapi_demo.tests.enums.TestEnumWithGenerics[int]] = None, ) -> ApiResponse[Any]: """ @@ -225,24 +248,24 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithGenerics.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithGenerics.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsTestEnumWithGenericsFactory: - """Factory class for creating ReflectapiDemoTestsEnumsTestEnumWithGenerics variants with ergonomic syntax. +class reflectapi_demo_tests_enums_TestEnumWithGenericsFactory: + """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithGenerics variants with ergonomic syntax. - ReflectapiDemoTestsEnumsTestEnumWithGenerics variants + reflectapi_demo.tests.enums.TestEnumWithGenerics variants """ @staticmethod - def variant1(field_0: T) -> ReflectapiDemoTestsEnumsTestEnumWithGenerics[T]: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenerics enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithGenerics( - ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant1Variant[T]( + def variant1(field_0: T) -> reflectapi_demo.tests.enums.TestEnumWithGenerics[T]: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithGenerics enum.""" + return reflectapi_demo.tests.enums.TestEnumWithGenerics( + reflectapi_demo.tests.enums.TestEnumWithGenericsVariant1Variant[T]( field_0=field_0 ) ) @@ -250,10 +273,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsFactory: @staticmethod def variant2( field_0: T, field_1: T - ) -> ReflectapiDemoTestsEnumsTestEnumWithGenerics[T]: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenerics enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithGenerics( - ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant2Variant[T]( + ) -> reflectapi_demo.tests.enums.TestEnumWithGenerics[T]: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithGenerics enum.""" + return reflectapi_demo.tests.enums.TestEnumWithGenerics( + reflectapi_demo.tests.enums.TestEnumWithGenericsVariant2Variant[T]( field_0=field_0, field_1=field_1 ) ) @@ -262,10 +285,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsFactory: # Testing utilities -def create_reflectapidemotestsenumstestenumwithgenerics_response( - value: ReflectapiDemoTestsEnumsTestEnumWithGenerics, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithGenerics]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithGenerics.""" +def create_reflectapi_demo_tests_enums_testenumwithgenerics_response( + value: reflectapi_demo.tests.enums.TestEnumWithGenerics, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithGenerics]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithGenerics.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap index 89132ded..9890c4ae 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap @@ -133,6 +133,31 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + T = T + TestEnumWithGenericsAndFieldsVariant1Variant = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant1Variant + ) + TestEnumWithGenericsAndFieldsVariant2Variant = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant2Variant + ) + TestEnumWithGenericsAndFieldsVariants = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariants + ) + TestEnumWithGenericsAndFields = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -142,7 +167,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields[int] + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields[int] ] = None, ) -> ApiResponse[Any]: """ @@ -187,7 +212,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields[int] + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields[int] ] = None, ) -> ApiResponse[Any]: """ @@ -231,26 +256,26 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsFactory: - """Factory class for creating ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields variants with ergonomic syntax. +class reflectapi_demo_tests_enums_TestEnumWithGenericsAndFieldsFactory: + """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields variants with ergonomic syntax. - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields variants + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields variants """ @staticmethod def variant1( field_0: int, - ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields[T]: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields( - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant1Variant[T]( + ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields[T]: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields( + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsVariant1Variant[T]( field_0=field_0 ) ) @@ -258,10 +283,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsFactory: @staticmethod def variant2( field_0: T, field_1: T - ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields[T]: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields( - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant2Variant[T]( + ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields[T]: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields( + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsVariant2Variant[T]( field_0=field_0, field_1=field_1 ) ) @@ -270,10 +295,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsFactory: # Testing utilities -def create_reflectapidemotestsenumstestenumwithgenericsandfields_response( - value: ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields.""" +def create_reflectapi_demo_tests_enums_testenumwithgenericsandfields_response( + value: reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields, +) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap index 5d385d36..0cfd3b16 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap @@ -170,6 +170,26 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + T = T + TestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant + TestEnumWithGenericsAndFieldsAndNamedFieldsVariant2Variant = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant2Variant + TestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant + TestEnumWithGenericsAndFieldsAndNamedFieldsVariants = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariants + TestEnumWithGenericsAndFieldsAndNamedFields = ( + ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -179,7 +199,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[int] + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[int] ] = None, ) -> ApiResponse[Any]: """ @@ -224,7 +244,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[int] + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[int] ] = None, ) -> ApiResponse[Any]: """ @@ -268,26 +288,26 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields.model_rebuild() + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsFactory: - """Factory class for creating ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields variants with ergonomic syntax. +class reflectapi_demo_tests_enums_TestEnumWithGenericsAndFieldsAndNamedFieldsFactory: + """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields variants with ergonomic syntax. - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields variants + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields variants """ @staticmethod def variant1( field_0: int, - ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[T]: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant[ + ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[T]: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields( + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant[ T ](field_0=field_0) ) @@ -295,10 +315,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsFactory @staticmethod def variant2( field_0: T, field_1: T - ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[T]: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant2Variant[ + ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[T]: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields( + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFieldsVariant2Variant[ T ](field_0=field_0, field_1=field_1) ) @@ -306,10 +326,10 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsFactory @staticmethod def variant3( field1: int, field2: T - ) -> ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields[T]: - """Creates the 'Variant3' variant of the ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields enum.""" - return ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields( - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant[ + ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[T]: + """Creates the 'Variant3' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields enum.""" + return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields( + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant[ T ](field1=field1, field2=field2) ) @@ -318,10 +338,12 @@ class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsFactory # Testing utilities -def create_reflectapidemotestsenumstestenumwithgenericsandfieldsandnamedfields_response( - value: ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields, -) -> ApiResponse[ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields.""" +def create_reflectapi_demo_tests_enums_testenumwithgenericsandfieldsandnamedfields_response( + value: reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields, +) -> ApiResponse[ + reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields +]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap index ea0680ac..1bf213cf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap @@ -39,13 +39,30 @@ class ReflectapiDemoTestsEnumsEA(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) type: Literal["a"] = "a" - value: ReflectapiDemoTestsEnumsA + value: reflectapi_demo.tests.enums.A class ReflectapiDemoTestsEnumsE(RootModel): root: Annotated[Union[ReflectapiDemoTestsEnumsEA], Field(discriminator="type")] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + A = ReflectapiDemoTestsEnumsA + X = X + Y = Y + EA = ReflectapiDemoTestsEnumsEA + E = ReflectapiDemoTestsEnumsE + + class AsyncInoutClient: """Async client for inout operations.""" @@ -54,15 +71,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsE] = None, - ) -> ApiResponse[ReflectapiDemoTestsEnumsE]: + data: Optional[reflectapi_demo.tests.enums.E] = None, + ) -> ApiResponse[reflectapi_demo.tests.enums.E]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsEnumsE]: Response containing ReflectapiDemoTestsEnumsE data + ApiResponse[reflectapi_demo.tests.enums.E]: Response containing reflectapi_demo.tests.enums.E data """ path = "/inout_test" @@ -72,7 +89,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsEnumsE, + response_model=reflectapi_demo.tests.enums.E, ) @@ -97,15 +114,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsE] = None, - ) -> ApiResponse[ReflectapiDemoTestsEnumsE]: + data: Optional[reflectapi_demo.tests.enums.E] = None, + ) -> ApiResponse[reflectapi_demo.tests.enums.E]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsEnumsE]: Response containing ReflectapiDemoTestsEnumsE data + ApiResponse[reflectapi_demo.tests.enums.E]: Response containing reflectapi_demo.tests.enums.E data """ path = "/inout_test" @@ -115,7 +132,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsEnumsE, + response_model=reflectapi_demo.tests.enums.E, ) @@ -140,40 +157,40 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsA.model_rebuild() - ReflectapiDemoTestsEnumsE.model_rebuild() + reflectapi_demo.tests.enums.A.model_rebuild() + reflectapi_demo.tests.enums.E.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsEFactory: - """Factory class for creating ReflectapiDemoTestsEnumsE variants with ergonomic syntax. +class reflectapi_demo_tests_enums_EFactory: + """Factory class for creating reflectapi_demo.tests.enums.E variants with ergonomic syntax. - ReflectapiDemoTestsEnumsE variants + reflectapi_demo.tests.enums.E variants """ @staticmethod - def a(field_0: ReflectapiDemoTestsEnumsA) -> ReflectapiDemoTestsEnumsEA: - """Creates the 'a' variant of the ReflectapiDemoTestsEnumsE enum.""" - return ReflectapiDemoTestsEnumsEA(field_0=field_0) + def a(field_0: reflectapi_demo.tests.enums.A) -> reflectapi_demo.tests.enums.EA: + """Creates the 'a' variant of the reflectapi_demo.tests.enums.E enum.""" + return reflectapi_demo.tests.enums.EA(field_0=field_0) # Testing utilities -def create_reflectapidemotestsenumsa_response( - value: ReflectapiDemoTestsEnumsA, -) -> ApiResponse[ReflectapiDemoTestsEnumsA]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsA.""" +def create_reflectapi_demo_tests_enums_a_response( + value: reflectapi_demo.tests.enums.A, +) -> ApiResponse[reflectapi_demo.tests.enums.A]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.A.""" return create_api_response(value) -def create_reflectapidemotestsenumse_response( - value: ReflectapiDemoTestsEnumsE, -) -> ApiResponse[ReflectapiDemoTestsEnumsE]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsE.""" +def create_reflectapi_demo_tests_enums_e_response( + value: reflectapi_demo.tests.enums.E, +) -> ApiResponse[reflectapi_demo.tests.enums.E]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.E.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap index 040647ca..6707964e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap @@ -50,6 +50,21 @@ class ReflectapiDemoTestsEnumsA(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + AX = ReflectapiDemoTestsEnumsAX + AY = ReflectapiDemoTestsEnumsAY + A = ReflectapiDemoTestsEnumsA + + class AsyncInoutClient: """Async client for inout operations.""" @@ -58,15 +73,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsEnumsA] = None, - ) -> ApiResponse[ReflectapiDemoTestsEnumsA]: + data: Optional[reflectapi_demo.tests.enums.A] = None, + ) -> ApiResponse[reflectapi_demo.tests.enums.A]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsEnumsA]: Response containing ReflectapiDemoTestsEnumsA data + ApiResponse[reflectapi_demo.tests.enums.A]: Response containing reflectapi_demo.tests.enums.A data """ path = "/inout_test" @@ -76,7 +91,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsEnumsA, + response_model=reflectapi_demo.tests.enums.A, ) @@ -101,15 +116,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsEnumsA] = None, - ) -> ApiResponse[ReflectapiDemoTestsEnumsA]: + data: Optional[reflectapi_demo.tests.enums.A] = None, + ) -> ApiResponse[reflectapi_demo.tests.enums.A]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsEnumsA]: Response containing ReflectapiDemoTestsEnumsA data + ApiResponse[reflectapi_demo.tests.enums.A]: Response containing reflectapi_demo.tests.enums.A data """ path = "/inout_test" @@ -119,7 +134,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsEnumsA, + response_model=reflectapi_demo.tests.enums.A, ) @@ -144,34 +159,34 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsEnumsA.model_rebuild() + reflectapi_demo.tests.enums.A.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsEnumsAFactory: - """Factory class for creating ReflectapiDemoTestsEnumsA variants with ergonomic syntax. +class reflectapi_demo_tests_enums_AFactory: + """Factory class for creating reflectapi_demo.tests.enums.A variants with ergonomic syntax. - ReflectapiDemoTestsEnumsA variants + reflectapi_demo.tests.enums.A variants """ - X = ReflectapiDemoTestsEnumsAX() + X = reflectapi_demo.tests.enums.AX() @staticmethod - def y(field_0: None) -> ReflectapiDemoTestsEnumsAY: - """Creates the 'Y' variant of the ReflectapiDemoTestsEnumsA enum.""" - return ReflectapiDemoTestsEnumsAY(field_0=field_0) + def y(field_0: None) -> reflectapi_demo.tests.enums.AY: + """Creates the 'Y' variant of the reflectapi_demo.tests.enums.A enum.""" + return reflectapi_demo.tests.enums.AY(field_0=field_0) # Testing utilities -def create_reflectapidemotestsenumsa_response( - value: ReflectapiDemoTestsEnumsA, -) -> ApiResponse[ReflectapiDemoTestsEnumsA]: - """Create a mock ApiResponse for ReflectapiDemoTestsEnumsA.""" +def create_reflectapi_demo_tests_enums_a_response( + value: reflectapi_demo.tests.enums.A, +) -> ApiResponse[reflectapi_demo.tests.enums.A]: + """Create a mock ApiResponse for reflectapi_demo.tests.enums.A.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap index 343f4b5e..0d64e64c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap @@ -30,11 +30,26 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReference(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithCircularReference = Field( + f: reflectapi_demo.tests.generics.TestStructWithCircularReference = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithCircularReference = ( + ReflectapiDemoTestsGenericsTestStructWithCircularReference + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -44,7 +59,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReference + reflectapi_demo.tests.generics.TestStructWithCircularReference ] = None, ) -> ApiResponse[Any]: """ @@ -89,7 +104,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReference + reflectapi_demo.tests.generics.TestStructWithCircularReference ] = None, ) -> ApiResponse[Any]: """ @@ -133,7 +148,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithCircularReference.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReference.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -143,10 +158,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithcircularreference_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReference, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithCircularReference]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReference.""" +def create_reflectapi_demo_tests_generics_teststructwithcircularreference_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReference, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithCircularReference]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReference.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap index 8c5df162..09a41dfe 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap @@ -38,12 +38,27 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric( model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[T] = Field( + f: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric[T] = Field( serialization_alias="_f", validation_alias="_f" ) f2: T = Field(serialization_alias="_f2", validation_alias="_f2") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithCircularReferenceGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -53,7 +68,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[int] + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric[int] ] = None, ) -> ApiResponse[Any]: """ @@ -98,7 +113,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[int] + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric[int] ] = None, ) -> ApiResponse[Any]: """ @@ -142,7 +157,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -152,10 +167,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithcircularreferencegeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap index c62e5035..95504931 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap @@ -38,7 +38,7 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric( model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[T] = Field( + f: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric[T] = Field( serialization_alias="_f", validation_alias="_f" ) f2: T = Field(serialization_alias="_f2", validation_alias="_f2") @@ -51,14 +51,32 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent( model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent[T] + f: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent[T] ] = Field(serialization_alias="_f", validation_alias="_f") - f2: StdMarkerPhantomData[T] = Field( + f2: std.marker.PhantomData[T] = Field( serialization_alias="_f2", validation_alias="_f2" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithCircularReferenceGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric + ) + TestStructWithCircularReferenceGenericParent = ( + ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -68,7 +86,9 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent[int] + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent[ + int + ] ] = None, ) -> ApiResponse[Any]: """ @@ -113,7 +133,9 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent[int] + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent[ + int + ] ] = None, ) -> ApiResponse[Any]: """ @@ -157,8 +179,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric.model_rebuild() - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -168,19 +190,19 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithcircularreferencegeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric.""" return create_api_response(value) -def create_reflectapidemotestsgenericsteststructwithcircularreferencegenericparent_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent, +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericparent_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent, ) -> ApiResponse[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent ]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericParent.""" + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap index 55fb90c3..37f06abe 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap @@ -44,6 +44,19 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo f2: B = Field(serialization_alias="_f2", validation_alias="_f2") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithCircularReferenceGenericWithoutBox = ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox + + class AsyncInputClient: """Async client for input_ operations.""" @@ -53,11 +66,11 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ int, int ], - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ str, int ], ] @@ -105,11 +118,11 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ int, int ], - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ str, int ], ] @@ -156,7 +169,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -166,12 +179,12 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithcircularreferencegenericwithoutbox_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox, +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutbox_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox, ) -> ApiResponse[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox ]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox.""" + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap index 8e0353a4..20c0d457 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap @@ -55,11 +55,25 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + f: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ D, C ] = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithCircularReferenceGenericWithoutBox = ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox + TestStructWithCircularReferenceGenericWithoutBoxParent = ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent + + class AsyncInputClient: """Async client for input_ operations.""" @@ -69,11 +83,11 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent[ int, int ], - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent[ str, int ], ] @@ -121,11 +135,11 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent[ int, int ], - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent[ str, int ], ] @@ -172,8 +186,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox.model_rebuild() - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -183,21 +197,21 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithcircularreferencegenericwithoutbox_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox, +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutbox_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox, ) -> ApiResponse[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox ]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox.""" + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.""" return create_api_response(value) -def create_reflectapidemotestsgenericsteststructwithcircularreferencegenericwithoutboxparent_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent, +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutboxparent_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent, ) -> ApiResponse[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent ]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParent.""" + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap index 55b3d022..e76009b1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap @@ -51,16 +51,30 @@ class ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBo model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + f: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ int, int ], - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox[ + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox[ str, int ], ] = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithCircularReferenceGenericWithoutBox = ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox + TestStructWithCircularReferenceGenericWithoutBoxParentSpecific = ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific + + class AsyncInputClient: """Async client for input_ operations.""" @@ -70,7 +84,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific ] = None, ) -> ApiResponse[Any]: """ @@ -115,7 +129,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific ] = None, ) -> ApiResponse[Any]: """ @@ -159,8 +173,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox.model_rebuild() - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -170,21 +184,21 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithcircularreferencegenericwithoutbox_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox, +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutbox_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox, ) -> ApiResponse[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox ]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBox.""" + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.""" return create_api_response(value) -def create_reflectapidemotestsgenericsteststructwithcircularreferencegenericwithoutboxparentspecific_response( - value: ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific, +def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutboxparentspecific_response( + value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific, ) -> ApiResponse[ - ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific + reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific ]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithCircularReferenceGenericWithoutBoxParentSpecific.""" + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap index b82a2e4c..aac6dd8a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap @@ -44,11 +44,29 @@ class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[ - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[int] + f: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[ + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[int] ] = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithSimpleGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric + ) + TestStructWithNestedGenericStruct = ( + ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -58,7 +76,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct + reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct ] = None, ) -> ApiResponse[Any]: """ @@ -103,7 +121,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct + reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct ] = None, ) -> ApiResponse[Any]: """ @@ -147,8 +165,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct.model_rebuild() - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -158,17 +176,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithnestedgenericstruct_response( - value: ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct.""" +def create_reflectapi_demo_tests_generics_teststructwithnestedgenericstruct_response( + value: reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct.""" return create_api_response(value) -def create_reflectapidemotestsgenericsteststructwithsimplegeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap index 8919dc75..a0d3b054 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap @@ -44,14 +44,32 @@ class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice(BaseMode model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[int] = Field( + f: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[int] = Field( serialization_alias="_f", validation_alias="_f" ) - f2: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[str] = Field( + f2: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[str] = Field( serialization_alias="_f2", validation_alias="_f2" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithSimpleGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric + ) + TestStructWithNestedGenericStructTwice = ( + ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -61,7 +79,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice + reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice ] = None, ) -> ApiResponse[Any]: """ @@ -106,7 +124,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice + reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice ] = None, ) -> ApiResponse[Any]: """ @@ -150,8 +168,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice.model_rebuild() - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -161,17 +179,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithnestedgenericstructtwice_response( - value: ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice.""" +def create_reflectapi_demo_tests_generics_teststructwithnestedgenericstructtwice_response( + value: reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice.""" return create_api_response(value) -def create_reflectapidemotestsgenericsteststructwithsimplegeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap index de4f5c36..3cc3df86 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap @@ -39,6 +39,21 @@ class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[ f: A = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithSimpleGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -48,7 +63,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[int] + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[int] ] = None, ) -> ApiResponse[Any]: """ @@ -93,7 +108,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[int] + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[int] ] = None, ) -> ApiResponse[Any]: """ @@ -137,7 +152,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -147,10 +162,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithsimplegeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap index cd12e767..125d4bca 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap @@ -39,6 +39,21 @@ class ReflectapiDemoTestsGenericsTestStructWithVecGeneric(BaseModel, Generic[T]) f: list[T] = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithVecGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithVecGeneric + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -47,7 +62,9 @@ class AsyncInputClient: async def test( self, - data: Optional[ReflectapiDemoTestsGenericsTestStructWithVecGeneric[int]] = None, + data: Optional[ + reflectapi_demo.tests.generics.TestStructWithVecGeneric[int] + ] = None, ) -> ApiResponse[Any]: """ @@ -90,7 +107,9 @@ class InputClient: def test( self, - data: Optional[ReflectapiDemoTestsGenericsTestStructWithVecGeneric[int]] = None, + data: Optional[ + reflectapi_demo.tests.generics.TestStructWithVecGeneric[int] + ] = None, ) -> ApiResponse[Any]: """ @@ -133,7 +152,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithVecGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithVecGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -143,10 +162,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithvecgeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithVecGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithVecGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithVecGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithvecgeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithVecGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap index 7bc2b533..f2d6a746 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap @@ -46,11 +46,29 @@ class ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric(BaseModel, Gene model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: list[ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric[T]] = Field( + f: list[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[T]] = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithSimpleGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric + ) + TestStructWithVecGenericGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -60,7 +78,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric[int] + reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric[int] ] = None, ) -> ApiResponse[Any]: """ @@ -105,7 +123,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric[int] + reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric[int] ] = None, ) -> ApiResponse[Any]: """ @@ -149,8 +167,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.model_rebuild() - ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -160,17 +178,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithsimplegeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" return create_api_response(value) -def create_reflectapidemotestsgenericsteststructwithvecgenericgeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithVecGenericGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithvecgenericgeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap index 76c5dbb0..84fc32f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap @@ -46,11 +46,29 @@ class ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric( model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: list[ReflectapiDemoTestsGenericsTestStructWithVecGeneric[T]] = Field( + f: list[reflectapi_demo.tests.generics.TestStructWithVecGeneric[T]] = Field( serialization_alias="_f", validation_alias="_f" ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class generics: + """Namespace for generics types.""" + + TestStructWithVecGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithVecGeneric + ) + TestStructWithVecGenericGenericGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric + ) + + class AsyncInputClient: """Async client for input_ operations.""" @@ -60,7 +78,7 @@ class AsyncInputClient: async def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric[bytes] + reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric[bytes] ] = None, ) -> ApiResponse[Any]: """ @@ -105,7 +123,7 @@ class InputClient: def test( self, data: Optional[ - ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric[bytes] + reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric[bytes] ] = None, ) -> ApiResponse[Any]: """ @@ -149,8 +167,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsGenericsTestStructWithVecGeneric.model_rebuild() - ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithVecGeneric.model_rebuild() + reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -160,17 +178,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsgenericsteststructwithvecgeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithVecGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithVecGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithVecGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithvecgeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithVecGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGeneric.""" return create_api_response(value) -def create_reflectapidemotestsgenericsteststructwithvecgenericgenericgeneric_response( - value: ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric, -) -> ApiResponse[ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric]: - """Create a mock ApiResponse for ReflectapiDemoTestsGenericsTestStructWithVecGenericGenericGeneric.""" +def create_reflectapi_demo_tests_generics_teststructwithvecgenericgenericgeneric_response( + value: reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric, +) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric]: + """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap index e7155c68..902ac5e4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap @@ -53,6 +53,21 @@ class ReflectapiDemoTestsSerdeTest(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestVariant1 = ReflectapiDemoTestsSerdeTestVariant1 + TestVariant2 = ReflectapiDemoTestsSerdeTestVariant2 + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -61,15 +76,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -79,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -104,15 +119,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -122,7 +137,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -147,37 +162,37 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTest.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTest variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestFactory: + """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTest variants + reflectapi_demo.tests.serde.Test variants """ @staticmethod - def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestVariant1: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTest enum.""" - return ReflectapiDemoTestsSerdeTestVariant1(field_name=field_name) + def variant1(field_name: int) -> reflectapi_demo.tests.serde.TestVariant1: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.Test enum.""" + return reflectapi_demo.tests.serde.TestVariant1(field_name=field_name) @staticmethod - def variant2(field_0: str) -> ReflectapiDemoTestsSerdeTestVariant2: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTest enum.""" - return ReflectapiDemoTestsSerdeTestVariant2(field_0=field_0) + def variant2(field_0: str) -> reflectapi_demo.tests.serde.TestVariant2: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.Test enum.""" + return reflectapi_demo.tests.serde.TestVariant2(field_0=field_0) # Testing utilities -def create_reflectapidemotestsserdetest_response( - value: ReflectapiDemoTestsSerdeTest, -) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTest.""" +def create_reflectapi_demo_tests_serde_test_response( + value: reflectapi_demo.tests.serde.Test, +) -> ApiResponse[reflectapi_demo.tests.serde.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap index 6bb6c3e6..d6b3d2d5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap @@ -49,6 +49,28 @@ class ReflectapiDemoTestsSerdeTestStruct(BaseModel): date_time_local: datetime +# Namespace classes for dotted access to types +class std: + """Namespace for std types.""" + + class time: + """Namespace for time types.""" + + Duration = StdTimeDuration + + +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStruct = ReflectapiDemoTestsSerdeTestStruct + + class AsyncInoutClient: """Async client for inout operations.""" @@ -57,15 +79,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStruct] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: + data: Optional[reflectapi_demo.tests.serde.TestStruct] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: Response containing ReflectapiDemoTestsSerdeTestStruct data + ApiResponse[reflectapi_demo.tests.serde.TestStruct]: Response containing reflectapi_demo.tests.serde.TestStruct data """ path = "/inout_test" @@ -75,7 +97,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStruct, + response_model=reflectapi_demo.tests.serde.TestStruct, ) @@ -100,15 +122,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStruct] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: + data: Optional[reflectapi_demo.tests.serde.TestStruct] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: Response containing ReflectapiDemoTestsSerdeTestStruct data + ApiResponse[reflectapi_demo.tests.serde.TestStruct]: Response containing reflectapi_demo.tests.serde.TestStruct data """ path = "/inout_test" @@ -118,7 +140,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStruct, + response_model=reflectapi_demo.tests.serde.TestStruct, ) @@ -143,8 +165,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStruct.model_rebuild() - StdTimeDuration.model_rebuild() + reflectapi_demo.tests.serde.TestStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -154,17 +175,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststruct_response( - value: ReflectapiDemoTestsSerdeTestStruct, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStruct.""" +def create_reflectapi_demo_tests_serde_teststruct_response( + value: reflectapi_demo.tests.serde.TestStruct, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStruct.""" return create_api_response(value) -def create_stdtimeduration_response( - value: StdTimeDuration, -) -> ApiResponse[StdTimeDuration]: - """Create a mock ApiResponse for StdTimeDuration.""" +def create_std_time_duration_response( + value: std.time.Duration, +) -> ApiResponse[std.time.Duration]: + """Create a mock ApiResponse for std.time.Duration.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index 456fcbd8..44c1ebaa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -118,6 +118,26 @@ class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant + TestEmptyVariantsAdjacentlyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant + TestEmptyVariantsAdjacentlyTaggedVariants = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedVariants + ) + TestEmptyVariantsAdjacentlyTagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -127,16 +147,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged data """ path = "/inout_test" @@ -146,7 +166,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged, ) @@ -172,16 +192,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged data """ path = "/inout_test" @@ -191,7 +211,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged, ) @@ -216,48 +236,48 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged.model_rebuild() + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEmptyVariantsAdjacentlyTaggedFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged variants + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged variants """ @staticmethod - def empty() -> ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged: - """Creates the 'Empty' variant of the ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged enum.""" - return ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged.model_validate( + def empty() -> reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged: + """Creates the 'Empty' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged enum.""" + return reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged.model_validate( {"t": "Empty"} ) @staticmethod - def empty_unit() -> ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged: - """Creates the 'EmptyUnit' variant of the ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged enum.""" - return ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged( - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant() + def empty_unit() -> reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged: + """Creates the 'EmptyUnit' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged enum.""" + return reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged( + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant() ) @staticmethod - def empty_struct() -> ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged: - """Creates the 'EmptyStruct' variant of the ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged enum.""" - return ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged( - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant() + def empty_struct() -> reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged: + """Creates the 'EmptyStruct' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged enum.""" + return reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged( + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTaggedEmptyStructVariant() ) # Testing utilities -def create_reflectapidemotestsserdetestemptyvariantsadjacentlytagged_response( - value: ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged.""" +def create_reflectapi_demo_tests_serde_testemptyvariantsadjacentlytagged_response( + value: reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap index c104c4f2..24fd3801 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap @@ -120,6 +120,26 @@ class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsExternallyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant + TestEmptyVariantsExternallyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant + TestEmptyVariantsExternallyTaggedVariants = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedVariants + ) + TestEmptyVariantsExternallyTagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -129,16 +149,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged data """ path = "/inout_test" @@ -148,7 +168,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged, ) @@ -174,16 +194,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged data """ path = "/inout_test" @@ -193,7 +213,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged, ) @@ -218,46 +238,46 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged.model_rebuild() + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEmptyVariantsExternallyTaggedFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged variants + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged variants """ @staticmethod - def empty() -> ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged: - """Creates the 'Empty' variant of the ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged("Empty") + def empty() -> reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged: + """Creates the 'Empty' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged enum.""" + return reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged("Empty") @staticmethod - def empty_unit() -> ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged: - """Creates the 'EmptyUnit' variant of the ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged( - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant() + def empty_unit() -> reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged: + """Creates the 'EmptyUnit' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged enum.""" + return reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged( + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTaggedEmptyUnitVariant() ) @staticmethod - def empty_struct() -> ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged: - """Creates the 'EmptyStruct' variant of the ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged( - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant() + def empty_struct() -> reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged: + """Creates the 'EmptyStruct' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged enum.""" + return reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged( + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTaggedEmptyStructVariant() ) # Testing utilities -def create_reflectapidemotestsserdetestemptyvariantsexternallytagged_response( - value: ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged.""" +def create_reflectapi_demo_tests_serde_testemptyvariantsexternallytagged_response( + value: reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap index 864dcc6d..29c2abbd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap @@ -52,6 +52,27 @@ class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsInterallyTaggedEmpty = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty + ) + TestEmptyVariantsInterallyTaggedEmptyStruct = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct + ) + TestEmptyVariantsInterallyTagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -60,15 +81,17 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged]: + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged data """ path = "/inout_test" @@ -78,7 +101,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged, ) @@ -103,15 +126,17 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged]: + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged data """ path = "/inout_test" @@ -121,7 +146,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged, ) @@ -146,36 +171,36 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged.model_rebuild() + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEmptyVariantsInterallyTaggedFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged variants + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged variants """ - EMPTY = ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty() + EMPTY = reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTaggedEmpty() @staticmethod def empty_struct() -> ( - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTaggedEmptyStruct ): - """Creates the 'EmptyStruct' variant of the ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct() + """Creates the 'EmptyStruct' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged enum.""" + return reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTaggedEmptyStruct() # Testing utilities -def create_reflectapidemotestsserdetestemptyvariantsinterallytagged_response( - value: ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged.""" +def create_reflectapi_demo_tests_serde_testemptyvariantsinterallytagged_response( + value: reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap index 067e6635..e8699d08 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap @@ -51,6 +51,30 @@ ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged = Union[ ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsUntaggedEmpty = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty + ) + TestEmptyVariantsUntaggedEmptyUnit = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyUnit + ) + TestEmptyVariantsUntaggedEmptyStruct = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyStruct + ) + TestEmptyVariantsUntagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -59,15 +83,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged]: + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsUntagged data """ path = "/inout_test" @@ -77,7 +101,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsUntagged, ) @@ -102,15 +126,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged]: + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged]: Response containing ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged data + ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged]: Response containing reflectapi_demo.tests.serde.TestEmptyVariantsUntagged data """ path = "/inout_test" @@ -120,7 +144,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged, + response_model=reflectapi_demo.tests.serde.TestEmptyVariantsUntagged, ) @@ -145,7 +169,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged.model_rebuild() + reflectapi_demo.tests.serde.TestEmptyVariantsUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -155,10 +179,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdetestemptyvariantsuntagged_response( - value: ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged.""" +def create_reflectapi_demo_tests_serde_testemptyvariantsuntagged_response( + value: reflectapi_demo.tests.serde.TestEmptyVariantsUntagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsUntagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap index f74b0041..5410fd5b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsSerdeMyEnum(str, Enum): V2 = "V2" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + MyEnum = ReflectapiDemoTestsSerdeMyEnum + V1 = V1 + V2 = V2 + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeMyEnum] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMyEnum]: + data: Optional[reflectapi_demo.tests.serde.MyEnum] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.MyEnum]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMyEnum]: Response containing ReflectapiDemoTestsSerdeMyEnum data + ApiResponse[reflectapi_demo.tests.serde.MyEnum]: Response containing reflectapi_demo.tests.serde.MyEnum data """ path = "/inout_test" @@ -59,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMyEnum, + response_model=reflectapi_demo.tests.serde.MyEnum, ) @@ -84,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeMyEnum] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMyEnum]: + data: Optional[reflectapi_demo.tests.serde.MyEnum] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.MyEnum]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMyEnum]: Response containing ReflectapiDemoTestsSerdeMyEnum data + ApiResponse[reflectapi_demo.tests.serde.MyEnum]: Response containing reflectapi_demo.tests.serde.MyEnum data """ path = "/inout_test" @@ -102,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMyEnum, + response_model=reflectapi_demo.tests.serde.MyEnum, ) @@ -127,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeMyEnum.model_rebuild() + reflectapi_demo.tests.serde.MyEnum.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdemyenum_response( - value: ReflectapiDemoTestsSerdeMyEnum, -) -> ApiResponse[ReflectapiDemoTestsSerdeMyEnum]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeMyEnum.""" +def create_reflectapi_demo_tests_serde_myenum_response( + value: reflectapi_demo.tests.serde.MyEnum, +) -> ApiResponse[reflectapi_demo.tests.serde.MyEnum]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyEnum.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap index ae8da3b3..af45e653 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap @@ -32,6 +32,20 @@ class ReflectapiDemoTestsSerdeTestEnumRenameAll(str, Enum): FIELD_NAME = "fieldName" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumRenameAll = ReflectapiDemoTestsSerdeTestEnumRenameAll + FIELD_NAME = FIELD_NAME + + class AsyncInoutClient: """Async client for inout operations.""" @@ -40,15 +54,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumRenameAll] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAll]: + data: Optional[reflectapi_demo.tests.serde.TestEnumRenameAll] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAll]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAll]: Response containing ReflectapiDemoTestsSerdeTestEnumRenameAll data + ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAll]: Response containing reflectapi_demo.tests.serde.TestEnumRenameAll data """ path = "/inout_test" @@ -58,7 +72,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumRenameAll, + response_model=reflectapi_demo.tests.serde.TestEnumRenameAll, ) @@ -83,15 +97,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumRenameAll] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAll]: + data: Optional[reflectapi_demo.tests.serde.TestEnumRenameAll] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAll]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAll]: Response containing ReflectapiDemoTestsSerdeTestEnumRenameAll data + ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAll]: Response containing reflectapi_demo.tests.serde.TestEnumRenameAll data """ path = "/inout_test" @@ -101,7 +115,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumRenameAll, + response_model=reflectapi_demo.tests.serde.TestEnumRenameAll, ) @@ -126,7 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumRenameAll.model_rebuild() + reflectapi_demo.tests.serde.TestEnumRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -136,10 +150,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdetestenumrenameall_response( - value: ReflectapiDemoTestsSerdeTestEnumRenameAll, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAll]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumRenameAll.""" +def create_reflectapi_demo_tests_serde_testenumrenameall_response( + value: reflectapi_demo.tests.serde.TestEnumRenameAll, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAll]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumRenameAll.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap index 8e89278e..bd7aca36 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap @@ -116,6 +116,30 @@ class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumRenameAllOnVariantVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant + ) + TestEnumRenameAllOnVariantVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant + ) + TestEnumRenameAllOnVariantVariants = ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariants + ) + TestEnumRenameAllOnVariant = ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -124,15 +148,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant]: + data: Optional[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant]: Response containing ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant data + ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant]: Response containing reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant data """ path = "/inout_test" @@ -142,7 +166,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant, + response_model=reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant, ) @@ -167,15 +191,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant]: + data: Optional[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant]: Response containing ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant data + ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant]: Response containing reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant data """ path = "/inout_test" @@ -185,7 +209,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant, + response_model=reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant, ) @@ -210,33 +234,37 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant.model_rebuild() + reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumRenameAllOnVariantFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant variants + reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant variants """ @staticmethod - def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant enum.""" - return ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant( + def variant1( + field_name: int, + ) -> reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant enum.""" + return reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant( + reflectapi_demo.tests.serde.TestEnumRenameAllOnVariantVariant1Variant( field_name=field_name ) ) @staticmethod - def variant2(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant enum.""" - return ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant( + def variant2( + field_0: int, + ) -> reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant enum.""" + return reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant( + reflectapi_demo.tests.serde.TestEnumRenameAllOnVariantVariant2Variant( field_0=field_0 ) ) @@ -245,10 +273,10 @@ class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantFactory: # Testing utilities -def create_reflectapidemotestsserdetestenumrenameallonvariant_response( - value: ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant.""" +def create_reflectapi_demo_tests_serde_testenumrenameallonvariant_response( + value: reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap index 0c3d5089..aa25e252 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap @@ -91,6 +91,27 @@ class ReflectapiDemoTestsSerdeTestEnumRenameVariantField( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumRenameVariantFieldVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant + ) + TestEnumRenameVariantFieldVariants = ( + ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariants + ) + TestEnumRenameVariantField = ( + ReflectapiDemoTestsSerdeTestEnumRenameVariantField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -99,15 +120,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumRenameVariantField] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameVariantField]: + data: Optional[reflectapi_demo.tests.serde.TestEnumRenameVariantField] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameVariantField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameVariantField]: Response containing ReflectapiDemoTestsSerdeTestEnumRenameVariantField data + ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameVariantField]: Response containing reflectapi_demo.tests.serde.TestEnumRenameVariantField data """ path = "/inout_test" @@ -117,7 +138,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumRenameVariantField, + response_model=reflectapi_demo.tests.serde.TestEnumRenameVariantField, ) @@ -142,15 +163,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumRenameVariantField] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameVariantField]: + data: Optional[reflectapi_demo.tests.serde.TestEnumRenameVariantField] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameVariantField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameVariantField]: Response containing ReflectapiDemoTestsSerdeTestEnumRenameVariantField data + ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameVariantField]: Response containing reflectapi_demo.tests.serde.TestEnumRenameVariantField data """ path = "/inout_test" @@ -160,7 +181,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumRenameVariantField, + response_model=reflectapi_demo.tests.serde.TestEnumRenameVariantField, ) @@ -185,26 +206,26 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumRenameVariantField.model_rebuild() + reflectapi_demo.tests.serde.TestEnumRenameVariantField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEnumRenameVariantField variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumRenameVariantFieldFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEnumRenameVariantField variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumRenameVariantField variants + reflectapi_demo.tests.serde.TestEnumRenameVariantField variants """ @staticmethod def variant2( variant2_field_name: int, - ) -> ReflectapiDemoTestsSerdeTestEnumRenameVariantField: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumRenameVariantField enum.""" - return ReflectapiDemoTestsSerdeTestEnumRenameVariantField( - ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant( + ) -> reflectapi_demo.tests.serde.TestEnumRenameVariantField: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumRenameVariantField enum.""" + return reflectapi_demo.tests.serde.TestEnumRenameVariantField( + reflectapi_demo.tests.serde.TestEnumRenameVariantFieldVariant2Variant( variant2_field_name=variant2_field_name ) ) @@ -213,10 +234,10 @@ class ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldFactory: # Testing utilities -def create_reflectapidemotestsserdetestenumrenamevariantfield_response( - value: ReflectapiDemoTestsSerdeTestEnumRenameVariantField, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumRenameVariantField]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumRenameVariantField.""" +def create_reflectapi_demo_tests_serde_testenumrenamevariantfield_response( + value: reflectapi_demo.tests.serde.TestEnumRenameVariantField, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameVariantField]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumRenameVariantField.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap index baa6505c..9ebde453 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap @@ -54,6 +54,21 @@ class ReflectapiDemoTestsSerdeTestEnumTag(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumTagVariant1 = ReflectapiDemoTestsSerdeTestEnumTagVariant1 + TestEnumTagVariant2 = ReflectapiDemoTestsSerdeTestEnumTagVariant2 + TestEnumTag = ReflectapiDemoTestsSerdeTestEnumTag + + class AsyncInoutClient: """Async client for inout operations.""" @@ -62,15 +77,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumTag] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTag]: + data: Optional[reflectapi_demo.tests.serde.TestEnumTag] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTag]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumTag]: Response containing ReflectapiDemoTestsSerdeTestEnumTag data + ApiResponse[reflectapi_demo.tests.serde.TestEnumTag]: Response containing reflectapi_demo.tests.serde.TestEnumTag data """ path = "/inout_test" @@ -80,7 +95,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumTag, + response_model=reflectapi_demo.tests.serde.TestEnumTag, ) @@ -105,15 +120,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumTag] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTag]: + data: Optional[reflectapi_demo.tests.serde.TestEnumTag] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTag]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumTag]: Response containing ReflectapiDemoTestsSerdeTestEnumTag data + ApiResponse[reflectapi_demo.tests.serde.TestEnumTag]: Response containing reflectapi_demo.tests.serde.TestEnumTag data """ path = "/inout_test" @@ -123,7 +138,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumTag, + response_model=reflectapi_demo.tests.serde.TestEnumTag, ) @@ -148,37 +163,37 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumTag.model_rebuild() + reflectapi_demo.tests.serde.TestEnumTag.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumTagFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEnumTag variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumTagFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEnumTag variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumTag variants + reflectapi_demo.tests.serde.TestEnumTag variants """ @staticmethod - def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumTagVariant1: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumTag enum.""" - return ReflectapiDemoTestsSerdeTestEnumTagVariant1(field_name=field_name) + def variant1(field_name: int) -> reflectapi_demo.tests.serde.TestEnumTagVariant1: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumTag enum.""" + return reflectapi_demo.tests.serde.TestEnumTagVariant1(field_name=field_name) @staticmethod - def variant2(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumTagVariant2: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumTag enum.""" - return ReflectapiDemoTestsSerdeTestEnumTagVariant2(field_name=field_name) + def variant2(field_name: int) -> reflectapi_demo.tests.serde.TestEnumTagVariant2: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumTag enum.""" + return reflectapi_demo.tests.serde.TestEnumTagVariant2(field_name=field_name) # Testing utilities -def create_reflectapidemotestsserdetestenumtag_response( - value: ReflectapiDemoTestsSerdeTestEnumTag, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTag]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumTag.""" +def create_reflectapi_demo_tests_serde_testenumtag_response( + value: reflectapi_demo.tests.serde.TestEnumTag, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTag]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumTag.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index 9fd39868..170b5741 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -112,6 +112,28 @@ class ReflectapiDemoTestsSerdeTestEnumTagContent( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumTagContentVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant + ) + TestEnumTagContentVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant + ) + TestEnumTagContentVariants = ( + ReflectapiDemoTestsSerdeTestEnumTagContentVariants + ) + TestEnumTagContent = ReflectapiDemoTestsSerdeTestEnumTagContent + + class AsyncInoutClient: """Async client for inout operations.""" @@ -120,15 +142,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumTagContent] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContent]: + data: Optional[reflectapi_demo.tests.serde.TestEnumTagContent] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContent]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContent]: Response containing ReflectapiDemoTestsSerdeTestEnumTagContent data + ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContent]: Response containing reflectapi_demo.tests.serde.TestEnumTagContent data """ path = "/inout_test" @@ -138,7 +160,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumTagContent, + response_model=reflectapi_demo.tests.serde.TestEnumTagContent, ) @@ -163,15 +185,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumTagContent] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContent]: + data: Optional[reflectapi_demo.tests.serde.TestEnumTagContent] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContent]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContent]: Response containing ReflectapiDemoTestsSerdeTestEnumTagContent data + ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContent]: Response containing reflectapi_demo.tests.serde.TestEnumTagContent data """ path = "/inout_test" @@ -181,7 +203,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumTagContent, + response_model=reflectapi_demo.tests.serde.TestEnumTagContent, ) @@ -206,43 +228,45 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumTagContent.model_rebuild() + reflectapi_demo.tests.serde.TestEnumTagContent.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumTagContentFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEnumTagContent variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumTagContentFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEnumTagContent variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumTagContent variants + reflectapi_demo.tests.serde.TestEnumTagContent variants """ @staticmethod - def variant1(field_name: int) -> ReflectapiDemoTestsSerdeTestEnumTagContent: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumTagContent enum.""" - return ReflectapiDemoTestsSerdeTestEnumTagContent( - ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant( + def variant1(field_name: int) -> reflectapi_demo.tests.serde.TestEnumTagContent: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumTagContent enum.""" + return reflectapi_demo.tests.serde.TestEnumTagContent( + reflectapi_demo.tests.serde.TestEnumTagContentVariant1Variant( field_name=field_name ) ) @staticmethod - def variant2(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumTagContent: - """Creates the 'Variant2' variant of the ReflectapiDemoTestsSerdeTestEnumTagContent enum.""" - return ReflectapiDemoTestsSerdeTestEnumTagContent( - ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant(field_0=field_0) + def variant2(field_0: int) -> reflectapi_demo.tests.serde.TestEnumTagContent: + """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumTagContent enum.""" + return reflectapi_demo.tests.serde.TestEnumTagContent( + reflectapi_demo.tests.serde.TestEnumTagContentVariant2Variant( + field_0=field_0 + ) ) # Testing utilities -def create_reflectapidemotestsserdetestenumtagcontent_response( - value: ReflectapiDemoTestsSerdeTestEnumTagContent, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContent]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumTagContent.""" +def create_reflectapi_demo_tests_serde_testenumtagcontent_response( + value: reflectapi_demo.tests.serde.TestEnumTagContent, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContent]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumTagContent.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index 05faa3a5..6e3febd0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -118,6 +118,30 @@ class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumTagContentRenameAllVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant + ) + TestEnumTagContentRenameAllVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant + ) + TestEnumTagContentRenameAllVariants = ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariants + ) + TestEnumTagContentRenameAll = ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -126,15 +150,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll]: + data: Optional[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll]: Response containing ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll data + ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll]: Response containing reflectapi_demo.tests.serde.TestEnumTagContentRenameAll data """ path = "/inout_test" @@ -144,7 +168,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll, + response_model=reflectapi_demo.tests.serde.TestEnumTagContentRenameAll, ) @@ -169,15 +193,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll]: + data: Optional[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll]: Response containing ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll data + ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll]: Response containing reflectapi_demo.tests.serde.TestEnumTagContentRenameAll data """ path = "/inout_test" @@ -187,7 +211,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll, + response_model=reflectapi_demo.tests.serde.TestEnumTagContentRenameAll, ) @@ -212,35 +236,37 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll.model_rebuild() + reflectapi_demo.tests.serde.TestEnumTagContentRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumTagContentRenameAllFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEnumTagContentRenameAll variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll variants + reflectapi_demo.tests.serde.TestEnumTagContentRenameAll variants """ @staticmethod def variant1( field_name: int, - ) -> ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: - """Creates the 'variant1' variant of the ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll enum.""" - return ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant( + ) -> reflectapi_demo.tests.serde.TestEnumTagContentRenameAll: + """Creates the 'variant1' variant of the reflectapi_demo.tests.serde.TestEnumTagContentRenameAll enum.""" + return reflectapi_demo.tests.serde.TestEnumTagContentRenameAll( + reflectapi_demo.tests.serde.TestEnumTagContentRenameAllVariant1Variant( field_name=field_name ) ) @staticmethod - def variant2(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: - """Creates the 'variant2' variant of the ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll enum.""" - return ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant( + def variant2( + field_0: int, + ) -> reflectapi_demo.tests.serde.TestEnumTagContentRenameAll: + """Creates the 'variant2' variant of the reflectapi_demo.tests.serde.TestEnumTagContentRenameAll enum.""" + return reflectapi_demo.tests.serde.TestEnumTagContentRenameAll( + reflectapi_demo.tests.serde.TestEnumTagContentRenameAllVariant2Variant( field_0=field_0 ) ) @@ -249,10 +275,10 @@ class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllFactory: # Testing utilities -def create_reflectapidemotestsserdetestenumtagcontentrenameall_response( - value: ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll.""" +def create_reflectapi_demo_tests_serde_testenumtagcontentrenameall_response( + value: reflectapi_demo.tests.serde.TestEnumTagContentRenameAll, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumTagContentRenameAll.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap index a6946806..457cd286 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap @@ -48,6 +48,21 @@ ReflectapiDemoTestsSerdeTestEnumUntagged = Union[ ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumUntaggedVariant1 = ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1 + TestEnumUntaggedVariant2 = ReflectapiDemoTestsSerdeTestEnumUntaggedVariant2 + TestEnumUntagged = ReflectapiDemoTestsSerdeTestEnumUntagged + + class AsyncInoutClient: """Async client for inout operations.""" @@ -56,15 +71,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumUntagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumUntagged]: + data: Optional[reflectapi_demo.tests.serde.TestEnumUntagged] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumUntagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumUntagged]: Response containing ReflectapiDemoTestsSerdeTestEnumUntagged data + ApiResponse[reflectapi_demo.tests.serde.TestEnumUntagged]: Response containing reflectapi_demo.tests.serde.TestEnumUntagged data """ path = "/inout_test" @@ -74,7 +89,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumUntagged, + response_model=reflectapi_demo.tests.serde.TestEnumUntagged, ) @@ -99,15 +114,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumUntagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumUntagged]: + data: Optional[reflectapi_demo.tests.serde.TestEnumUntagged] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumUntagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumUntagged]: Response containing ReflectapiDemoTestsSerdeTestEnumUntagged data + ApiResponse[reflectapi_demo.tests.serde.TestEnumUntagged]: Response containing reflectapi_demo.tests.serde.TestEnumUntagged data """ path = "/inout_test" @@ -117,7 +132,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumUntagged, + response_model=reflectapi_demo.tests.serde.TestEnumUntagged, ) @@ -142,7 +157,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumUntagged.model_rebuild() + reflectapi_demo.tests.serde.TestEnumUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -152,10 +167,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdetestenumuntagged_response( - value: ReflectapiDemoTestsSerdeTestEnumUntagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumUntagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumUntagged.""" +def create_reflectapi_demo_tests_serde_testenumuntagged_response( + value: reflectapi_demo.tests.serde.TestEnumUntagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumUntagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumUntagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap index eb7b5e72..b442cb5c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap @@ -87,6 +87,25 @@ class ReflectapiDemoTestsSerdeTestEnumWithFieldSkip( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumWithFieldSkipVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant + ) + TestEnumWithFieldSkipVariants = ( + ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariants + ) + TestEnumWithFieldSkip = ReflectapiDemoTestsSerdeTestEnumWithFieldSkip + + class AsyncInoutClient: """Async client for inout operations.""" @@ -95,15 +114,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithFieldSkip] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithFieldSkip]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithFieldSkip] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithFieldSkip]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithFieldSkip]: Response containing ReflectapiDemoTestsSerdeTestEnumWithFieldSkip data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithFieldSkip]: Response containing reflectapi_demo.tests.serde.TestEnumWithFieldSkip data """ path = "/inout_test" @@ -113,7 +132,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithFieldSkip, + response_model=reflectapi_demo.tests.serde.TestEnumWithFieldSkip, ) @@ -138,15 +157,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithFieldSkip] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithFieldSkip]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithFieldSkip] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithFieldSkip]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithFieldSkip]: Response containing ReflectapiDemoTestsSerdeTestEnumWithFieldSkip data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithFieldSkip]: Response containing reflectapi_demo.tests.serde.TestEnumWithFieldSkip data """ path = "/inout_test" @@ -156,7 +175,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithFieldSkip, + response_model=reflectapi_demo.tests.serde.TestEnumWithFieldSkip, ) @@ -181,34 +200,34 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumWithFieldSkip.model_rebuild() + reflectapi_demo.tests.serde.TestEnumWithFieldSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumWithFieldSkipFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEnumWithFieldSkip variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumWithFieldSkipFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEnumWithFieldSkip variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumWithFieldSkip variants + reflectapi_demo.tests.serde.TestEnumWithFieldSkip variants """ @staticmethod - def variant1() -> ReflectapiDemoTestsSerdeTestEnumWithFieldSkip: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumWithFieldSkip enum.""" - return ReflectapiDemoTestsSerdeTestEnumWithFieldSkip( - ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant() + def variant1() -> reflectapi_demo.tests.serde.TestEnumWithFieldSkip: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithFieldSkip enum.""" + return reflectapi_demo.tests.serde.TestEnumWithFieldSkip( + reflectapi_demo.tests.serde.TestEnumWithFieldSkipVariant1Variant() ) # Testing utilities -def create_reflectapidemotestsserdetestenumwithfieldskip_response( - value: ReflectapiDemoTestsSerdeTestEnumWithFieldSkip, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithFieldSkip]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumWithFieldSkip.""" +def create_reflectapi_demo_tests_serde_testenumwithfieldskip_response( + value: reflectapi_demo.tests.serde.TestEnumWithFieldSkip, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithFieldSkip]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithFieldSkip.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index 9afc0e6d..f8503968 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -68,6 +68,20 @@ class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars(RootModel[Reflect raise ValueError(f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variant: {type(self.root)}") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + TestEnumWithRenameToInvalidCharsVariant1Variant = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant + TestEnumWithRenameToInvalidCharsVariants = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants + TestEnumWithRenameToInvalidChars = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars + + class AsyncInoutClient: """Async client for inout operations.""" @@ -76,15 +90,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars]: Response containing ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: Response containing reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars data """ path = "/inout_test" @@ -94,7 +108,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars, + response_model=reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars, ) @@ -120,15 +134,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars]: Response containing ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: Response containing reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars data """ path = "/inout_test" @@ -138,7 +152,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars, + response_model=reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars, ) @@ -164,29 +178,29 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars.model_rebuild() + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsFactory: - '''Factory class for creating ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumWithRenameToInvalidCharsFactory: + '''Factory class for creating reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variants + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars variants ''' @staticmethod - def variant1(field_name&&: int) -> ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars: - '''Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars enum.''' - return ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars(ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant(f=field_name&&)) + def variant1(field_name&&: int) -> reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars: + '''Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars enum.''' + return reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars(reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidCharsVariant1Variant(f=field_name&&)) # Testing utilities -def create_reflectapidemotestsserdetestenumwithrenametoinvalidchars_response(value: ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars.""" +def create_reflectapi_demo_tests_serde_testenumwithrenametoinvalidchars_response(value: reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap index 6c944ce4..9a98e8a6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap @@ -67,6 +67,40 @@ class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithVariantOtherV0 = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0 + ) + TestEnumWithVariantOther = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther + ) + + class output: + """Namespace for output types.""" + + TestEnumWithVariantOtherV0 = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0 + ) + TestEnumWithVariantOtherVariant1 = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1 + ) + TestEnumWithVariantOther = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -75,15 +109,17 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantOther + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther]: Response containing ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther data + ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: Response containing reflectapi_demo.tests.serde.output.TestEnumWithVariantOther data """ path = "/inout_test" @@ -93,7 +129,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther, + response_model=reflectapi_demo.tests.serde.output.TestEnumWithVariantOther, ) @@ -118,15 +154,17 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantOther + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther]: Response containing ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther data + ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: Response containing reflectapi_demo.tests.serde.output.TestEnumWithVariantOther data """ path = "/inout_test" @@ -136,7 +174,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther, + response_model=reflectapi_demo.tests.serde.output.TestEnumWithVariantOther, ) @@ -161,47 +199,47 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther.model_rebuild() + reflectapi_demo.tests.serde.input.TestEnumWithVariantOther.model_rebuild() + reflectapi_demo.tests.serde.output.TestEnumWithVariantOther.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherFactory: - """Factory class for creating ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther variants with ergonomic syntax. +class reflectapi_demo_tests_serde_input_TestEnumWithVariantOtherFactory: + """Factory class for creating reflectapi_demo.tests.serde.input.TestEnumWithVariantOther variants with ergonomic syntax. - ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther variants + reflectapi_demo.tests.serde.input.TestEnumWithVariantOther variants """ - V0 = ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0() + V0 = reflectapi_demo.tests.serde.input.TestEnumWithVariantOtherV0() -class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherFactory: - """Factory class for creating ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther variants with ergonomic syntax. +class reflectapi_demo_tests_serde_output_TestEnumWithVariantOtherFactory: + """Factory class for creating reflectapi_demo.tests.serde.output.TestEnumWithVariantOther variants with ergonomic syntax. - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther variants + reflectapi_demo.tests.serde.output.TestEnumWithVariantOther variants """ - V0 = ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0() - VARIANT1 = ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1() + V0 = reflectapi_demo.tests.serde.output.TestEnumWithVariantOtherV0() + VARIANT1 = reflectapi_demo.tests.serde.output.TestEnumWithVariantOtherVariant1() # Testing utilities -def create_reflectapidemotestsserdeinputtestenumwithvariantother_response( - value: ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther.""" +def create_reflectapi_demo_tests_serde_input_testenumwithvariantother_response( + value: reflectapi_demo.tests.serde.input.TestEnumWithVariantOther, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestEnumWithVariantOther]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestEnumWithVariantOther.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputtestenumwithvariantother_response( - value: ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther.""" +def create_reflectapi_demo_tests_serde_output_testenumwithvariantother_response( + value: reflectapi_demo.tests.serde.output.TestEnumWithVariantOther, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestEnumWithVariantOther.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap index da671e1c..266725a6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap @@ -32,6 +32,19 @@ class ReflectapiDemoTestsSerdeTestEnumWithVariantSkip(str, Enum): pass +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumWithVariantSkip = ReflectapiDemoTestsSerdeTestEnumWithVariantSkip + + class AsyncInoutClient: """Async client for inout operations.""" @@ -40,15 +53,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithVariantSkip] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantSkip]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithVariantSkip] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantSkip]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantSkip]: Response containing ReflectapiDemoTestsSerdeTestEnumWithVariantSkip data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantSkip]: Response containing reflectapi_demo.tests.serde.TestEnumWithVariantSkip data """ path = "/inout_test" @@ -58,7 +71,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithVariantSkip, + response_model=reflectapi_demo.tests.serde.TestEnumWithVariantSkip, ) @@ -83,15 +96,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithVariantSkip] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantSkip]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithVariantSkip] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantSkip]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantSkip]: Response containing ReflectapiDemoTestsSerdeTestEnumWithVariantSkip data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantSkip]: Response containing reflectapi_demo.tests.serde.TestEnumWithVariantSkip data """ path = "/inout_test" @@ -101,7 +114,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithVariantSkip, + response_model=reflectapi_demo.tests.serde.TestEnumWithVariantSkip, ) @@ -126,7 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumWithVariantSkip.model_rebuild() + reflectapi_demo.tests.serde.TestEnumWithVariantSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -136,10 +149,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdetestenumwithvariantskip_response( - value: ReflectapiDemoTestsSerdeTestEnumWithVariantSkip, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantSkip]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumWithVariantSkip.""" +def create_reflectapi_demo_tests_serde_testenumwithvariantskip_response( + value: reflectapi_demo.tests.serde.TestEnumWithVariantSkip, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantSkip]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithVariantSkip.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap index 7d1af585..fc18dd3d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap @@ -38,6 +38,31 @@ class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize(str, Enum _VARIANT1 = "_Variant1" +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithVariantSkipDeserialize = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize + ) + + class output: + """Namespace for output types.""" + + TestEnumWithVariantSkipDeserialize = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -47,16 +72,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize]: Response containing ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: Response containing reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize data """ path = "/inout_test" @@ -66,7 +93,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize, + response_model=reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize, ) @@ -92,16 +119,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize]: Response containing ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: Response containing reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize data """ path = "/inout_test" @@ -111,7 +140,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize, + response_model=reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize, ) @@ -136,8 +165,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize.model_rebuild() + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -147,17 +176,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputtestenumwithvariantskipdeserialize_response( - value: ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize.""" +def create_reflectapi_demo_tests_serde_input_testenumwithvariantskipdeserialize_response( + value: reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputtestenumwithvariantskipdeserialize_response( - value: ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize.""" +def create_reflectapi_demo_tests_serde_output_testenumwithvariantskipdeserialize_response( + value: reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap index ffbf3302..549066d4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap @@ -38,6 +38,32 @@ class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize(str, Enum): pass +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithVariantSkipSerialize = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize + ) + VARIANT1 = VARIANT1 + + class output: + """Namespace for output types.""" + + TestEnumWithVariantSkipSerialize = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -47,16 +73,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize]: Response containing ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: Response containing reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize data """ path = "/inout_test" @@ -66,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize, + response_model=reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize, ) @@ -92,16 +120,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize]: Response containing ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: Response containing reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize data """ path = "/inout_test" @@ -111,7 +141,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize, + response_model=reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize, ) @@ -136,8 +166,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize.model_rebuild() + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -147,17 +177,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputtestenumwithvariantskipserialize_response( - value: ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize.""" +def create_reflectapi_demo_tests_serde_input_testenumwithvariantskipserialize_response( + value: reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputtestenumwithvariantskipserialize_response( - value: ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize.""" +def create_reflectapi_demo_tests_serde_output_testenumwithvariantskipserialize_response( + value: reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap index 34370381..66a6694a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap @@ -92,6 +92,27 @@ class ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumWithVariantUntaggedVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant + ) + TestEnumWithVariantUntaggedVariants = ( + ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariants + ) + TestEnumWithVariantUntagged = ( + ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -100,15 +121,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged]: Response containing ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged]: Response containing reflectapi_demo.tests.serde.TestEnumWithVariantUntagged data """ path = "/inout_test" @@ -118,7 +139,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged, + response_model=reflectapi_demo.tests.serde.TestEnumWithVariantUntagged, ) @@ -143,15 +164,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged]: + data: Optional[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged]: Response containing ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged data + ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged]: Response containing reflectapi_demo.tests.serde.TestEnumWithVariantUntagged data """ path = "/inout_test" @@ -161,7 +182,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged, + response_model=reflectapi_demo.tests.serde.TestEnumWithVariantUntagged, ) @@ -186,24 +207,26 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged.model_rebuild() + reflectapi_demo.tests.serde.TestEnumWithVariantUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestEnumWithVariantUntaggedFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestEnumWithVariantUntagged variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged variants + reflectapi_demo.tests.serde.TestEnumWithVariantUntagged variants """ @staticmethod - def variant1(field_0: int) -> ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged: - """Creates the 'Variant1' variant of the ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged enum.""" - return ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged( - ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant( + def variant1( + field_0: int, + ) -> reflectapi_demo.tests.serde.TestEnumWithVariantUntagged: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithVariantUntagged enum.""" + return reflectapi_demo.tests.serde.TestEnumWithVariantUntagged( + reflectapi_demo.tests.serde.TestEnumWithVariantUntaggedVariant1Variant( field_0=field_0 ) ) @@ -212,10 +235,10 @@ class ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedFactory: # Testing utilities -def create_reflectapidemotestsserdetestenumwithvariantuntagged_response( - value: ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged.""" +def create_reflectapi_demo_tests_serde_testenumwithvariantuntagged_response( + value: reflectapi_demo.tests.serde.TestEnumWithVariantUntagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithVariantUntagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap index 0a057090..6bcc3051 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap @@ -36,6 +36,19 @@ class ReflectapiDemoTestsSerdeTest(BaseModel): json: Any +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -44,15 +57,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -62,7 +75,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -87,15 +100,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -105,7 +118,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -130,7 +143,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTest.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -140,10 +153,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdetest_response( - value: ReflectapiDemoTestsSerdeTest, -) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTest.""" +def create_reflectapi_demo_tests_serde_test_response( + value: reflectapi_demo.tests.serde.Test, +) -> ApiResponse[reflectapi_demo.tests.serde.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index 52e60f4e..35cb72da 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -106,7 +106,24 @@ class ReflectapiDemoTestsSerdeMessage(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) id: str - payload: ReflectapiDemoTestsSerdePayload + payload: reflectapi_demo.tests.serde.Payload + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + PayloadTextVariant = ReflectapiDemoTestsSerdePayloadTextVariant + PayloadBinaryVariant = ReflectapiDemoTestsSerdePayloadBinaryVariant + PayloadVariants = ReflectapiDemoTestsSerdePayloadVariants + Payload = ReflectapiDemoTestsSerdePayload + Message = ReflectapiDemoTestsSerdeMessage class AsyncInoutClient: @@ -117,15 +134,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeMessage] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMessage]: + data: Optional[reflectapi_demo.tests.serde.Message] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Message]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMessage]: Response containing ReflectapiDemoTestsSerdeMessage data + ApiResponse[reflectapi_demo.tests.serde.Message]: Response containing reflectapi_demo.tests.serde.Message data """ path = "/inout_test" @@ -135,7 +152,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMessage, + response_model=reflectapi_demo.tests.serde.Message, ) @@ -160,15 +177,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeMessage] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMessage]: + data: Optional[reflectapi_demo.tests.serde.Message] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Message]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMessage]: Response containing ReflectapiDemoTestsSerdeMessage data + ApiResponse[reflectapi_demo.tests.serde.Message]: Response containing reflectapi_demo.tests.serde.Message data """ path = "/inout_test" @@ -178,7 +195,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMessage, + response_model=reflectapi_demo.tests.serde.Message, ) @@ -203,49 +220,49 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeMessage.model_rebuild() - ReflectapiDemoTestsSerdePayload.model_rebuild() + reflectapi_demo.tests.serde.Message.model_rebuild() + reflectapi_demo.tests.serde.Payload.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdePayloadFactory: - """Factory class for creating ReflectapiDemoTestsSerdePayload variants with ergonomic syntax. +class reflectapi_demo_tests_serde_PayloadFactory: + """Factory class for creating reflectapi_demo.tests.serde.Payload variants with ergonomic syntax. - ReflectapiDemoTestsSerdePayload variants + reflectapi_demo.tests.serde.Payload variants """ @staticmethod - def text(body: str) -> ReflectapiDemoTestsSerdePayload: - """Creates the 'Text' variant of the ReflectapiDemoTestsSerdePayload enum.""" - return ReflectapiDemoTestsSerdePayload( - ReflectapiDemoTestsSerdePayloadTextVariant(body=body) + def text(body: str) -> reflectapi_demo.tests.serde.Payload: + """Creates the 'Text' variant of the reflectapi_demo.tests.serde.Payload enum.""" + return reflectapi_demo.tests.serde.Payload( + reflectapi_demo.tests.serde.PayloadTextVariant(body=body) ) @staticmethod - def binary(size: int) -> ReflectapiDemoTestsSerdePayload: - """Creates the 'Binary' variant of the ReflectapiDemoTestsSerdePayload enum.""" - return ReflectapiDemoTestsSerdePayload( - ReflectapiDemoTestsSerdePayloadBinaryVariant(size=size) + def binary(size: int) -> reflectapi_demo.tests.serde.Payload: + """Creates the 'Binary' variant of the reflectapi_demo.tests.serde.Payload enum.""" + return reflectapi_demo.tests.serde.Payload( + reflectapi_demo.tests.serde.PayloadBinaryVariant(size=size) ) # Testing utilities -def create_reflectapidemotestsserdemessage_response( - value: ReflectapiDemoTestsSerdeMessage, -) -> ApiResponse[ReflectapiDemoTestsSerdeMessage]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeMessage.""" +def create_reflectapi_demo_tests_serde_message_response( + value: reflectapi_demo.tests.serde.Message, +) -> ApiResponse[reflectapi_demo.tests.serde.Message]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Message.""" return create_api_response(value) -def create_reflectapidemotestsserdepayload_response( - value: ReflectapiDemoTestsSerdePayload, -) -> ApiResponse[ReflectapiDemoTestsSerdePayload]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdePayload.""" +def create_reflectapi_demo_tests_serde_payload_response( + value: reflectapi_demo.tests.serde.Payload, +) -> ApiResponse[reflectapi_demo.tests.serde.Payload]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Payload.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap index 7b29988d..f2c1905b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -100,7 +100,24 @@ class ReflectapiDemoTestsSerdeDrawing(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) name: str - shape: ReflectapiDemoTestsSerdeShape + shape: reflectapi_demo.tests.serde.Shape + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + ShapeCircleVariant = ReflectapiDemoTestsSerdeShapeCircleVariant + ShapeRectVariant = ReflectapiDemoTestsSerdeShapeRectVariant + ShapeVariants = ReflectapiDemoTestsSerdeShapeVariants + Shape = ReflectapiDemoTestsSerdeShape + Drawing = ReflectapiDemoTestsSerdeDrawing class AsyncInoutClient: @@ -111,15 +128,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeDrawing] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeDrawing]: + data: Optional[reflectapi_demo.tests.serde.Drawing] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Drawing]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeDrawing]: Response containing ReflectapiDemoTestsSerdeDrawing data + ApiResponse[reflectapi_demo.tests.serde.Drawing]: Response containing reflectapi_demo.tests.serde.Drawing data """ path = "/inout_test" @@ -129,7 +146,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeDrawing, + response_model=reflectapi_demo.tests.serde.Drawing, ) @@ -154,15 +171,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeDrawing] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeDrawing]: + data: Optional[reflectapi_demo.tests.serde.Drawing] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Drawing]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeDrawing]: Response containing ReflectapiDemoTestsSerdeDrawing data + ApiResponse[reflectapi_demo.tests.serde.Drawing]: Response containing reflectapi_demo.tests.serde.Drawing data """ path = "/inout_test" @@ -172,7 +189,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeDrawing, + response_model=reflectapi_demo.tests.serde.Drawing, ) @@ -197,49 +214,49 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeDrawing.model_rebuild() - ReflectapiDemoTestsSerdeShape.model_rebuild() + reflectapi_demo.tests.serde.Drawing.model_rebuild() + reflectapi_demo.tests.serde.Shape.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeShapeFactory: - """Factory class for creating ReflectapiDemoTestsSerdeShape variants with ergonomic syntax. +class reflectapi_demo_tests_serde_ShapeFactory: + """Factory class for creating reflectapi_demo.tests.serde.Shape variants with ergonomic syntax. - ReflectapiDemoTestsSerdeShape variants + reflectapi_demo.tests.serde.Shape variants """ @staticmethod - def circle(radius: float) -> ReflectapiDemoTestsSerdeShape: - """Creates the 'Circle' variant of the ReflectapiDemoTestsSerdeShape enum.""" - return ReflectapiDemoTestsSerdeShape( - ReflectapiDemoTestsSerdeShapeCircleVariant(radius=radius) + def circle(radius: float) -> reflectapi_demo.tests.serde.Shape: + """Creates the 'Circle' variant of the reflectapi_demo.tests.serde.Shape enum.""" + return reflectapi_demo.tests.serde.Shape( + reflectapi_demo.tests.serde.ShapeCircleVariant(radius=radius) ) @staticmethod - def rect(width: float, height: float) -> ReflectapiDemoTestsSerdeShape: - """Creates the 'Rect' variant of the ReflectapiDemoTestsSerdeShape enum.""" - return ReflectapiDemoTestsSerdeShape( - ReflectapiDemoTestsSerdeShapeRectVariant(width=width, height=height) + def rect(width: float, height: float) -> reflectapi_demo.tests.serde.Shape: + """Creates the 'Rect' variant of the reflectapi_demo.tests.serde.Shape enum.""" + return reflectapi_demo.tests.serde.Shape( + reflectapi_demo.tests.serde.ShapeRectVariant(width=width, height=height) ) # Testing utilities -def create_reflectapidemotestsserdedrawing_response( - value: ReflectapiDemoTestsSerdeDrawing, -) -> ApiResponse[ReflectapiDemoTestsSerdeDrawing]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeDrawing.""" +def create_reflectapi_demo_tests_serde_drawing_response( + value: reflectapi_demo.tests.serde.Drawing, +) -> ApiResponse[reflectapi_demo.tests.serde.Drawing]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Drawing.""" return create_api_response(value) -def create_reflectapidemotestsserdeshape_response( - value: ReflectapiDemoTestsSerdeShape, -) -> ApiResponse[ReflectapiDemoTestsSerdeShape]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeShape.""" +def create_reflectapi_demo_tests_serde_shape_response( + value: reflectapi_demo.tests.serde.Shape, +) -> ApiResponse[reflectapi_demo.tests.serde.Shape]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Shape.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap index d01eeeb5..7b558ed7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap @@ -70,6 +70,23 @@ class ReflectapiDemoTestsSerdeTest(RootModel): root: Annotated[Union[ReflectapiDemoTestsSerdeTestS], Field(discriminator="type")] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + S = ReflectapiDemoTestsSerdeS + A = ReflectapiDemoTestsSerdeA + B = ReflectapiDemoTestsSerdeB + TestS = ReflectapiDemoTestsSerdeTestS + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -78,15 +95,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -96,7 +113,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -121,15 +138,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -139,7 +156,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -164,60 +181,60 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeA.model_rebuild() - ReflectapiDemoTestsSerdeB.model_rebuild() - ReflectapiDemoTestsSerdeS.model_rebuild() - ReflectapiDemoTestsSerdeTest.model_rebuild() + reflectapi_demo.tests.serde.A.model_rebuild() + reflectapi_demo.tests.serde.B.model_rebuild() + reflectapi_demo.tests.serde.S.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTest variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestFactory: + """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTest variants + reflectapi_demo.tests.serde.Test variants """ @staticmethod def s( - field_0: ReflectapiDemoTestsSerdeS[ - ReflectapiDemoTestsSerdeA, ReflectapiDemoTestsSerdeB + field_0: reflectapi_demo.tests.serde.S[ + reflectapi_demo.tests.serde.A, reflectapi_demo.tests.serde.B ], - ) -> ReflectapiDemoTestsSerdeTestS: - """Creates the 'S' variant of the ReflectapiDemoTestsSerdeTest enum.""" - return ReflectapiDemoTestsSerdeTestS(field_0=field_0) + ) -> reflectapi_demo.tests.serde.TestS: + """Creates the 'S' variant of the reflectapi_demo.tests.serde.Test enum.""" + return reflectapi_demo.tests.serde.TestS(field_0=field_0) # Testing utilities -def create_reflectapidemotestsserdea_response( - value: ReflectapiDemoTestsSerdeA, -) -> ApiResponse[ReflectapiDemoTestsSerdeA]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeA.""" +def create_reflectapi_demo_tests_serde_a_response( + value: reflectapi_demo.tests.serde.A, +) -> ApiResponse[reflectapi_demo.tests.serde.A]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.A.""" return create_api_response(value) -def create_reflectapidemotestsserdeb_response( - value: ReflectapiDemoTestsSerdeB, -) -> ApiResponse[ReflectapiDemoTestsSerdeB]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeB.""" +def create_reflectapi_demo_tests_serde_b_response( + value: reflectapi_demo.tests.serde.B, +) -> ApiResponse[reflectapi_demo.tests.serde.B]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.B.""" return create_api_response(value) -def create_reflectapidemotestsserdes_response( - value: ReflectapiDemoTestsSerdeS, -) -> ApiResponse[ReflectapiDemoTestsSerdeS]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeS.""" +def create_reflectapi_demo_tests_serde_s_response( + value: reflectapi_demo.tests.serde.S, +) -> ApiResponse[reflectapi_demo.tests.serde.S]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.S.""" return create_api_response(value) -def create_reflectapidemotestsserdetest_response( - value: ReflectapiDemoTestsSerdeTest, -) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTest.""" +def create_reflectapi_demo_tests_serde_test_response( + value: reflectapi_demo.tests.serde.Test, +) -> ApiResponse[reflectapi_demo.tests.serde.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index fa06ce2b..e7dc0f0d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -95,6 +95,24 @@ except AttributeError: pass +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + OfferKindSingle = ReflectapiDemoTestsSerdeOfferKindSingle + OfferKindGroup = ReflectapiDemoTestsSerdeOfferKindGroup + OfferKind = ReflectapiDemoTestsSerdeOfferKind + OfferSingle = ReflectapiDemoTestsSerdeOfferSingle + OfferGroup = ReflectapiDemoTestsSerdeOfferGroup + Offer = ReflectapiDemoTestsSerdeOffer + + class AsyncInoutClient: """Async client for inout operations.""" @@ -103,15 +121,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeOffer] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOffer]: + data: Optional[reflectapi_demo.tests.serde.Offer] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Offer]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOffer]: Response containing ReflectapiDemoTestsSerdeOffer data + ApiResponse[reflectapi_demo.tests.serde.Offer]: Response containing reflectapi_demo.tests.serde.Offer data """ path = "/inout_test" @@ -121,7 +139,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOffer, + response_model=reflectapi_demo.tests.serde.Offer, ) @@ -146,15 +164,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeOffer] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOffer]: + data: Optional[reflectapi_demo.tests.serde.Offer] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Offer]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOffer]: Response containing ReflectapiDemoTestsSerdeOffer data + ApiResponse[reflectapi_demo.tests.serde.Offer]: Response containing reflectapi_demo.tests.serde.Offer data """ path = "/inout_test" @@ -164,7 +182,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOffer, + response_model=reflectapi_demo.tests.serde.Offer, ) @@ -189,45 +207,45 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeOffer.model_rebuild() - ReflectapiDemoTestsSerdeOfferKind.model_rebuild() + reflectapi_demo.tests.serde.Offer.model_rebuild() + reflectapi_demo.tests.serde.OfferKind.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeOfferKindFactory: - """Factory class for creating ReflectapiDemoTestsSerdeOfferKind variants with ergonomic syntax. +class reflectapi_demo_tests_serde_OfferKindFactory: + """Factory class for creating reflectapi_demo.tests.serde.OfferKind variants with ergonomic syntax. - ReflectapiDemoTestsSerdeOfferKind variants + reflectapi_demo.tests.serde.OfferKind variants """ @staticmethod - def single(business: str) -> ReflectapiDemoTestsSerdeOfferKindSingle: - """Creates the 'Single' variant of the ReflectapiDemoTestsSerdeOfferKind enum.""" - return ReflectapiDemoTestsSerdeOfferKindSingle(business=business) + def single(business: str) -> reflectapi_demo.tests.serde.OfferKindSingle: + """Creates the 'Single' variant of the reflectapi_demo.tests.serde.OfferKind enum.""" + return reflectapi_demo.tests.serde.OfferKindSingle(business=business) @staticmethod - def group(count: int) -> ReflectapiDemoTestsSerdeOfferKindGroup: - """Creates the 'Group' variant of the ReflectapiDemoTestsSerdeOfferKind enum.""" - return ReflectapiDemoTestsSerdeOfferKindGroup(count=count) + def group(count: int) -> reflectapi_demo.tests.serde.OfferKindGroup: + """Creates the 'Group' variant of the reflectapi_demo.tests.serde.OfferKind enum.""" + return reflectapi_demo.tests.serde.OfferKindGroup(count=count) # Testing utilities -def create_reflectapidemotestsserdeoffer_response( - value: ReflectapiDemoTestsSerdeOffer, -) -> ApiResponse[ReflectapiDemoTestsSerdeOffer]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOffer.""" +def create_reflectapi_demo_tests_serde_offer_response( + value: reflectapi_demo.tests.serde.Offer, +) -> ApiResponse[reflectapi_demo.tests.serde.Offer]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Offer.""" return create_api_response(value) -def create_reflectapidemotestsserdeofferkind_response( - value: ReflectapiDemoTestsSerdeOfferKind, -) -> ApiResponse[ReflectapiDemoTestsSerdeOfferKind]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOfferKind.""" +def create_reflectapi_demo_tests_serde_offerkind_response( + value: reflectapi_demo.tests.serde.OfferKind, +) -> ApiResponse[reflectapi_demo.tests.serde.OfferKind]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.OfferKind.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap index 4144ec6d..2f00cc92 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap @@ -47,6 +47,20 @@ class ReflectapiDemoTestsSerdeK(BaseModel): a: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + S = ReflectapiDemoTestsSerdeS + K = ReflectapiDemoTestsSerdeK + + class AsyncInoutClient: """Async client for inout operations.""" @@ -56,16 +70,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None] + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None]]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None]]: Response containing ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None] data + ApiResponse[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]]: Response containing reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] data """ path = "/inout_test" @@ -75,7 +91,9 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None], + response_model=reflectapi_demo.tests.serde.S[ + reflectapi_demo.tests.serde.K, None + ], ) @@ -101,16 +119,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None] + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None]]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None]]: Response containing ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None] data + ApiResponse[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]]: Response containing reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] data """ path = "/inout_test" @@ -120,7 +140,9 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeS[ReflectapiDemoTestsSerdeK, None], + response_model=reflectapi_demo.tests.serde.S[ + reflectapi_demo.tests.serde.K, None + ], ) @@ -145,8 +167,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeK.model_rebuild() - ReflectapiDemoTestsSerdeS.model_rebuild() + reflectapi_demo.tests.serde.K.model_rebuild() + reflectapi_demo.tests.serde.S.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -156,17 +178,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdek_response( - value: ReflectapiDemoTestsSerdeK, -) -> ApiResponse[ReflectapiDemoTestsSerdeK]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeK.""" +def create_reflectapi_demo_tests_serde_k_response( + value: reflectapi_demo.tests.serde.K, +) -> ApiResponse[reflectapi_demo.tests.serde.K]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.K.""" return create_api_response(value) -def create_reflectapidemotestsserdes_response( - value: ReflectapiDemoTestsSerdeS, -) -> ApiResponse[ReflectapiDemoTestsSerdeS]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeS.""" +def create_reflectapi_demo_tests_serde_s_response( + value: reflectapi_demo.tests.serde.S, +) -> ApiResponse[reflectapi_demo.tests.serde.S]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.S.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap index e99f2ef6..0a1be487 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap @@ -53,7 +53,23 @@ class ReflectapiDemoTestsSerdeCell(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) label: str - content: ReflectapiDemoTestsSerdeValue + content: reflectapi_demo.tests.serde.Value + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + ValueNum = ReflectapiDemoTestsSerdeValueNum + ValueText = ReflectapiDemoTestsSerdeValueText + Value = ReflectapiDemoTestsSerdeValue + Cell = ReflectapiDemoTestsSerdeCell class AsyncInoutClient: @@ -64,15 +80,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeCell] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeCell]: + data: Optional[reflectapi_demo.tests.serde.Cell] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Cell]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeCell]: Response containing ReflectapiDemoTestsSerdeCell data + ApiResponse[reflectapi_demo.tests.serde.Cell]: Response containing reflectapi_demo.tests.serde.Cell data """ path = "/inout_test" @@ -82,7 +98,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeCell, + response_model=reflectapi_demo.tests.serde.Cell, ) @@ -107,15 +123,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeCell] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeCell]: + data: Optional[reflectapi_demo.tests.serde.Cell] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Cell]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeCell]: Response containing ReflectapiDemoTestsSerdeCell data + ApiResponse[reflectapi_demo.tests.serde.Cell]: Response containing reflectapi_demo.tests.serde.Cell data """ path = "/inout_test" @@ -125,7 +141,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeCell, + response_model=reflectapi_demo.tests.serde.Cell, ) @@ -150,8 +166,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeCell.model_rebuild() - ReflectapiDemoTestsSerdeValue.model_rebuild() + reflectapi_demo.tests.serde.Cell.model_rebuild() + reflectapi_demo.tests.serde.Value.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -161,17 +177,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdecell_response( - value: ReflectapiDemoTestsSerdeCell, -) -> ApiResponse[ReflectapiDemoTestsSerdeCell]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeCell.""" +def create_reflectapi_demo_tests_serde_cell_response( + value: reflectapi_demo.tests.serde.Cell, +) -> ApiResponse[reflectapi_demo.tests.serde.Cell]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Cell.""" return create_api_response(value) -def create_reflectapidemotestsserdevalue_response( - value: ReflectapiDemoTestsSerdeValue, -) -> ApiResponse[ReflectapiDemoTestsSerdeValue]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeValue.""" +def create_reflectapi_demo_tests_serde_value_response( + value: reflectapi_demo.tests.serde.Value, +) -> ApiResponse[reflectapi_demo.tests.serde.Value]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Value.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap index 41943dfb..6436d4fc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap @@ -35,6 +35,19 @@ class ReflectapiDemoTestsSerdeTest(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -61,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -86,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -104,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -129,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTest.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdetest_response( - value: ReflectapiDemoTestsSerdeTest, -) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTest.""" +def create_reflectapi_demo_tests_serde_test_response( + value: reflectapi_demo.tests.serde.Test, +) -> ApiResponse[reflectapi_demo.tests.serde.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap index 158c65f4..b464b664 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap @@ -82,7 +82,7 @@ class ReflectapiDemoTestsSerdeTestV1(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) version: Literal["v1"] = "v1" - value: ReflectapiDemoTestsSerdeV1 + value: reflectapi_demo.tests.serde.V1 class ReflectapiDemoTestsSerdeTestV2(BaseModel): @@ -91,7 +91,7 @@ class ReflectapiDemoTestsSerdeTestV2(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) version: Literal["v2"] = "v2" - value: ReflectapiDemoTestsSerdeV2 + value: reflectapi_demo.tests.serde.V2 class ReflectapiDemoTestsSerdeTest(RootModel): @@ -101,6 +101,27 @@ class ReflectapiDemoTestsSerdeTest(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + V2C = ReflectapiDemoTestsSerdeV2C + V2D = ReflectapiDemoTestsSerdeV2D + V2 = ReflectapiDemoTestsSerdeV2 + V1A = ReflectapiDemoTestsSerdeV1A + V1B = ReflectapiDemoTestsSerdeV1B + V1 = ReflectapiDemoTestsSerdeV1 + TestV1 = ReflectapiDemoTestsSerdeTestV1 + TestV2 = ReflectapiDemoTestsSerdeTestV2 + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -109,15 +130,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -127,7 +148,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -152,15 +173,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -170,7 +191,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -195,87 +216,91 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTest.model_rebuild() - ReflectapiDemoTestsSerdeV1.model_rebuild() - ReflectapiDemoTestsSerdeV2.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() + reflectapi_demo.tests.serde.V1.model_rebuild() + reflectapi_demo.tests.serde.V2.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeV2Factory: - """Factory class for creating ReflectapiDemoTestsSerdeV2 variants with ergonomic syntax. +class reflectapi_demo_tests_serde_V2Factory: + """Factory class for creating reflectapi_demo.tests.serde.V2 variants with ergonomic syntax. - ReflectapiDemoTestsSerdeV2 variants + reflectapi_demo.tests.serde.V2 variants """ @staticmethod - def c(c: int) -> ReflectapiDemoTestsSerdeV2C: - """Creates the 'C' variant of the ReflectapiDemoTestsSerdeV2 enum.""" - return ReflectapiDemoTestsSerdeV2C(c=c) + def c(c: int) -> reflectapi_demo.tests.serde.V2C: + """Creates the 'C' variant of the reflectapi_demo.tests.serde.V2 enum.""" + return reflectapi_demo.tests.serde.V2C(c=c) @staticmethod - def d(d: int) -> ReflectapiDemoTestsSerdeV2D: - """Creates the 'D' variant of the ReflectapiDemoTestsSerdeV2 enum.""" - return ReflectapiDemoTestsSerdeV2D(d=d) + def d(d: int) -> reflectapi_demo.tests.serde.V2D: + """Creates the 'D' variant of the reflectapi_demo.tests.serde.V2 enum.""" + return reflectapi_demo.tests.serde.V2D(d=d) -class ReflectapiDemoTestsSerdeV1Factory: - """Factory class for creating ReflectapiDemoTestsSerdeV1 variants with ergonomic syntax. +class reflectapi_demo_tests_serde_V1Factory: + """Factory class for creating reflectapi_demo.tests.serde.V1 variants with ergonomic syntax. - ReflectapiDemoTestsSerdeV1 variants + reflectapi_demo.tests.serde.V1 variants """ @staticmethod - def a(a: int) -> ReflectapiDemoTestsSerdeV1A: - """Creates the 'A' variant of the ReflectapiDemoTestsSerdeV1 enum.""" - return ReflectapiDemoTestsSerdeV1A(a=a) + def a(a: int) -> reflectapi_demo.tests.serde.V1A: + """Creates the 'A' variant of the reflectapi_demo.tests.serde.V1 enum.""" + return reflectapi_demo.tests.serde.V1A(a=a) @staticmethod - def b(b: int) -> ReflectapiDemoTestsSerdeV1B: - """Creates the 'B' variant of the ReflectapiDemoTestsSerdeV1 enum.""" - return ReflectapiDemoTestsSerdeV1B(b=b) + def b(b: int) -> reflectapi_demo.tests.serde.V1B: + """Creates the 'B' variant of the reflectapi_demo.tests.serde.V1 enum.""" + return reflectapi_demo.tests.serde.V1B(b=b) -class ReflectapiDemoTestsSerdeTestFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTest variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestFactory: + """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTest variants + reflectapi_demo.tests.serde.Test variants """ @staticmethod - def v1(field_0: ReflectapiDemoTestsSerdeV1) -> ReflectapiDemoTestsSerdeTestV1: - """Creates the 'v1' variant of the ReflectapiDemoTestsSerdeTest enum.""" - return ReflectapiDemoTestsSerdeTestV1(field_0=field_0) + def v1( + field_0: reflectapi_demo.tests.serde.V1, + ) -> reflectapi_demo.tests.serde.TestV1: + """Creates the 'v1' variant of the reflectapi_demo.tests.serde.Test enum.""" + return reflectapi_demo.tests.serde.TestV1(field_0=field_0) @staticmethod - def v2(field_0: ReflectapiDemoTestsSerdeV2) -> ReflectapiDemoTestsSerdeTestV2: - """Creates the 'v2' variant of the ReflectapiDemoTestsSerdeTest enum.""" - return ReflectapiDemoTestsSerdeTestV2(field_0=field_0) + def v2( + field_0: reflectapi_demo.tests.serde.V2, + ) -> reflectapi_demo.tests.serde.TestV2: + """Creates the 'v2' variant of the reflectapi_demo.tests.serde.Test enum.""" + return reflectapi_demo.tests.serde.TestV2(field_0=field_0) # Testing utilities -def create_reflectapidemotestsserdetest_response( - value: ReflectapiDemoTestsSerdeTest, -) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTest.""" +def create_reflectapi_demo_tests_serde_test_response( + value: reflectapi_demo.tests.serde.Test, +) -> ApiResponse[reflectapi_demo.tests.serde.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" return create_api_response(value) -def create_reflectapidemotestsserdev1_response( - value: ReflectapiDemoTestsSerdeV1, -) -> ApiResponse[ReflectapiDemoTestsSerdeV1]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeV1.""" +def create_reflectapi_demo_tests_serde_v1_response( + value: reflectapi_demo.tests.serde.V1, +) -> ApiResponse[reflectapi_demo.tests.serde.V1]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.V1.""" return create_api_response(value) -def create_reflectapidemotestsserdev2_response( - value: ReflectapiDemoTestsSerdeV2, -) -> ApiResponse[ReflectapiDemoTestsSerdeV2]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeV2.""" +def create_reflectapi_demo_tests_serde_v2_response( + value: reflectapi_demo.tests.serde.V2, +) -> ApiResponse[reflectapi_demo.tests.serde.V2]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.V2.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap index f954a2b3..a14892b1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap @@ -45,7 +45,7 @@ class ReflectapiDemoTestsSerdeTestV1(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) version: Literal["v1"] = "v1" - value: ReflectapiDemoTestsSerdeV1 + value: reflectapi_demo.tests.serde.V1 class ReflectapiDemoTestsSerdeTest(RootModel): @@ -54,6 +54,22 @@ class ReflectapiDemoTestsSerdeTest(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + V1A = ReflectapiDemoTestsSerdeV1A + V1 = ReflectapiDemoTestsSerdeV1 + TestV1 = ReflectapiDemoTestsSerdeTestV1 + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -62,15 +78,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -80,7 +96,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -105,15 +121,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -123,7 +139,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -148,52 +164,54 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTest.model_rebuild() - ReflectapiDemoTestsSerdeV1.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() + reflectapi_demo.tests.serde.V1.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeV1Factory: - """Factory class for creating ReflectapiDemoTestsSerdeV1 variants with ergonomic syntax. +class reflectapi_demo_tests_serde_V1Factory: + """Factory class for creating reflectapi_demo.tests.serde.V1 variants with ergonomic syntax. - ReflectapiDemoTestsSerdeV1 variants + reflectapi_demo.tests.serde.V1 variants """ @staticmethod - def a(a: int) -> ReflectapiDemoTestsSerdeV1A: - """Creates the 'A' variant of the ReflectapiDemoTestsSerdeV1 enum.""" - return ReflectapiDemoTestsSerdeV1A(a=a) + def a(a: int) -> reflectapi_demo.tests.serde.V1A: + """Creates the 'A' variant of the reflectapi_demo.tests.serde.V1 enum.""" + return reflectapi_demo.tests.serde.V1A(a=a) -class ReflectapiDemoTestsSerdeTestFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTest variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestFactory: + """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTest variants + reflectapi_demo.tests.serde.Test variants """ @staticmethod - def v1(field_0: ReflectapiDemoTestsSerdeV1) -> ReflectapiDemoTestsSerdeTestV1: - """Creates the 'v1' variant of the ReflectapiDemoTestsSerdeTest enum.""" - return ReflectapiDemoTestsSerdeTestV1(field_0=field_0) + def v1( + field_0: reflectapi_demo.tests.serde.V1, + ) -> reflectapi_demo.tests.serde.TestV1: + """Creates the 'v1' variant of the reflectapi_demo.tests.serde.Test enum.""" + return reflectapi_demo.tests.serde.TestV1(field_0=field_0) # Testing utilities -def create_reflectapidemotestsserdetest_response( - value: ReflectapiDemoTestsSerdeTest, -) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTest.""" +def create_reflectapi_demo_tests_serde_test_response( + value: reflectapi_demo.tests.serde.Test, +) -> ApiResponse[reflectapi_demo.tests.serde.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" return create_api_response(value) -def create_reflectapidemotestsserdev1_response( - value: ReflectapiDemoTestsSerdeV1, -) -> ApiResponse[ReflectapiDemoTestsSerdeV1]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeV1.""" +def create_reflectapi_demo_tests_serde_v1_response( + value: reflectapi_demo.tests.serde.V1, +) -> ApiResponse[reflectapi_demo.tests.serde.V1]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.V1.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index 251f5b19..2caf1ee8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -138,6 +138,33 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestNewtypeVariantsAdjacentlyTaggedIntVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant + ) + TestNewtypeVariantsAdjacentlyTaggedStringVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant + ) + TestNewtypeVariantsAdjacentlyTaggedBoolVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant + ) + TestNewtypeVariantsAdjacentlyTaggedVariants = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedVariants + ) + TestNewtypeVariantsAdjacentlyTagged = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -147,16 +174,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged]: Response containing ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: Response containing reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged data """ path = "/inout_test" @@ -166,7 +193,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged, + response_model=reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged, ) @@ -192,16 +219,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged]: Response containing ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: Response containing reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged data """ path = "/inout_test" @@ -211,7 +238,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged, + response_model=reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged, ) @@ -236,26 +263,26 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged.model_rebuild() + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestNewtypeVariantsAdjacentlyTaggedFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged variants + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged variants """ @staticmethod def int( field_0: int, - ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: - """Creates the 'int' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged enum.""" - return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant( + ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: + """Creates the 'int' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged( + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTaggedIntVariant( field_0=field_0 ) ) @@ -263,10 +290,10 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedFactory: @staticmethod def string( field_0: str, - ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: - """Creates the 'string' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged enum.""" - return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant( + ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: + """Creates the 'string' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged( + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTaggedStringVariant( field_0=field_0 ) ) @@ -274,31 +301,29 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedFactory: @staticmethod def bool( field_0: bool, - ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: - """Creates the 'bool' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged enum.""" - return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant( + ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: + """Creates the 'bool' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged( + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTaggedBoolVariant( field_0=field_0 ) ) @staticmethod - def unit() -> ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: - """Creates the 'unit' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged enum.""" - return ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged.model_validate( - {"t": "unit"} - ) + def unit() -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: + """Creates the 'unit' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged.model_validate( + {"t": "unit"} ) # Testing utilities -def create_reflectapidemotestsserdetestnewtypevariantsadjacentlytagged_response( - value: ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged.""" +def create_reflectapi_demo_tests_serde_testnewtypevariantsadjacentlytagged_response( + value: reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index 2a7364e6..3ea138eb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -142,6 +142,33 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestNewtypeVariantsExternallyTaggedIntVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant + ) + TestNewtypeVariantsExternallyTaggedStringVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant + ) + TestNewtypeVariantsExternallyTaggedBoolVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant + ) + TestNewtypeVariantsExternallyTaggedVariants = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedVariants + ) + TestNewtypeVariantsExternallyTagged = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -151,16 +178,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged]: Response containing ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: Response containing reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged data """ path = "/inout_test" @@ -170,7 +197,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged, + response_model=reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged, ) @@ -196,16 +223,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged]: Response containing ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged data + ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: Response containing reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged data """ path = "/inout_test" @@ -215,7 +242,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged, + response_model=reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged, ) @@ -240,26 +267,26 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged.model_rebuild() + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedFactory: - """Factory class for creating ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged variants with ergonomic syntax. +class reflectapi_demo_tests_serde_TestNewtypeVariantsExternallyTaggedFactory: + """Factory class for creating reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged variants with ergonomic syntax. - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged variants + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged variants """ @staticmethod def int( field_0: int, - ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: - """Creates the 'int' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant( + ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: + """Creates the 'int' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged( + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTaggedIntVariant( field_0=field_0 ) ) @@ -267,10 +294,10 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedFactory: @staticmethod def string( field_0: str, - ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: - """Creates the 'string' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant( + ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: + """Creates the 'string' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged( + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTaggedStringVariant( field_0=field_0 ) ) @@ -278,27 +305,27 @@ class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedFactory: @staticmethod def bool( field_0: bool, - ) -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: - """Creates the 'bool' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant( + ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: + """Creates the 'bool' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged( + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTaggedBoolVariant( field_0=field_0 ) ) @staticmethod - def unit() -> ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: - """Creates the 'unit' variant of the ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged enum.""" - return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged("unit") + def unit() -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: + """Creates the 'unit' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" + return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged("unit") # Testing utilities -def create_reflectapidemotestsserdetestnewtypevariantsexternallytagged_response( - value: ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged.""" +def create_reflectapi_demo_tests_serde_testnewtypevariantsexternallytagged_response( + value: reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged, +) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap index 22c65585..6d2708f3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap @@ -71,6 +71,23 @@ class ReflectapiDemoTestsSerdeEnum(RootModel): ] +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Strukt2 = ReflectapiDemoTestsSerdeStrukt2 + Strukt1 = ReflectapiDemoTestsSerdeStrukt1 + EnumA = ReflectapiDemoTestsSerdeEnumA + EnumB = ReflectapiDemoTestsSerdeEnumB + Enum = ReflectapiDemoTestsSerdeEnum + + class AsyncInoutClient: """Async client for inout operations.""" @@ -79,15 +96,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeEnum] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeEnum]: + data: Optional[reflectapi_demo.tests.serde.Enum] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Enum]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeEnum]: Response containing ReflectapiDemoTestsSerdeEnum data + ApiResponse[reflectapi_demo.tests.serde.Enum]: Response containing reflectapi_demo.tests.serde.Enum data """ path = "/inout_test" @@ -97,7 +114,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeEnum, + response_model=reflectapi_demo.tests.serde.Enum, ) @@ -122,15 +139,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeEnum] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeEnum]: + data: Optional[reflectapi_demo.tests.serde.Enum] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Enum]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeEnum]: Response containing ReflectapiDemoTestsSerdeEnum data + ApiResponse[reflectapi_demo.tests.serde.Enum]: Response containing reflectapi_demo.tests.serde.Enum data """ path = "/inout_test" @@ -140,7 +157,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeEnum, + response_model=reflectapi_demo.tests.serde.Enum, ) @@ -165,53 +182,57 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeEnum.model_rebuild() - ReflectapiDemoTestsSerdeStrukt1.model_rebuild() - ReflectapiDemoTestsSerdeStrukt2.model_rebuild() + reflectapi_demo.tests.serde.Enum.model_rebuild() + reflectapi_demo.tests.serde.Strukt1.model_rebuild() + reflectapi_demo.tests.serde.Strukt2.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass # Factory classes (generated after model rebuild to avoid forward references) -class ReflectapiDemoTestsSerdeEnumFactory: - """Factory class for creating ReflectapiDemoTestsSerdeEnum variants with ergonomic syntax. +class reflectapi_demo_tests_serde_EnumFactory: + """Factory class for creating reflectapi_demo.tests.serde.Enum variants with ergonomic syntax. - ReflectapiDemoTestsSerdeEnum variants + reflectapi_demo.tests.serde.Enum variants """ @staticmethod - def a(field_0: ReflectapiDemoTestsSerdeStrukt1) -> ReflectapiDemoTestsSerdeEnumA: - """Creates the 'a' variant of the ReflectapiDemoTestsSerdeEnum enum.""" - return ReflectapiDemoTestsSerdeEnumA(field_0=field_0) + def a( + field_0: reflectapi_demo.tests.serde.Strukt1, + ) -> reflectapi_demo.tests.serde.EnumA: + """Creates the 'a' variant of the reflectapi_demo.tests.serde.Enum enum.""" + return reflectapi_demo.tests.serde.EnumA(field_0=field_0) @staticmethod - def b(field_0: ReflectapiDemoTestsSerdeStrukt2) -> ReflectapiDemoTestsSerdeEnumB: - """Creates the 'b' variant of the ReflectapiDemoTestsSerdeEnum enum.""" - return ReflectapiDemoTestsSerdeEnumB(field_0=field_0) + def b( + field_0: reflectapi_demo.tests.serde.Strukt2, + ) -> reflectapi_demo.tests.serde.EnumB: + """Creates the 'b' variant of the reflectapi_demo.tests.serde.Enum enum.""" + return reflectapi_demo.tests.serde.EnumB(field_0=field_0) # Testing utilities -def create_reflectapidemotestsserdeenum_response( - value: ReflectapiDemoTestsSerdeEnum, -) -> ApiResponse[ReflectapiDemoTestsSerdeEnum]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeEnum.""" +def create_reflectapi_demo_tests_serde_enum_response( + value: reflectapi_demo.tests.serde.Enum, +) -> ApiResponse[reflectapi_demo.tests.serde.Enum]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Enum.""" return create_api_response(value) -def create_reflectapidemotestsserdestrukt1_response( - value: ReflectapiDemoTestsSerdeStrukt1, -) -> ApiResponse[ReflectapiDemoTestsSerdeStrukt1]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeStrukt1.""" +def create_reflectapi_demo_tests_serde_strukt1_response( + value: reflectapi_demo.tests.serde.Strukt1, +) -> ApiResponse[reflectapi_demo.tests.serde.Strukt1]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Strukt1.""" return create_api_response(value) -def create_reflectapidemotestsserdestrukt2_response( - value: ReflectapiDemoTestsSerdeStrukt2, -) -> ApiResponse[ReflectapiDemoTestsSerdeStrukt2]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeStrukt2.""" +def create_reflectapi_demo_tests_serde_strukt2_response( + value: reflectapi_demo.tests.serde.Strukt2, +) -> ApiResponse[reflectapi_demo.tests.serde.Strukt2]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Strukt2.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap index 15a113de..16ebb838 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap @@ -41,6 +41,20 @@ class ReflectapiDemoTestsSerdeTestStructFromProxy(BaseModel): f: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructFrom = ReflectapiDemoTestsSerdeTestStructFrom + TestStructFromProxy = ReflectapiDemoTestsSerdeTestStructFromProxy + + class AsyncInoutClient: """Async client for inout operations.""" @@ -49,15 +63,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructFrom] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructFromProxy]: + data: Optional[reflectapi_demo.tests.serde.TestStructFrom] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructFromProxy]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructFromProxy]: Response containing ReflectapiDemoTestsSerdeTestStructFromProxy data + ApiResponse[reflectapi_demo.tests.serde.TestStructFromProxy]: Response containing reflectapi_demo.tests.serde.TestStructFromProxy data """ path = "/inout_test" @@ -67,7 +81,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructFromProxy, + response_model=reflectapi_demo.tests.serde.TestStructFromProxy, ) @@ -92,15 +106,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructFrom] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructFromProxy]: + data: Optional[reflectapi_demo.tests.serde.TestStructFrom] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructFromProxy]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructFromProxy]: Response containing ReflectapiDemoTestsSerdeTestStructFromProxy data + ApiResponse[reflectapi_demo.tests.serde.TestStructFromProxy]: Response containing reflectapi_demo.tests.serde.TestStructFromProxy data """ path = "/inout_test" @@ -110,7 +124,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructFromProxy, + response_model=reflectapi_demo.tests.serde.TestStructFromProxy, ) @@ -135,8 +149,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructFrom.model_rebuild() - ReflectapiDemoTestsSerdeTestStructFromProxy.model_rebuild() + reflectapi_demo.tests.serde.TestStructFrom.model_rebuild() + reflectapi_demo.tests.serde.TestStructFromProxy.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -146,17 +160,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructfrom_response( - value: ReflectapiDemoTestsSerdeTestStructFrom, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructFrom]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructFrom.""" +def create_reflectapi_demo_tests_serde_teststructfrom_response( + value: reflectapi_demo.tests.serde.TestStructFrom, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructFrom]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructFrom.""" return create_api_response(value) -def create_reflectapidemotestsserdeteststructfromproxy_response( - value: ReflectapiDemoTestsSerdeTestStructFromProxy, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructFromProxy]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructFromProxy.""" +def create_reflectapi_demo_tests_serde_teststructfromproxy_response( + value: reflectapi_demo.tests.serde.TestStructFromProxy, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructFromProxy]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructFromProxy.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap index aaa68672..7dd85357 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap @@ -41,6 +41,20 @@ class ReflectapiDemoTestsSerdeTestStructIntoProxy(BaseModel): f: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructInto = ReflectapiDemoTestsSerdeTestStructInto + TestStructIntoProxy = ReflectapiDemoTestsSerdeTestStructIntoProxy + + class AsyncInoutClient: """Async client for inout operations.""" @@ -49,15 +63,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructIntoProxy] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructInto]: + data: Optional[reflectapi_demo.tests.serde.TestStructIntoProxy] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructInto]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructInto]: Response containing ReflectapiDemoTestsSerdeTestStructInto data + ApiResponse[reflectapi_demo.tests.serde.TestStructInto]: Response containing reflectapi_demo.tests.serde.TestStructInto data """ path = "/inout_test" @@ -67,7 +81,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructInto, + response_model=reflectapi_demo.tests.serde.TestStructInto, ) @@ -92,15 +106,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructIntoProxy] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructInto]: + data: Optional[reflectapi_demo.tests.serde.TestStructIntoProxy] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructInto]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructInto]: Response containing ReflectapiDemoTestsSerdeTestStructInto data + ApiResponse[reflectapi_demo.tests.serde.TestStructInto]: Response containing reflectapi_demo.tests.serde.TestStructInto data """ path = "/inout_test" @@ -110,7 +124,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructInto, + response_model=reflectapi_demo.tests.serde.TestStructInto, ) @@ -135,8 +149,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructInto.model_rebuild() - ReflectapiDemoTestsSerdeTestStructIntoProxy.model_rebuild() + reflectapi_demo.tests.serde.TestStructInto.model_rebuild() + reflectapi_demo.tests.serde.TestStructIntoProxy.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -146,17 +160,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructinto_response( - value: ReflectapiDemoTestsSerdeTestStructInto, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructInto]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructInto.""" +def create_reflectapi_demo_tests_serde_teststructinto_response( + value: reflectapi_demo.tests.serde.TestStructInto, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructInto]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructInto.""" return create_api_response(value) -def create_reflectapidemotestsserdeteststructintoproxy_response( - value: ReflectapiDemoTestsSerdeTestStructIntoProxy, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructIntoProxy]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructIntoProxy.""" +def create_reflectapi_demo_tests_serde_teststructintoproxy_response( + value: reflectapi_demo.tests.serde.TestStructIntoProxy, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructIntoProxy]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructIntoProxy.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap index 10887da7..3750438a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap @@ -31,6 +31,19 @@ class ReflectapiDemoTestsSerdeMyStruct(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + MyStruct = ReflectapiDemoTestsSerdeMyStruct + + class AsyncInoutClient: """Async client for inout operations.""" @@ -39,15 +52,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeMyStruct] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMyStruct]: + data: Optional[reflectapi_demo.tests.serde.MyStruct] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.MyStruct]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMyStruct]: Response containing ReflectapiDemoTestsSerdeMyStruct data + ApiResponse[reflectapi_demo.tests.serde.MyStruct]: Response containing reflectapi_demo.tests.serde.MyStruct data """ path = "/inout_test" @@ -57,7 +70,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMyStruct, + response_model=reflectapi_demo.tests.serde.MyStruct, ) @@ -82,15 +95,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeMyStruct] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMyStruct]: + data: Optional[reflectapi_demo.tests.serde.MyStruct] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.MyStruct]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMyStruct]: Response containing ReflectapiDemoTestsSerdeMyStruct data + ApiResponse[reflectapi_demo.tests.serde.MyStruct]: Response containing reflectapi_demo.tests.serde.MyStruct data """ path = "/inout_test" @@ -100,7 +113,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMyStruct, + response_model=reflectapi_demo.tests.serde.MyStruct, ) @@ -125,7 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeMyStruct.model_rebuild() + reflectapi_demo.tests.serde.MyStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -135,10 +148,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdemystruct_response( - value: ReflectapiDemoTestsSerdeMyStruct, -) -> ApiResponse[ReflectapiDemoTestsSerdeMyStruct]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeMyStruct.""" +def create_reflectapi_demo_tests_serde_mystruct_response( + value: reflectapi_demo.tests.serde.MyStruct, +) -> ApiResponse[reflectapi_demo.tests.serde.MyStruct]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyStruct.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap index 075c183f..99a9d537 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap @@ -35,6 +35,19 @@ class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructRenameAll = ReflectapiDemoTestsSerdeTestStructRenameAll + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructRenameAll] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAll]: + data: Optional[reflectapi_demo.tests.serde.TestStructRenameAll] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAll]: Response containing ReflectapiDemoTestsSerdeTestStructRenameAll data + ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: Response containing reflectapi_demo.tests.serde.TestStructRenameAll data """ path = "/inout_test" @@ -61,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructRenameAll, + response_model=reflectapi_demo.tests.serde.TestStructRenameAll, ) @@ -86,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructRenameAll] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAll]: + data: Optional[reflectapi_demo.tests.serde.TestStructRenameAll] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAll]: Response containing ReflectapiDemoTestsSerdeTestStructRenameAll data + ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: Response containing reflectapi_demo.tests.serde.TestStructRenameAll data """ path = "/inout_test" @@ -104,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructRenameAll, + response_model=reflectapi_demo.tests.serde.TestStructRenameAll, ) @@ -129,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructRenameAll.model_rebuild() + reflectapi_demo.tests.serde.TestStructRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructrenameall_response( - value: ReflectapiDemoTestsSerdeTestStructRenameAll, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAll]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructRenameAll.""" +def create_reflectapi_demo_tests_serde_teststructrenameall_response( + value: reflectapi_demo.tests.serde.TestStructRenameAll, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructRenameAll.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap index 811b113a..c80fe7ad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap @@ -43,6 +43,31 @@ class ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructRenameAllDifferently = ( + ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently + ) + + class output: + """Namespace for output types.""" + + TestStructRenameAllDifferently = ( + ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -52,16 +77,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently + reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently]: + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently]: Response containing ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: Response containing reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently data """ path = "/inout_test" @@ -71,7 +96,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently, + response_model=reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently, ) @@ -97,16 +122,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently + reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently]: + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently]: Response containing ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: Response containing reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently data """ path = "/inout_test" @@ -116,7 +141,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently, + response_model=reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently, ) @@ -141,8 +166,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently.model_rebuild() + reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -152,17 +177,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputteststructrenamealldifferently_response( - value: ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently.""" +def create_reflectapi_demo_tests_serde_input_teststructrenamealldifferently_response( + value: reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputteststructrenamealldifferently_response( - value: ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently.""" +def create_reflectapi_demo_tests_serde_output_teststructrenamealldifferently_response( + value: reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap index 139193de..ba4ce6d0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap @@ -35,6 +35,21 @@ class ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructRenameAllPascalCase = ( + ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +58,17 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase]: + data: Optional[ + reflectapi_demo.tests.serde.TestStructRenameAllPascalCase + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase]: Response containing ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase data + ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: Response containing reflectapi_demo.tests.serde.TestStructRenameAllPascalCase data """ path = "/inout_test" @@ -61,7 +78,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase, + response_model=reflectapi_demo.tests.serde.TestStructRenameAllPascalCase, ) @@ -86,15 +103,17 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase]: + data: Optional[ + reflectapi_demo.tests.serde.TestStructRenameAllPascalCase + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase]: Response containing ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase data + ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: Response containing reflectapi_demo.tests.serde.TestStructRenameAllPascalCase data """ path = "/inout_test" @@ -104,7 +123,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase, + response_model=reflectapi_demo.tests.serde.TestStructRenameAllPascalCase, ) @@ -129,7 +148,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase.model_rebuild() + reflectapi_demo.tests.serde.TestStructRenameAllPascalCase.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +158,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructrenameallpascalcase_response( - value: ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase.""" +def create_reflectapi_demo_tests_serde_teststructrenameallpascalcase_response( + value: reflectapi_demo.tests.serde.TestStructRenameAllPascalCase, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructRenameAllPascalCase.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap index 4011c0f4..ff56290c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap @@ -37,6 +37,20 @@ class ReflectapiDemoTestsSerdeMyStructOutput(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + MyStructInput = ReflectapiDemoTestsSerdeMyStructInput + MyStructOutput = ReflectapiDemoTestsSerdeMyStructOutput + + class AsyncInoutClient: """Async client for inout operations.""" @@ -45,15 +59,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeMyStructInput] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMyStructOutput]: + data: Optional[reflectapi_demo.tests.serde.MyStructInput] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.MyStructOutput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMyStructOutput]: Response containing ReflectapiDemoTestsSerdeMyStructOutput data + ApiResponse[reflectapi_demo.tests.serde.MyStructOutput]: Response containing reflectapi_demo.tests.serde.MyStructOutput data """ path = "/inout_test" @@ -63,7 +77,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMyStructOutput, + response_model=reflectapi_demo.tests.serde.MyStructOutput, ) @@ -88,15 +102,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeMyStructInput] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeMyStructOutput]: + data: Optional[reflectapi_demo.tests.serde.MyStructInput] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.MyStructOutput]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeMyStructOutput]: Response containing ReflectapiDemoTestsSerdeMyStructOutput data + ApiResponse[reflectapi_demo.tests.serde.MyStructOutput]: Response containing reflectapi_demo.tests.serde.MyStructOutput data """ path = "/inout_test" @@ -106,7 +120,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeMyStructOutput, + response_model=reflectapi_demo.tests.serde.MyStructOutput, ) @@ -131,8 +145,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeMyStructInput.model_rebuild() - ReflectapiDemoTestsSerdeMyStructOutput.model_rebuild() + reflectapi_demo.tests.serde.MyStructInput.model_rebuild() + reflectapi_demo.tests.serde.MyStructOutput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -142,17 +156,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdemystructinput_response( - value: ReflectapiDemoTestsSerdeMyStructInput, -) -> ApiResponse[ReflectapiDemoTestsSerdeMyStructInput]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeMyStructInput.""" +def create_reflectapi_demo_tests_serde_mystructinput_response( + value: reflectapi_demo.tests.serde.MyStructInput, +) -> ApiResponse[reflectapi_demo.tests.serde.MyStructInput]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyStructInput.""" return create_api_response(value) -def create_reflectapidemotestsserdemystructoutput_response( - value: ReflectapiDemoTestsSerdeMyStructOutput, -) -> ApiResponse[ReflectapiDemoTestsSerdeMyStructOutput]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeMyStructOutput.""" +def create_reflectapi_demo_tests_serde_mystructoutput_response( + value: reflectapi_demo.tests.serde.MyStructOutput, +) -> ApiResponse[reflectapi_demo.tests.serde.MyStructOutput]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyStructOutput.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap index f03222ac..f31d9e09 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap @@ -43,6 +43,31 @@ class ReflectapiDemoTestsSerdeOutputTestStructRenameField(BaseModel): field_name: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructRenameField = ( + ReflectapiDemoTestsSerdeInputTestStructRenameField + ) + + class output: + """Namespace for output types.""" + + TestStructRenameField = ( + ReflectapiDemoTestsSerdeOutputTestStructRenameField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -51,15 +76,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeInputTestStructRenameField] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameField]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructRenameField] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameField]: Response containing ReflectapiDemoTestsSerdeOutputTestStructRenameField data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameField]: Response containing reflectapi_demo.tests.serde.output.TestStructRenameField data """ path = "/inout_test" @@ -69,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructRenameField, + response_model=reflectapi_demo.tests.serde.output.TestStructRenameField, ) @@ -94,15 +119,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeInputTestStructRenameField] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameField]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructRenameField] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameField]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameField]: Response containing ReflectapiDemoTestsSerdeOutputTestStructRenameField data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameField]: Response containing reflectapi_demo.tests.serde.output.TestStructRenameField data """ path = "/inout_test" @@ -112,7 +137,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructRenameField, + response_model=reflectapi_demo.tests.serde.output.TestStructRenameField, ) @@ -137,8 +162,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestStructRenameField.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestStructRenameField.model_rebuild() + reflectapi_demo.tests.serde.input.TestStructRenameField.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructRenameField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +173,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputteststructrenamefield_response( - value: ReflectapiDemoTestsSerdeInputTestStructRenameField, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestStructRenameField]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestStructRenameField.""" +def create_reflectapi_demo_tests_serde_input_teststructrenamefield_response( + value: reflectapi_demo.tests.serde.input.TestStructRenameField, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructRenameField]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructRenameField.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputteststructrenamefield_response( - value: ReflectapiDemoTestsSerdeOutputTestStructRenameField, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructRenameField]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestStructRenameField.""" +def create_reflectapi_demo_tests_serde_output_teststructrenamefield_response( + value: reflectapi_demo.tests.serde.output.TestStructRenameField, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameField]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructRenameField.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap index cf21d9c1..3bcf032d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap @@ -33,6 +33,19 @@ class ReflectapiDemoTestsSerdeTest(BaseModel): inner: bytes +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +54,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -59,7 +72,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -84,15 +97,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTest] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: + data: Optional[reflectapi_demo.tests.serde.Test] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Test]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTest]: Response containing ReflectapiDemoTestsSerdeTest data + ApiResponse[reflectapi_demo.tests.serde.Test]: Response containing reflectapi_demo.tests.serde.Test data """ path = "/inout_test" @@ -102,7 +115,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTest, + response_model=reflectapi_demo.tests.serde.Test, ) @@ -127,7 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTest.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +150,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdetest_response( - value: ReflectapiDemoTestsSerdeTest, -) -> ApiResponse[ReflectapiDemoTestsSerdeTest]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTest.""" +def create_reflectapi_demo_tests_serde_test_response( + value: reflectapi_demo.tests.serde.Test, +) -> ApiResponse[reflectapi_demo.tests.serde.Test]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap index 5d6d20fd..d626a550 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap @@ -41,6 +41,20 @@ class ReflectapiDemoTestsSerdeTestStructTryFrom(BaseModel): f: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructTryFormProxy = ReflectapiDemoTestsSerdeTestStructTryFormProxy + TestStructTryFrom = ReflectapiDemoTestsSerdeTestStructTryFrom + + class AsyncInoutClient: """Async client for inout operations.""" @@ -49,15 +63,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructTryFrom] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructTryFormProxy]: + data: Optional[reflectapi_demo.tests.serde.TestStructTryFrom] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructTryFormProxy]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructTryFormProxy]: Response containing ReflectapiDemoTestsSerdeTestStructTryFormProxy data + ApiResponse[reflectapi_demo.tests.serde.TestStructTryFormProxy]: Response containing reflectapi_demo.tests.serde.TestStructTryFormProxy data """ path = "/inout_test" @@ -67,7 +81,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructTryFormProxy, + response_model=reflectapi_demo.tests.serde.TestStructTryFormProxy, ) @@ -92,15 +106,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructTryFrom] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructTryFormProxy]: + data: Optional[reflectapi_demo.tests.serde.TestStructTryFrom] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructTryFormProxy]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructTryFormProxy]: Response containing ReflectapiDemoTestsSerdeTestStructTryFormProxy data + ApiResponse[reflectapi_demo.tests.serde.TestStructTryFormProxy]: Response containing reflectapi_demo.tests.serde.TestStructTryFormProxy data """ path = "/inout_test" @@ -110,7 +124,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructTryFormProxy, + response_model=reflectapi_demo.tests.serde.TestStructTryFormProxy, ) @@ -135,8 +149,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructTryFormProxy.model_rebuild() - ReflectapiDemoTestsSerdeTestStructTryFrom.model_rebuild() + reflectapi_demo.tests.serde.TestStructTryFormProxy.model_rebuild() + reflectapi_demo.tests.serde.TestStructTryFrom.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -146,17 +160,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructtryformproxy_response( - value: ReflectapiDemoTestsSerdeTestStructTryFormProxy, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructTryFormProxy]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructTryFormProxy.""" +def create_reflectapi_demo_tests_serde_teststructtryformproxy_response( + value: reflectapi_demo.tests.serde.TestStructTryFormProxy, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructTryFormProxy]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructTryFormProxy.""" return create_api_response(value) -def create_reflectapidemotestsserdeteststructtryfrom_response( - value: ReflectapiDemoTestsSerdeTestStructTryFrom, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructTryFrom]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructTryFrom.""" +def create_reflectapi_demo_tests_serde_teststructtryfrom_response( + value: reflectapi_demo.tests.serde.TestStructTryFrom, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructTryFrom]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructTryFrom.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap index 56b3044c..696101c1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap @@ -41,6 +41,22 @@ class ReflectapiDemoTestsSerdeTestStructWithFlatten(BaseModel): f: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithFlattenNested = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenNested + ) + TestStructWithFlatten = ReflectapiDemoTestsSerdeTestStructWithFlatten + + class AsyncInoutClient: """Async client for inout operations.""" @@ -49,15 +65,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructWithFlatten] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlatten]: + data: Optional[reflectapi_demo.tests.serde.TestStructWithFlatten] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlatten]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlatten]: Response containing ReflectapiDemoTestsSerdeTestStructWithFlatten data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlatten]: Response containing reflectapi_demo.tests.serde.TestStructWithFlatten data """ path = "/inout_test" @@ -67,7 +83,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithFlatten, + response_model=reflectapi_demo.tests.serde.TestStructWithFlatten, ) @@ -92,15 +108,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructWithFlatten] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlatten]: + data: Optional[reflectapi_demo.tests.serde.TestStructWithFlatten] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlatten]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlatten]: Response containing ReflectapiDemoTestsSerdeTestStructWithFlatten data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlatten]: Response containing reflectapi_demo.tests.serde.TestStructWithFlatten data """ path = "/inout_test" @@ -110,7 +126,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithFlatten, + response_model=reflectapi_demo.tests.serde.TestStructWithFlatten, ) @@ -135,8 +151,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructWithFlatten.model_rebuild() - ReflectapiDemoTestsSerdeTestStructWithFlattenNested.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlatten.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -146,17 +162,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructwithflatten_response( - value: ReflectapiDemoTestsSerdeTestStructWithFlatten, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlatten]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithFlatten.""" +def create_reflectapi_demo_tests_serde_teststructwithflatten_response( + value: reflectapi_demo.tests.serde.TestStructWithFlatten, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlatten]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlatten.""" return create_api_response(value) -def create_reflectapidemotestsserdeteststructwithflattennested_response( - value: ReflectapiDemoTestsSerdeTestStructWithFlattenNested, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithFlattenNested.""" +def create_reflectapi_demo_tests_serde_teststructwithflattennested_response( + value: reflectapi_demo.tests.serde.TestStructWithFlattenNested, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenNested.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap index df21728f..802ae43f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap @@ -42,6 +42,24 @@ class ReflectapiDemoTestsSerdeTestStructWithFlattenOptional(BaseModel): f: int | None = None +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithFlattenNested = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenNested + ) + TestStructWithFlattenOptional = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenOptional + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -50,15 +68,17 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructWithFlattenOptional] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptional]: + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptional + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptional]: Response containing ReflectapiDemoTestsSerdeTestStructWithFlattenOptional data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: Response containing reflectapi_demo.tests.serde.TestStructWithFlattenOptional data """ path = "/inout_test" @@ -68,7 +88,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithFlattenOptional, + response_model=reflectapi_demo.tests.serde.TestStructWithFlattenOptional, ) @@ -93,15 +113,17 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructWithFlattenOptional] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptional]: + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptional + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptional]: Response containing ReflectapiDemoTestsSerdeTestStructWithFlattenOptional data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: Response containing reflectapi_demo.tests.serde.TestStructWithFlattenOptional data """ path = "/inout_test" @@ -111,7 +133,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithFlattenOptional, + response_model=reflectapi_demo.tests.serde.TestStructWithFlattenOptional, ) @@ -136,8 +158,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructWithFlattenNested.model_rebuild() - ReflectapiDemoTestsSerdeTestStructWithFlattenOptional.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenOptional.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -147,17 +169,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructwithflattennested_response( - value: ReflectapiDemoTestsSerdeTestStructWithFlattenNested, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithFlattenNested.""" +def create_reflectapi_demo_tests_serde_teststructwithflattennested_response( + value: reflectapi_demo.tests.serde.TestStructWithFlattenNested, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenNested.""" return create_api_response(value) -def create_reflectapidemotestsserdeteststructwithflattenoptional_response( - value: ReflectapiDemoTestsSerdeTestStructWithFlattenOptional, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptional]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithFlattenOptional.""" +def create_reflectapi_demo_tests_serde_teststructwithflattenoptional_response( + value: reflectapi_demo.tests.serde.TestStructWithFlattenOptional, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenOptional.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap index 58b16a15..a82cf669 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap @@ -55,6 +55,25 @@ class ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired(BaseModel ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructRenameAll = ReflectapiDemoTestsSerdeTestStructRenameAll + TestStructWithFlattenNested = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenNested + ) + TestStructWithFlattenOptionalAndRequired = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,16 +83,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired]: Response containing ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: Response containing reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired data """ path = "/inout_test" @@ -83,7 +104,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired, + response_model=reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired, ) @@ -109,16 +130,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired]: Response containing ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: Response containing reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired data """ path = "/inout_test" @@ -128,7 +151,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired, + response_model=reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired, ) @@ -153,9 +176,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructRenameAll.model_rebuild() - ReflectapiDemoTestsSerdeTestStructWithFlattenNested.model_rebuild() - ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired.model_rebuild() + reflectapi_demo.tests.serde.TestStructRenameAll.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -165,24 +188,24 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructrenameall_response( - value: ReflectapiDemoTestsSerdeTestStructRenameAll, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructRenameAll]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructRenameAll.""" +def create_reflectapi_demo_tests_serde_teststructrenameall_response( + value: reflectapi_demo.tests.serde.TestStructRenameAll, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructRenameAll.""" return create_api_response(value) -def create_reflectapidemotestsserdeteststructwithflattennested_response( - value: ReflectapiDemoTestsSerdeTestStructWithFlattenNested, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenNested]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithFlattenNested.""" +def create_reflectapi_demo_tests_serde_teststructwithflattennested_response( + value: reflectapi_demo.tests.serde.TestStructWithFlattenNested, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenNested]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenNested.""" return create_api_response(value) -def create_reflectapidemotestsserdeteststructwithflattenoptionalandrequired_response( - value: ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired.""" +def create_reflectapi_demo_tests_serde_teststructwithflattenoptionalandrequired_response( + value: reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap index 461cc487..73c0a3ed 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap @@ -33,6 +33,21 @@ class ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars(BaseModel): f: int = Field(serialization_alias="field-name&&", validation_alias="field-name&&") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithRenameToInvalidChars = ( + ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -42,16 +57,16 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars + reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars]: Response containing ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: Response containing reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars data """ path = "/inout_test" @@ -61,7 +76,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars, + response_model=reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars, ) @@ -87,16 +102,16 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars + reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars]: + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars]: Response containing ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: Response containing reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars data """ path = "/inout_test" @@ -106,7 +121,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars, + response_model=reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars, ) @@ -131,7 +146,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -141,10 +156,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructwithrenametoinvalidchars_response( - value: ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars.""" +def create_reflectapi_demo_tests_serde_teststructwithrenametoinvalidchars_response( + value: reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap index 0a95d54a..86d04881 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap @@ -35,6 +35,19 @@ class ReflectapiDemoTestsSerdeStructName(BaseModel): ) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + StructName = ReflectapiDemoTestsSerdeStructName + + class AsyncInoutClient: """Async client for inout operations.""" @@ -43,15 +56,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeStructName] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeStructName]: + data: Optional[reflectapi_demo.tests.serde.StructName] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.StructName]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeStructName]: Response containing ReflectapiDemoTestsSerdeStructName data + ApiResponse[reflectapi_demo.tests.serde.StructName]: Response containing reflectapi_demo.tests.serde.StructName data """ path = "/inout_test" @@ -61,7 +74,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeStructName, + response_model=reflectapi_demo.tests.serde.StructName, ) @@ -86,15 +99,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeStructName] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeStructName]: + data: Optional[reflectapi_demo.tests.serde.StructName] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.StructName]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeStructName]: Response containing ReflectapiDemoTestsSerdeStructName data + ApiResponse[reflectapi_demo.tests.serde.StructName]: Response containing reflectapi_demo.tests.serde.StructName data """ path = "/inout_test" @@ -104,7 +117,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeStructName, + response_model=reflectapi_demo.tests.serde.StructName, ) @@ -129,7 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeStructName.model_rebuild() + reflectapi_demo.tests.serde.StructName.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -139,10 +152,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdestructname_response( - value: ReflectapiDemoTestsSerdeStructName, -) -> ApiResponse[ReflectapiDemoTestsSerdeStructName]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeStructName.""" +def create_reflectapi_demo_tests_serde_structname_response( + value: reflectapi_demo.tests.serde.StructName, +) -> ApiResponse[reflectapi_demo.tests.serde.StructName]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.StructName.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap index 1f18aa25..d43fd42b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap @@ -41,6 +41,31 @@ class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault(BaseModel): f: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSerdeDefault = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault + ) + + class output: + """Namespace for output types.""" + + TestStructWithSerdeDefault = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -49,15 +74,17 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault data """ path = "/inout_test" @@ -67,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault, ) @@ -92,15 +119,17 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault + ] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault data """ path = "/inout_test" @@ -110,7 +139,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault, ) @@ -135,8 +164,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault.model_rebuild() + reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -146,17 +175,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputteststructwithserdedefault_response( - value: ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault.""" +def create_reflectapi_demo_tests_serde_input_teststructwithserdedefault_response( + value: reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputteststructwithserdedefault_response( - value: ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault.""" +def create_reflectapi_demo_tests_serde_output_teststructwithserdedefault_response( + value: reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap index ba99b884..31680f7f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap @@ -31,6 +31,19 @@ class ReflectapiDemoTestsSerdeTestStructWithSerdeSkip(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithSerdeSkip = ReflectapiDemoTestsSerdeTestStructWithSerdeSkip + + class AsyncInoutClient: """Async client for inout operations.""" @@ -39,15 +52,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructWithSerdeSkip] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithSerdeSkip]: + data: Optional[reflectapi_demo.tests.serde.TestStructWithSerdeSkip] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithSerdeSkip]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithSerdeSkip]: Response containing ReflectapiDemoTestsSerdeTestStructWithSerdeSkip data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithSerdeSkip]: Response containing reflectapi_demo.tests.serde.TestStructWithSerdeSkip data """ path = "/inout_test" @@ -57,7 +70,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithSerdeSkip, + response_model=reflectapi_demo.tests.serde.TestStructWithSerdeSkip, ) @@ -82,15 +95,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStructWithSerdeSkip] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithSerdeSkip]: + data: Optional[reflectapi_demo.tests.serde.TestStructWithSerdeSkip] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithSerdeSkip]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStructWithSerdeSkip]: Response containing ReflectapiDemoTestsSerdeTestStructWithSerdeSkip data + ApiResponse[reflectapi_demo.tests.serde.TestStructWithSerdeSkip]: Response containing reflectapi_demo.tests.serde.TestStructWithSerdeSkip data """ path = "/inout_test" @@ -100,7 +113,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStructWithSerdeSkip, + response_model=reflectapi_demo.tests.serde.TestStructWithSerdeSkip, ) @@ -125,7 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStructWithSerdeSkip.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithSerdeSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -135,10 +148,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststructwithserdeskip_response( - value: ReflectapiDemoTestsSerdeTestStructWithSerdeSkip, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStructWithSerdeSkip]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStructWithSerdeSkip.""" +def create_reflectapi_demo_tests_serde_teststructwithserdeskip_response( + value: reflectapi_demo.tests.serde.TestStructWithSerdeSkip, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithSerdeSkip]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithSerdeSkip.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap index 62647334..3cb83f97 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap @@ -39,6 +39,31 @@ class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize(BaseModel f: int +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSerdeSkipDeserialize = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize + ) + + class output: + """Namespace for output types.""" + + TestStructWithSerdeSkipDeserialize = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -48,16 +73,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize data """ path = "/inout_test" @@ -67,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize, ) @@ -93,16 +120,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize data """ path = "/inout_test" @@ -112,7 +141,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize, ) @@ -137,8 +166,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize.model_rebuild() + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +177,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputteststructwithserdeskipdeserialize_response( - value: ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize.""" +def create_reflectapi_demo_tests_serde_input_teststructwithserdeskipdeserialize_response( + value: reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputteststructwithserdeskipdeserialize_response( - value: ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize.""" +def create_reflectapi_demo_tests_serde_output_teststructwithserdeskipdeserialize_response( + value: reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap index b69f3d69..e1801cc5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap @@ -39,6 +39,31 @@ class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize(BaseModel): f: int = Field(serialization_alias="_f", validation_alias="_f") +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class output: + """Namespace for output types.""" + + TestStructWithSerdeSkipSerialize = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize + ) + + class input: + """Namespace for input types.""" + + TestStructWithSerdeSkipSerialize = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -48,16 +73,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize data """ path = "/inout_test" @@ -67,7 +94,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize, ) @@ -93,16 +120,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize data """ path = "/inout_test" @@ -112,7 +141,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize, ) @@ -137,8 +166,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize.model_rebuild() + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -148,17 +177,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputteststructwithserdeskipserialize_response( - value: ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize.""" +def create_reflectapi_demo_tests_serde_input_teststructwithserdeskipserialize_response( + value: reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputteststructwithserdeskipserialize_response( - value: ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize.""" +def create_reflectapi_demo_tests_serde_output_teststructwithserdeskipserialize_response( + value: reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap index 48f3c6df..8d9fa490 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap @@ -42,6 +42,31 @@ class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf(BaseModel f: int | None = None +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSerdeSkipSerializeIf = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf + ) + + class output: + """Namespace for output types.""" + + TestStructWithSerdeSkipSerializeIf = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -51,16 +76,18 @@ class AsyncInoutClient: async def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf data """ path = "/inout_test" @@ -70,7 +97,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf, ) @@ -96,16 +123,18 @@ class InoutClient: def test( self, data: Optional[ - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf ] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf]: + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf + ]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf]: Response containing ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf data + ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: Response containing reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf data """ path = "/inout_test" @@ -115,7 +144,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf, + response_model=reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf, ) @@ -140,8 +169,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf.model_rebuild() - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf.model_rebuild() + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -151,17 +180,17 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeinputteststructwithserdeskipserializeif_response( - value: ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf, -) -> ApiResponse[ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf.""" +def create_reflectapi_demo_tests_serde_input_teststructwithserdeskipserializeif_response( + value: reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf, +) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf.""" return create_api_response(value) -def create_reflectapidemotestsserdeoutputteststructwithserdeskipserializeif_response( - value: ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf, -) -> ApiResponse[ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf.""" +def create_reflectapi_demo_tests_serde_output_teststructwithserdeskipserializeif_response( + value: reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf, +) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap index 610b4665..f11567aa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap @@ -33,6 +33,19 @@ class ReflectapiDemoTestsSerdeTestStruct(BaseModel): timezone: str +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStruct = ReflectapiDemoTestsSerdeTestStruct + + class AsyncInoutClient: """Async client for inout operations.""" @@ -41,15 +54,15 @@ class AsyncInoutClient: async def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStruct] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: + data: Optional[reflectapi_demo.tests.serde.TestStruct] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: Response containing ReflectapiDemoTestsSerdeTestStruct data + ApiResponse[reflectapi_demo.tests.serde.TestStruct]: Response containing reflectapi_demo.tests.serde.TestStruct data """ path = "/inout_test" @@ -59,7 +72,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStruct, + response_model=reflectapi_demo.tests.serde.TestStruct, ) @@ -84,15 +97,15 @@ class InoutClient: def test( self, - data: Optional[ReflectapiDemoTestsSerdeTestStruct] = None, - ) -> ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: + data: Optional[reflectapi_demo.tests.serde.TestStruct] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: """ Args: data: Request data for the test operation. Returns: - ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: Response containing ReflectapiDemoTestsSerdeTestStruct data + ApiResponse[reflectapi_demo.tests.serde.TestStruct]: Response containing reflectapi_demo.tests.serde.TestStruct data """ path = "/inout_test" @@ -102,7 +115,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=ReflectapiDemoTestsSerdeTestStruct, + response_model=reflectapi_demo.tests.serde.TestStruct, ) @@ -127,7 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - ReflectapiDemoTestsSerdeTestStruct.model_rebuild() + reflectapi_demo.tests.serde.TestStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass @@ -137,10 +150,10 @@ except AttributeError: # Testing utilities -def create_reflectapidemotestsserdeteststruct_response( - value: ReflectapiDemoTestsSerdeTestStruct, -) -> ApiResponse[ReflectapiDemoTestsSerdeTestStruct]: - """Create a mock ApiResponse for ReflectapiDemoTestsSerdeTestStruct.""" +def create_reflectapi_demo_tests_serde_teststruct_response( + value: reflectapi_demo.tests.serde.TestStruct, +) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStruct.""" return create_api_response(value) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 32695114..e95f6be0 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -12,6 +12,79 @@ struct FactoryInfo { is_internally_tagged: bool, } +/// Convert a dotted Python type reference to a valid Python identifier +/// for use as a class name (e.g., for factory classes at the top level). +/// +/// Example: `"reflectapi_demo.tests.serde.OfferKind"` → `"reflectapi_demo_tests_serde_OfferKindFactory"` +fn dotted_to_flat_identifier(dotted: &str, suffix: &str) -> String { + format!("{}{}", dotted.replace('.', "_"), suffix) +} + +/// Compute the dotted namespace prefix for a Rust qualified name. +/// +/// For `"a::b::Leaf"` returns `"a.b."`. For a single-segment name returns `""`. +fn namespace_prefix_for(original_name: &str) -> String { + let parts: Vec<&str> = original_name.split("::").collect(); + if parts.len() <= 1 { + return String::new(); + } + let ns_parts = &parts[..parts.len() - 1]; + let mut prefix = ns_parts.join("."); + prefix.push('.'); + prefix +} + +/// Convert flat union member names to dotted namespace references. +/// +/// The flat names (like `ReflectapiDemoTestsSerdeOfferKindSingle`) have the +/// PascalCase namespace prefix stripped to produce leaf names (like +/// `OfferKindSingle`), then the dotted namespace prefix is prepended to +/// produce `reflectapi_demo.tests.serde.OfferKindSingle`. +/// +/// Members that already contain a dot are left unchanged. Literal types are +/// also left unchanged since they are values, not class references. +fn prefix_union_members(members: &[String], original_name: &str) -> Vec { + let dotted_prefix = namespace_prefix_for(original_name); + if dotted_prefix.is_empty() { + return members.to_vec(); + } + + // Compute the flat PascalCase prefix that was prepended by improve_class_name. + // For "reflectapi_demo::tests::serde::OfferKind", the namespace segments are + // ["reflectapi_demo", "tests", "serde"], and the flat prefix is "ReflectapiDemoTestsSerde". + let ns_segments: Vec<&str> = original_name.split("::").collect(); + let flat_prefix: String = ns_segments[..ns_segments.len() - 1] + .iter() + .map(|seg| to_pascal_case(seg)) + .collect::>() + .join(""); + + members + .iter() + .map(|m| { + if m.contains('.') || m.starts_with("Literal[") { + m.clone() + } else { + // Strip the flat namespace prefix to get the leaf name, then + // prepend the dotted namespace prefix. + let (base, generics_suffix) = if let Some(bracket_pos) = m.find('[') { + (&m[..bracket_pos], &m[bracket_pos..]) + } else { + (m.as_str(), "") + }; + + let leaf = if base.starts_with(&flat_prefix) { + &base[flat_prefix.len()..] + } else { + base + }; + + format!("{dotted_prefix}{leaf}{generics_suffix}") + } + }) + .collect() +} + fn to_valid_python_identifier(name: &str) -> String { safe_python_identifier(name) } @@ -1092,6 +1165,56 @@ __all__ = {} ) } +/// Build a tree of namespace modules from rendered type strings. +/// +/// Each original type name is split on `::`. The last segment is the leaf +/// type (already rendered); the preceding segments define the namespace path. +/// The rendered code for each type is placed into the leaf module. +fn modules_from_rendered_types( + original_type_names: Vec, + mut rendered_types: BTreeMap, +) -> templates::Module { + use indexmap::IndexMap; + + let mut root_module = templates::Module { + name: String::new(), + types: vec![], + submodules: IndexMap::new(), + }; + + for original_type_name in original_type_names { + let mut module = &mut root_module; + let mut parts: Vec<&str> = original_type_name.split("::").collect(); + parts.pop(); // Remove the leaf type name — already embedded in the rendered code. + for part in parts { + module = module + .submodules + .entry(part.to_string()) + .or_insert_with(|| templates::Module { + name: part.to_string(), + types: vec![], + submodules: IndexMap::new(), + }); + } + if let Some(rendered_type) = rendered_types.remove(&original_type_name) { + let flat_name = improve_class_name(&original_type_name); + let leaf_name = improve_class_name_part( + original_type_name + .split("::") + .last() + .unwrap_or(&original_type_name), + ); + module.types.push(templates::ModuleType { + rendered: rendered_type, + flat_name, + leaf_name, + }); + } + } + + root_module +} + pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let implemented_types = build_implemented_types(); @@ -1256,6 +1379,9 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { sorted }); + // Track the insertion order so the module tree preserves topological ordering. + let mut rendered_original_names_in_order: Vec = Vec::new(); + for original_type_name in sorted_type_names { // Skip types provided by the runtime if runtime_provided_types.contains(&original_type_name.as_str()) { @@ -1263,7 +1389,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { } let type_def = schema.get_type(&original_type_name).unwrap(); - let name = improve_class_name(type_def.name()); // TypeVars have already been collected, use empty set for rendering let mut dummy_type_vars = BTreeSet::new(); @@ -1281,11 +1406,21 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Only store non-empty renders (excludes unwrapped tuple structs) if !rendered.trim().is_empty() { - rendered_types.insert(name.clone(), rendered.clone()); - generated_code.push(rendered); + rendered_types.insert(original_type_name.clone(), rendered); + rendered_original_names_in_order.push(original_type_name); } } + // Build namespace module tree and render it + let module_tree = modules_from_rendered_types( + rendered_original_names_in_order.clone(), + rendered_types.clone(), + ); + let module_tree_code = module_tree.render(); + if !module_tree_code.trim().is_empty() { + generated_code.push(module_tree_code); + } + // TypeVar declarations are now generated at the top of the file (after imports) // Generate client class with nested method organization @@ -1347,14 +1482,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { }; generated_code.push(client_template.render()); - // Generate nested class structure - let nested_classes = generate_nested_class_structure(&rendered_types, &schema); - if !nested_classes.is_empty() { - generated_code.push("# Nested class definitions for better organization".to_string()); - generated_code.push(nested_classes); - generated_code.push("".to_string()); - } - // Add external type definitions and model rebuilds for Pydantic forward references let mut external_types_and_rebuilds = vec![ "# External type definitions".to_string(), @@ -1368,9 +1495,10 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { ]; let mut sorted_type_names: Vec<_> = rendered_types.keys().collect(); sorted_type_names.sort(); - for type_name in sorted_type_names { - if !type_name.starts_with("std::") && !type_name.starts_with("reflectapi::") { - external_types_and_rebuilds.push(format!(" {type_name}.model_rebuild()")); + for original_name in sorted_type_names { + if !original_name.starts_with("std::") && !original_name.starts_with("reflectapi::") { + let dotted = type_name_to_python_ref(original_name); + external_types_and_rebuilds.push(format!(" {dotted}.model_rebuild()")); } } external_types_and_rebuilds.push("except AttributeError:".to_string()); @@ -1415,7 +1543,10 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { if config.generate_testing { // contains user-defined types that have Pydantic classes generated for them. // Note types with fallbacks to primitives are not added. - let mut user_defined_types: Vec = rendered_types.keys().cloned().collect(); + let mut user_defined_types: Vec = rendered_types + .keys() + .map(|original_name| type_name_to_python_ref(original_name)) + .collect(); user_defined_types.sort(); let testing_template = templates::TestingModule { @@ -1886,11 +2017,13 @@ fn render_enum_without_factory( used_type_vars, )?; - // Return factory info so it can be generated later + // Return factory info so it can be generated later. + // Use dotted path for the enum name so factory classes can reference + // types that live inside namespace classes. let factory_info = FactoryInfo { enum_def: enum_def.clone(), - enum_name: improve_class_name(&enum_def.name), - union_members: union_variant_names, + enum_name: type_name_to_python_ref(&enum_def.name), + union_members: prefix_union_members(&union_variant_names, &enum_def.name), is_internally_tagged: true, }; @@ -1910,8 +2043,8 @@ fn render_enum_without_factory( // Return factory info so it can be generated later let factory_info = FactoryInfo { enum_def: enum_def.clone(), - enum_name: improve_class_name(&enum_def.name), - union_members: union_variant_names, + enum_name: type_name_to_python_ref(&enum_def.name), + union_members: prefix_union_members(&union_variant_names, &enum_def.name), is_internally_tagged: false, // Adjacent tagged, not internal }; @@ -1951,8 +2084,8 @@ fn render_enum_without_factory( )?; let factory_info = FactoryInfo { enum_def: enum_def.clone(), - enum_name: improve_class_name(&enum_def.name), - union_members, + enum_name: type_name_to_python_ref(&enum_def.name), + union_members: prefix_union_members(&union_members, &enum_def.name), is_internally_tagged: false, }; Ok((rendered, Some(factory_info))) @@ -2534,7 +2667,7 @@ fn generate_factory_class_with_representation( ) -> anyhow::Result { use reflectapi_schema::Fields; - let factory_name = format!("{enum_name}Factory"); + let factory_name = dotted_to_flat_identifier(enum_name, "Factory"); let mut class_attributes = Vec::new(); let mut static_methods = Vec::new(); @@ -2705,7 +2838,7 @@ fn generate_internally_tagged_factory_class( ) -> anyhow::Result { use reflectapi_schema::Fields; - let factory_name = format!("{enum_name}Factory"); + let factory_name = dotted_to_flat_identifier(enum_name, "Factory"); let mut class_attributes = Vec::new(); let mut static_methods = Vec::new(); @@ -2783,7 +2916,7 @@ fn generate_externally_tagged_factory_class( ) -> anyhow::Result { use reflectapi_schema::Fields; - let factory_name = format!("{enum_name}Factory"); + let factory_name = dotted_to_flat_identifier(enum_name, "Factory"); let class_attributes: Vec = Vec::new(); let mut static_methods = Vec::new(); @@ -3782,12 +3915,18 @@ fn to_pascal_case(s: &str) -> String { .collect() } -/// Improve Python class names to be more readable and Pythonic +/// Produce a unique flat Python class name from a potentially-qualified Rust +/// type name. +/// +/// For qualified names (containing `::`), ALL segments are joined into a +/// single PascalCase identifier to guarantee uniqueness across namespaces. +/// For example: `"reflectapi_demo::tests::serde::Offer"` → `"ReflectapiDemoTestsSerdeOffer"`. +/// +/// For type *references* (in annotations), use [`type_name_to_python_ref`] +/// instead, which produces a dotted path like `reflectapi_demo.tests.serde.Offer`. fn improve_class_name(original_name: &str) -> String { - // Handle Rust module paths with :: (e.g., "nomatches::IfConflictOnInsert" -> "NomatchesIfConflictOnInsert") + // Handle Rust module paths with :: if original_name.contains("::") { - // Convert Rust-style module paths to PascalCase - // e.g., "nomatches::IfConflictOnInsertRequired" -> "NomatchesIfConflictOnInsertRequired" let parts: Vec<&str> = original_name.split("::").collect(); return parts .iter() @@ -3798,15 +3937,35 @@ fn improve_class_name(original_name: &str) -> String { // Handle dotted namespaces (e.g., "myapi.model.Pet" -> "Pet") if original_name.contains('.') { - let parts: Vec<&str> = original_name.split('.').collect(); - if let Some(last_part) = parts.last() { - return improve_class_name_part(last_part); + if let Some(pos) = original_name.rfind('.') { + return improve_class_name_part(&original_name[pos + 1..]); } } improve_class_name_part(original_name) } +/// Convert a fully-qualified Rust type name to a dotted Python reference. +/// +/// Each `::` segment becomes a dot-separated component. Namespace segments +/// keep their original casing (typically snake_case), while the final leaf +/// segment is run through `improve_class_name_part` (PascalCase). +/// +/// Example: `"reflectapi_demo::tests::serde::Offer"` → `"reflectapi_demo.tests.serde.Offer"` +fn type_name_to_python_ref(original_name: &str) -> String { + let parts: Vec<&str> = original_name.split("::").collect(); + if parts.len() <= 1 { + // No namespace — just return the PascalCase leaf. + return improve_class_name(original_name); + } + // Namespace segments keep their original casing; the leaf gets PascalCase. + let namespace_parts = &parts[..parts.len() - 1]; + let leaf = parts.last().unwrap(); + let mut dotted_parts: Vec = namespace_parts.iter().map(|p| p.to_string()).collect(); + dotted_parts.push(improve_class_name_part(leaf)); + dotted_parts.join(".") +} + /// Improve a single part of a class name fn improve_class_name_part(name_part: &str) -> String { let pascal_name = to_pascal_case(name_part); @@ -3882,199 +4041,6 @@ fn to_screaming_snake_case(s: &str) -> String { to_snake_case(s).to_uppercase() } -/// Generate nested class structure for better Python ergonomics -fn generate_nested_class_structure( - rendered_types: &BTreeMap, - _schema: &Schema, -) -> String { - let mut nested_classes = Vec::new(); - let mut namespace_groups: BTreeMap> = BTreeMap::new(); - - // Group types by their namespace - for type_name in rendered_types.keys() { - if let Some(namespace) = extract_namespace_from_type_name(type_name) { - namespace_groups - .entry(namespace) - .or_default() - .push(type_name.clone()); - } - } - - // Special handling for Kind unions - try to associate them with their related Input/Output types - if let Some(unknown_kinds) = namespace_groups.remove("UnknownKind") { - for kind_type in unknown_kinds { - if kind_type == "MyapiModelKind" { - // Look for related Pet types - if namespace_groups.contains_key("Pet") { - namespace_groups.get_mut("Pet").unwrap().push(kind_type); - } - } - } - } - - // Generate nested classes for each namespace group - let mut namespace_pairs: Vec<_> = namespace_groups.into_iter().collect(); - namespace_pairs.sort_by(|a, b| a.0.cmp(&b.0)); // Sort by namespace name for deterministic output - for (namespace, type_names) in namespace_pairs { - if type_names.len() >= 2 { - // Only create nested classes if there are enough related types - let nested_class = generate_namespace_class(&namespace, &type_names, rendered_types); - if !nested_class.is_empty() { - nested_classes.push(nested_class); - } - } - } - - nested_classes.join("\n\n") -} - -/// Extract namespace from a type name (e.g., "MyapiModelInputPet" -> "Pet") -fn extract_namespace_from_type_name(type_name: &str) -> Option { - // Look for patterns like "MyapiModelXxxYyy" -> "Yyy" - if let Some(without_prefix) = type_name.strip_prefix("MyapiModel") { - // Look for common patterns - if let Some(stripped) = without_prefix.strip_prefix("Input") { - return Some(stripped.to_string()); // Remove "Input" - } else if let Some(stripped) = without_prefix.strip_prefix("Output") { - return Some(stripped.to_string()); // Remove "Output" - } else if let Some(remainder) = without_prefix.strip_prefix("Kind") { - if remainder.is_empty() { - // This is the main Kind union type like "MyapiModelKind" - assign to a generic namespace - // We need to infer which namespace this belongs to from the schema context - // For now, return a generic namespace that we can map later - return Some("UnknownKind".to_string()); - } else { - return Some(remainder.to_string()); // Return the variant name - } - } else { - return Some(without_prefix.to_string()); - } - } else if let Some(without_prefix) = type_name.strip_prefix("MyapiProto") { - // Extract base name from request/response patterns - if let Some(pos) = without_prefix.find("Request") { - return Some(without_prefix[..pos].to_string()); - } else if let Some(pos) = without_prefix.find("Response") { - return Some(without_prefix[..pos].to_string()); - } else if let Some(pos) = without_prefix.find("Error") { - return Some(without_prefix[..pos].to_string()); - } - } - - None -} - -/// Generate a namespace class containing related types -fn generate_namespace_class( - namespace: &str, - type_names: &[String], - _rendered_types: &BTreeMap, -) -> String { - let mut class_content = Vec::new(); - - // Find the main types for this namespace - let mut input_type = None; - let mut output_type = None; - let mut kind_variants = Vec::new(); - let mut request_types = Vec::new(); - let mut error_types = Vec::new(); - - for type_name in type_names { - if type_name.contains("Input") { - input_type = Some(type_name); - } else if type_name.contains("Output") { - output_type = Some(type_name); - } else if type_name.contains("Kind") { - // Include both individual variants (MyapiModelKindDog) and the union type (MyapiModelKind) - kind_variants.push(type_name); - } else if type_name.contains("Request") { - request_types.push(type_name); - } else if type_name.contains("Error") { - error_types.push(type_name); - } - } - - // Only generate if we have meaningful groupings - if input_type.is_some() || output_type.is_some() || !kind_variants.is_empty() { - class_content.push(format!("class {namespace}:")); - class_content.push(" \"\"\"Grouped types for better organization.\"\"\"".to_string()); - - // Add type aliases for the main types - if let Some(input) = input_type { - class_content.push(format!(" Input = {input}")); - } - if let Some(output) = output_type { - class_content.push(format!(" Output = {output}")); - } - - // Special handling for Kind types - check if there's a main union type we should expose - let main_kind_type = "MyapiModelKind".to_string(); - if kind_variants.contains(&(&main_kind_type)) { - class_content.push(" ".to_string()); - class_content.push(" class Kind:".to_string()); - class_content.push(" \"\"\"Kind variants for this type.\"\"\"".to_string()); - class_content.push(format!(" Union = {main_kind_type}")); - - // Also manually add the variants we know exist for common types - if namespace == "Pet" { - class_content.push(" Dog = MyapiModelKindDog".to_string()); - class_content.push(" Cat = MyapiModelKindCat".to_string()); - } - } - - // Add requests nested class if we have request types - if !request_types.is_empty() { - class_content.push(" ".to_string()); - class_content.push(" class Requests:".to_string()); - class_content.push(" \"\"\"Request types for this namespace.\"\"\"".to_string()); - - for request_name in &request_types { - if let Some(request_suffix) = extract_request_suffix(request_name) { - class_content.push(format!(" {request_suffix} = {request_name}")); - } - } - } - - // Add errors nested class if we have error types - if !error_types.is_empty() { - class_content.push(" ".to_string()); - class_content.push(" class Errors:".to_string()); - class_content.push(" \"\"\"Error types for this namespace.\"\"\"".to_string()); - - for error_name in &error_types { - if let Some(error_suffix) = extract_error_suffix(error_name) { - class_content.push(format!(" {error_suffix} = {error_name}")); - } - } - } - - return class_content.join("\n"); - } - - String::new() -} - -/// Extract meaningful suffix from request type name -fn extract_request_suffix(request_name: &str) -> Option { - if let Some(pos) = request_name.find("Request") { - let prefix = &request_name[..pos]; - if let Some(stripped) = prefix.strip_prefix("MyapiProto") { - return Some(stripped.to_string()); - } - } - None -} - -/// Extract meaningful suffix from error type name -fn extract_error_suffix(error_name: &str) -> Option { - if let Some(pos) = error_name.find("Error") { - let prefix = &error_name[..pos]; - if let Some(stripped) = prefix.strip_prefix("MyapiProto") { - return Some(stripped.to_string()); - } - } - None -} - fn sanitize_field_name(s: &str) -> String { let mut result = to_valid_python_identifier(&to_snake_case(s)); // Strip leading underscores - Pydantic v2 treats _-prefixed fields as private @@ -4272,7 +4238,8 @@ fn type_ref_to_python_type( } } - let base_type = improve_class_name(&type_ref.name); + // Use dotted namespace path for type references (e.g. "mod::Sub::Ty" → "mod.Sub.Ty") + let base_type = type_name_to_python_ref(&type_ref.name); // Handle generic types with arguments - follow TypeScript pattern if !type_ref.arguments.is_empty() { @@ -5025,6 +4992,185 @@ fn sanitize_description(desc: &str) -> String { pub mod templates { use std::fmt::Write; + use indexmap::IndexMap; + + /// A tree node representing a Python namespace. + /// + /// Types are always rendered at the module top-level (no nesting) to + /// avoid Python class-scope resolution issues. The namespace hierarchy + /// is then rendered as a separate set of namespace `class` wrappers + /// that contain type aliases pointing to the top-level definitions. + /// This allows dotted access like `reflectapi_demo.tests.serde.Offer` + /// while keeping all type definitions in the module globals where + /// Pydantic can resolve forward-reference annotation strings. + /// Entry in a Module's type list: the rendered code plus metadata + /// needed for namespace alias generation. + pub struct ModuleType { + /// The rendered Python source code for this type. + pub rendered: String, + /// The flat class name used at module top-level (e.g., `ReflectapiDemoTestsSerdeOffer`). + pub flat_name: String, + /// The PascalCase leaf name for namespace aliases (e.g., `Offer`). + pub leaf_name: String, + } + + pub struct Module { + pub name: String, + pub types: Vec, + pub submodules: IndexMap, + } + + impl Module { + fn is_empty(&self) -> bool { + self.types.is_empty() && self.submodules.values().all(|m| m.is_empty()) + } + + fn has_namespaces(&self) -> bool { + !self.submodules.is_empty() + } + + /// Render this module tree as Python source code. + /// + /// Produces two sections: + /// 1. All type definitions at module top-level (flat) + /// 2. Namespace class hierarchy with aliases for dotted access + pub fn render(&self) -> String { + let mut out = String::new(); + + // Part 1: Emit all types at the top level (flat). + self.collect_types_flat(&mut out); + + // Part 2: Emit namespace class hierarchy with aliases. + if self.has_namespaces() { + writeln!(out).unwrap(); + writeln!(out, "# Namespace classes for dotted access to types").unwrap(); + self.render_namespace_aliases(&mut out, 0); + } + + out + } + + /// Recursively collect all type definitions from the tree and emit + /// them at the top level (no indentation wrapping). + fn collect_types_flat(&self, out: &mut String) { + for mt in &self.types { + out.push_str(&mt.rendered); + out.push('\n'); + } + for sub in self.submodules.values() { + sub.collect_types_flat(out); + } + } + + /// Extract class and type-alias names defined in rendered type code. + /// + /// Looks for patterns like `class FooBar(` or `FooBarVariants = ` + /// at the start of lines. + fn extract_defined_names(type_code: &str) -> Vec { + let mut names = Vec::new(); + for line in type_code.lines() { + let trimmed = line.trim(); + if let Some(rest) = trimmed.strip_prefix("class ") { + if let Some(paren) = rest.find('(') { + let name = &rest[..paren]; + if !name.is_empty() { + names.push(name.to_string()); + } + } else if let Some(colon) = rest.find(':') { + let name = &rest[..colon]; + if !name.is_empty() { + names.push(name.to_string()); + } + } + } else if let Some(eq_pos) = trimmed.find(" = ") { + let name = &trimmed[..eq_pos]; + if name.chars().next().is_some_and(|c| c.is_ascii_uppercase()) { + names.push(name.to_string()); + } + } + } + names + } + + /// Render namespace alias classes for dotted access. + /// + /// `ns_path` accumulates the namespace segments for computing the + /// flat name prefix that needs to be stripped. + fn render_namespace_aliases(&self, out: &mut String, indent_level: usize) { + self.render_namespace_aliases_inner(out, indent_level, &[]); + } + + fn render_namespace_aliases_inner( + &self, + out: &mut String, + indent_level: usize, + ns_path: &[&str], + ) { + for sub in self.submodules.values() { + if sub.is_empty() { + continue; + } + let indent = " ".repeat(indent_level * 4); + let inner_indent = " ".repeat((indent_level + 1) * 4); + + writeln!(out, "{indent}class {}:", sub.name).unwrap(); + writeln!( + out, + "{inner_indent}\"\"\"Namespace for {} types.\"\"\"", + sub.name + ) + .unwrap(); + + // Compute the flat PascalCase prefix for this namespace level. + // e.g., for path ["reflectapi_demo", "tests", "serde"], prefix = "ReflectapiDemoTestsSerde" + let mut full_path: Vec<&str> = ns_path.to_vec(); + full_path.push(&sub.name); + let flat_prefix: String = full_path + .iter() + .map(|seg| { + // PascalCase each segment (same logic as to_pascal_case) + seg.replace("::", "_") + .split('_') + .map(|word| { + let mut chars = word.chars(); + match chars.next() { + None => String::new(), + Some(first) => first.to_uppercase().chain(chars).collect(), + } + }) + .collect::>() + .join("") + }) + .collect::>() + .join(""); + + // Add aliases for ALL names defined in this module's type code. + // Strip the flat namespace prefix to produce leaf alias names. + for mt in &sub.types { + for flat_name in Self::extract_defined_names(&mt.rendered) { + let leaf = if flat_name.starts_with(&flat_prefix) { + &flat_name[flat_prefix.len()..] + } else { + &flat_name + }; + // Skip empty leaves (shouldn't happen, but be safe) + if !leaf.is_empty() { + writeln!(out, "{inner_indent}{leaf} = {flat_name}").unwrap(); + } + } + } + + // Recurse into submodules + if !sub.submodules.is_empty() { + writeln!(out).unwrap(); + sub.render_namespace_aliases_inner(out, indent_level + 1, &full_path); + } + + writeln!(out).unwrap(); + } + } + } + pub struct FileHeader { pub package_name: String, } @@ -5705,13 +5851,12 @@ pub mod templates { writeln!(s, "# Testing utilities").unwrap(); writeln!(s).unwrap(); for type_name in &self.types { + // Convert dotted type ref to a valid Python function name fragment + let func_suffix = type_name.replace('.', "_").to_lowercase(); writeln!(s).unwrap(); writeln!( s, - "def create_{}_response(value: {}) -> ApiResponse[{}]:", - type_name.to_lowercase(), - type_name, - type_name + "def create_{func_suffix}_response(value: {type_name}) -> ApiResponse[{type_name}]:", ) .unwrap(); writeln!( From 302452f8cb2a6b38295d73debbd4b912ea98741b Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 19:33:47 +1300 Subject: [PATCH 27/47] fix: namespace alias extraction skips enum members and Variants - extract_defined_names now only matches top-level definitions (no leading whitespace), preventing enum member values like NOT_FOUND from leaking into namespace alias classes - Filter out SCREAMING_SNAKE_CASE constants (enum members) - Filter out *Variants internal union type aliases from namespace (implementation details, not part of the public API surface) --- reflectapi-demo/clients/python/generated.py | 6 ------ ...__tests__basic__reflectapi_enum_documented-4.snap | 4 ---- ...__basic__reflectapi_enum_with_skip_variant-5.snap | 4 ---- ..._reflectapi_struct_with_additional_derives-5.snap | 1 - .../reflectapi_demo__tests__enums__enum-4.snap | 2 -- ...ectapi_demo__tests__enums__enum_rename_num-5.snap | 2 -- ..._basic_variant_and_fields_and_named_fields-4.snap | 1 - ...nums__enum_with_discriminant_ignored_input-4.snap | 2 -- ...ums__enum_with_discriminant_ignored_output-4.snap | 2 -- ...tests__enums__enum_with_discriminant_input-4.snap | 2 -- ...ests__enums__enum_with_discriminant_output-4.snap | 2 -- ..._enums__enum_with_empty_variant_and_fields-4.snap | 3 --- ...ctapi_demo__tests__enums__enum_with_fields-4.snap | 3 --- ...api_demo__tests__enums__enum_with_generics-4.snap | 4 ---- ...ests__enums__enum_with_generics_and_fields-4.snap | 4 ---- ..._with_generics_and_fields_and_named_fields-4.snap | 2 -- ...internally_tagged_enum_with_tuple_variants-5.snap | 2 -- ...s__serde__empty_variants_adjacently_tagged-5.snap | 3 --- ...s__serde__empty_variants_externally_tagged-5.snap | 3 --- ...reflectapi_demo__tests__serde__enum_rename-5.snap | 2 -- ...ectapi_demo__tests__serde__enum_rename_all-5.snap | 1 - ...__tests__serde__enum_rename_all_on_variant-5.snap | 3 --- ...o__tests__serde__enum_rename_variant_field-5.snap | 3 --- ...ctapi_demo__tests__serde__enum_tag_content-5.snap | 3 --- ..._tests__serde__enum_tag_content_rename_all-5.snap | 3 --- ...i_demo__tests__serde__enum_with_field_skip-5.snap | 3 --- ...__serde__enum_with_rename_to_invalid_chars-5.snap | 1 - ...s__serde__enum_with_variant_skip_serialize-5.snap | 1 - ...__tests__serde__enum_with_variant_untagged-5.snap | 3 --- ...erde__flatten_adjacently_tagged_enum_field-5.snap | 1 - ...erde__flatten_externally_tagged_enum_field-5.snap | 1 - ..._serde__newtype_variants_adjacently_tagged-5.snap | 3 --- ..._serde__newtype_variants_externally_tagged-5.snap | 3 --- reflectapi/src/codegen/python.rs | 12 +++++++++++- 34 files changed, 11 insertions(+), 84 deletions(-) diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index 825d85e4..efa92485 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -442,14 +442,11 @@ class proto: """Namespace for proto types.""" PetsRemoveError = MyapiProtoPetsRemoveError - NOT_FOUND = NOT_FOUND - NOT_AUTHORIZED = NOT_AUTHORIZED Headers = MyapiProtoHeaders InternalError = MyapiProtoInternalError PetsCreateErrorInvalidIdentityVariant = ( MyapiProtoPetsCreateErrorInvalidIdentityVariant ) - PetsCreateErrorVariants = MyapiProtoPetsCreateErrorVariants PetsCreateError = MyapiProtoPetsCreateError PetsRemoveRequest = MyapiProtoPetsRemoveRequest ValidationA = MyapiProtoValidationA @@ -460,11 +457,9 @@ class proto: PetsListErrorInternal = MyapiProtoPetsListErrorInternal PetsListError = MyapiProtoPetsListError ValidationErrorValidationAVariant = MyapiProtoValidationErrorValidationAVariant - ValidationErrorVariants = MyapiProtoValidationErrorVariants ValidationError = MyapiProtoValidationError PetsUpdateRequest = MyapiProtoPetsUpdateRequest PetsUpdateErrorValidationVariant = MyapiProtoPetsUpdateErrorValidationVariant - PetsUpdateErrorVariants = MyapiProtoPetsUpdateErrorVariants PetsUpdateError = MyapiProtoPetsUpdateError class model: @@ -472,7 +467,6 @@ class model: BehaviorAggressiveVariant = MyapiModelBehaviorAggressiveVariant BehaviorOtherVariant = MyapiModelBehaviorOtherVariant - BehaviorVariants = MyapiModelBehaviorVariants Behavior = MyapiModelBehavior KindDog = MyapiModelKindDog KindCat = MyapiModelKindCat diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap index 81a64347..5c65b944 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap @@ -130,16 +130,12 @@ class reflectapi_demo: class basic: """Namespace for basic types.""" - T = T TestEnumDocumentedVariant1Variant = ( ReflectapiDemoTestsBasicTestEnumDocumentedVariant1Variant ) TestEnumDocumentedVariant2Variant = ( ReflectapiDemoTestsBasicTestEnumDocumentedVariant2Variant ) - TestEnumDocumentedVariants = ( - ReflectapiDemoTestsBasicTestEnumDocumentedVariants - ) TestEnumDocumented = ReflectapiDemoTestsBasicTestEnumDocumented diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap index 6ba6e5d3..e898074b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap @@ -56,8 +56,6 @@ class reflectapi_demo: TestEnumWithSkipVariant = ( ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant ) - A = A - I = I class output: """Namespace for output types.""" @@ -65,8 +63,6 @@ class reflectapi_demo: TestEnumWithSkipVariant = ( ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant ) - A = A - O = O class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap index 7748dcfe..b0f4c731 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap @@ -60,7 +60,6 @@ class reflectapi_demo: X = ReflectapiDemoTestsBasicX Y = ReflectapiDemoTestsBasicY - Y = Y Test = ReflectapiDemoTestsBasicTest diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap index 2f4b34aa..f3c16c05 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap @@ -44,8 +44,6 @@ class reflectapi_demo: """Namespace for enums types.""" TestEnum = ReflectapiDemoTestsEnumsTestEnum - VARIANT1 = VARIANT1 - VARIANT2 = VARIANT2 class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap index 5a18561b..2b4e58df 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap @@ -44,8 +44,6 @@ class reflectapi_demo: """Namespace for enums types.""" Nums = ReflectapiDemoTestsEnumsNums - ZERO = ZERO - A = A class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap index 3726085e..77ab2b22 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap @@ -142,7 +142,6 @@ class reflectapi_demo: TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant = ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant = ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant - TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariants = ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariants TestEnumWithBasicVariantAndFieldsAndNamedFields = ( ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFields ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap index 27979d57..0900cc4b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap @@ -46,8 +46,6 @@ class reflectapi_demo: TestEnumWithDiscriminantIgnored = ( ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored ) - VARIANT1 = VARIANT1 - VARIANT2 = VARIANT2 class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap index ec834d5f..84963ea7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap @@ -46,8 +46,6 @@ class reflectapi_demo: TestEnumWithDiscriminantIgnored = ( ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored ) - VARIANT1 = VARIANT1 - VARIANT2 = VARIANT2 class AsyncOutputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap index 1ddc5e5a..4c613e1a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap @@ -50,8 +50,6 @@ class reflectapi_demo: """Namespace for enums types.""" TestEnumWithDiscriminant = ReflectapiDemoTestsEnumsTestEnumWithDiscriminant - VARIANT1 = VARIANT1 - VARIANT2 = VARIANT2 class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap index 9aa41ad4..c679b4e7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap @@ -50,8 +50,6 @@ class reflectapi_demo: """Namespace for enums types.""" TestEnumWithDiscriminant = ReflectapiDemoTestsEnumsTestEnumWithDiscriminant - VARIANT1 = VARIANT1 - VARIANT2 = VARIANT2 class AsyncOutputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap index 01b15363..39a42269 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap @@ -111,9 +111,6 @@ class reflectapi_demo: TestEnumWithEmptyVariantAndFieldsVariant2Variant = ( ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsVariant2Variant ) - TestEnumWithEmptyVariantAndFieldsVariants = ( - ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsVariants - ) TestEnumWithEmptyVariantAndFields = ( ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFields ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap index c0028b14..04c8519f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap @@ -126,9 +126,6 @@ class reflectapi_demo: TestEnumWithFieldsVariant2Variant = ( ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant2Variant ) - TestEnumWithFieldsVariants = ( - ReflectapiDemoTestsEnumsTestEnumWithFieldsVariants - ) TestEnumWithFields = ReflectapiDemoTestsEnumsTestEnumWithFields diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap index 37b1622e..3646d220 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap @@ -141,16 +141,12 @@ class reflectapi_demo: class enums: """Namespace for enums types.""" - T = T TestEnumWithGenericsVariant1Variant = ( ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant1Variant ) TestEnumWithGenericsVariant2Variant = ( ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant2Variant ) - TestEnumWithGenericsVariants = ( - ReflectapiDemoTestsEnumsTestEnumWithGenericsVariants - ) TestEnumWithGenerics = ReflectapiDemoTestsEnumsTestEnumWithGenerics diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap index 9890c4ae..36376305 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap @@ -143,16 +143,12 @@ class reflectapi_demo: class enums: """Namespace for enums types.""" - T = T TestEnumWithGenericsAndFieldsVariant1Variant = ( ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant1Variant ) TestEnumWithGenericsAndFieldsVariant2Variant = ( ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant2Variant ) - TestEnumWithGenericsAndFieldsVariants = ( - ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariants - ) TestEnumWithGenericsAndFields = ( ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFields ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap index 0cfd3b16..943130aa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap @@ -180,11 +180,9 @@ class reflectapi_demo: class enums: """Namespace for enums types.""" - T = T TestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant TestEnumWithGenericsAndFieldsAndNamedFieldsVariant2Variant = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant2Variant TestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant - TestEnumWithGenericsAndFieldsAndNamedFieldsVariants = ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariants TestEnumWithGenericsAndFieldsAndNamedFields = ( ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFields ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap index 1bf213cf..e2ccd104 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap @@ -57,8 +57,6 @@ class reflectapi_demo: """Namespace for enums types.""" A = ReflectapiDemoTestsEnumsA - X = X - Y = Y EA = ReflectapiDemoTestsEnumsEA E = ReflectapiDemoTestsEnumsE diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index 44c1ebaa..590d977e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -130,9 +130,6 @@ class reflectapi_demo: TestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant TestEmptyVariantsAdjacentlyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant - TestEmptyVariantsAdjacentlyTaggedVariants = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedVariants - ) TestEmptyVariantsAdjacentlyTagged = ( ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap index 24fd3801..ea56e7da 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap @@ -132,9 +132,6 @@ class reflectapi_demo: TestEmptyVariantsExternallyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant TestEmptyVariantsExternallyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant - TestEmptyVariantsExternallyTaggedVariants = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedVariants - ) TestEmptyVariantsExternallyTagged = ( ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap index 5410fd5b..ecac5b14 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap @@ -44,8 +44,6 @@ class reflectapi_demo: """Namespace for serde types.""" MyEnum = ReflectapiDemoTestsSerdeMyEnum - V1 = V1 - V2 = V2 class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap index af45e653..b43b1466 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap @@ -43,7 +43,6 @@ class reflectapi_demo: """Namespace for serde types.""" TestEnumRenameAll = ReflectapiDemoTestsSerdeTestEnumRenameAll - FIELD_NAME = FIELD_NAME class AsyncInoutClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap index bd7aca36..10d67888 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap @@ -132,9 +132,6 @@ class reflectapi_demo: TestEnumRenameAllOnVariantVariant2Variant = ( ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant ) - TestEnumRenameAllOnVariantVariants = ( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariants - ) TestEnumRenameAllOnVariant = ( ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap index aa25e252..34721573 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap @@ -104,9 +104,6 @@ class reflectapi_demo: TestEnumRenameVariantFieldVariant2Variant = ( ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant ) - TestEnumRenameVariantFieldVariants = ( - ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariants - ) TestEnumRenameVariantField = ( ReflectapiDemoTestsSerdeTestEnumRenameVariantField ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index 170b5741..eeee6b29 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -128,9 +128,6 @@ class reflectapi_demo: TestEnumTagContentVariant2Variant = ( ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant ) - TestEnumTagContentVariants = ( - ReflectapiDemoTestsSerdeTestEnumTagContentVariants - ) TestEnumTagContent = ReflectapiDemoTestsSerdeTestEnumTagContent diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index 6e3febd0..69ee3d53 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -134,9 +134,6 @@ class reflectapi_demo: TestEnumTagContentRenameAllVariant2Variant = ( ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant ) - TestEnumTagContentRenameAllVariants = ( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariants - ) TestEnumTagContentRenameAll = ( ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap index b442cb5c..5376249d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap @@ -100,9 +100,6 @@ class reflectapi_demo: TestEnumWithFieldSkipVariant1Variant = ( ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant ) - TestEnumWithFieldSkipVariants = ( - ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariants - ) TestEnumWithFieldSkip = ReflectapiDemoTestsSerdeTestEnumWithFieldSkip diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index f8503968..04a06eb3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -78,7 +78,6 @@ class reflectapi_demo: class serde: """Namespace for serde types.""" TestEnumWithRenameToInvalidCharsVariant1Variant = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant - TestEnumWithRenameToInvalidCharsVariants = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants TestEnumWithRenameToInvalidChars = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap index 549066d4..705ccf8c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap @@ -54,7 +54,6 @@ class reflectapi_demo: TestEnumWithVariantSkipSerialize = ( ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize ) - VARIANT1 = VARIANT1 class output: """Namespace for output types.""" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap index 66a6694a..1a3fed86 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap @@ -105,9 +105,6 @@ class reflectapi_demo: TestEnumWithVariantUntaggedVariant1Variant = ( ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant ) - TestEnumWithVariantUntaggedVariants = ( - ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariants - ) TestEnumWithVariantUntagged = ( ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index 35cb72da..15ae860f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -121,7 +121,6 @@ class reflectapi_demo: PayloadTextVariant = ReflectapiDemoTestsSerdePayloadTextVariant PayloadBinaryVariant = ReflectapiDemoTestsSerdePayloadBinaryVariant - PayloadVariants = ReflectapiDemoTestsSerdePayloadVariants Payload = ReflectapiDemoTestsSerdePayload Message = ReflectapiDemoTestsSerdeMessage diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap index f2c1905b..267ba291 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -115,7 +115,6 @@ class reflectapi_demo: ShapeCircleVariant = ReflectapiDemoTestsSerdeShapeCircleVariant ShapeRectVariant = ReflectapiDemoTestsSerdeShapeRectVariant - ShapeVariants = ReflectapiDemoTestsSerdeShapeVariants Shape = ReflectapiDemoTestsSerdeShape Drawing = ReflectapiDemoTestsSerdeDrawing diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index 2caf1ee8..b12961ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -157,9 +157,6 @@ class reflectapi_demo: TestNewtypeVariantsAdjacentlyTaggedBoolVariant = ( ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant ) - TestNewtypeVariantsAdjacentlyTaggedVariants = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedVariants - ) TestNewtypeVariantsAdjacentlyTagged = ( ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged ) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index 3ea138eb..7271b220 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -161,9 +161,6 @@ class reflectapi_demo: TestNewtypeVariantsExternallyTaggedBoolVariant = ( ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant ) - TestNewtypeVariantsExternallyTaggedVariants = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedVariants - ) TestNewtypeVariantsExternallyTagged = ( ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged ) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index e95f6be0..81c7587f 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -5069,6 +5069,11 @@ pub mod templates { fn extract_defined_names(type_code: &str) -> Vec { let mut names = Vec::new(); for line in type_code.lines() { + // Only match top-level definitions (no leading whitespace) + // to avoid leaking enum members or nested assignments + if line.starts_with(' ') || line.starts_with('\t') { + continue; + } let trimmed = line.trim(); if let Some(rest) = trimmed.strip_prefix("class ") { if let Some(paren) = rest.find('(') { @@ -5084,7 +5089,12 @@ pub mod templates { } } else if let Some(eq_pos) = trimmed.find(" = ") { let name = &trimmed[..eq_pos]; - if name.chars().next().is_some_and(|c| c.is_ascii_uppercase()) { + // Only match PascalCase type aliases (not enum members, constants, + // or internal *Variants union aliases) + if name.chars().next().is_some_and(|c| c.is_ascii_uppercase()) + && !name.chars().all(|c| c.is_ascii_uppercase() || c == '_') + && !name.ends_with("Variants") + { names.push(name.to_string()); } } From 0f9820b7487859be0e5bd059916afd5cd9455d7b Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 19:37:39 +1300 Subject: [PATCH 28/47] refactor: remove dead code, fix TypeVar leak, eliminate unnecessary clones - Remove dead _semantic normalizer call (constructed but never used) - Filter TypeVar declarations (T, U) from extract_defined_names - Move instead of clone rendered_original_names_in_order - Collect rendered_type_keys before moving rendered_types - Delete dead Imports::render() method (~95 lines) - Delete always-false has_flatten_support field - Inline trivial to_valid_python_identifier wrapper --- reflectapi/src/codegen/python.rs | 144 ++++--------------------------- 1 file changed, 17 insertions(+), 127 deletions(-) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 81c7587f..24e84e7a 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -85,10 +85,6 @@ fn prefix_union_members(members: &[String], original_name: &str) -> Vec .collect() } -fn to_valid_python_identifier(name: &str) -> String { - safe_python_identifier(name) -} - /// Configuration for Python client generation #[derive(Debug, Clone)] pub struct Config { @@ -1224,13 +1220,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Validate all type references exist validate_type_references(&schema)?; - // Build the semantic IR. The Normalizer runs ensure_symbol_ids + - // NormalizationPipeline internally. The SemanticSchema is available - // for render functions that need type-safe SymbolId-based lookups; - // the raw Schema is still used for the main iteration loop since - // the Normalizer's NamingResolutionStage transforms type names. - let _semantic = reflectapi_schema::Normalizer::new().normalize(&schema).ok(); - let mut generated_code = Vec::new(); // Generate file header @@ -1293,9 +1282,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let has_reflectapi_infallible = schema_uses_type(&schema, &all_type_names, "reflectapi::Infallible"); - // Flatten support uses direct field expansion in generated models - let has_flatten_support = false; - // Check if we need warnings import (for deprecated functions) let has_warnings = schema.functions().any(|f| f.deprecation_note.is_some()); @@ -1314,7 +1300,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { has_reflectapi_option, has_reflectapi_empty, has_reflectapi_infallible, - has_flatten_support, has_warnings, has_datetime, has_uuid, @@ -1411,11 +1396,11 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { } } + // Collect rendered type keys before passing ownership to the module tree builder. + let rendered_type_keys: Vec = rendered_types.keys().cloned().collect(); + // Build namespace module tree and render it - let module_tree = modules_from_rendered_types( - rendered_original_names_in_order.clone(), - rendered_types.clone(), - ); + let module_tree = modules_from_rendered_types(rendered_original_names_in_order, rendered_types); let module_tree_code = module_tree.render(); if !module_tree_code.trim().is_empty() { generated_code.push(module_tree_code); @@ -1450,7 +1435,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { nested_function.original_name = Some(rendered_function.name.clone()); function_groups - .entry(to_valid_python_identifier(group_name)) + .entry(safe_python_identifier(group_name)) .or_default() .push(nested_function); } else { @@ -1493,9 +1478,9 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { "# Rebuild models to resolve forward references".to_string(), "try:".to_string(), ]; - let mut sorted_type_names: Vec<_> = rendered_types.keys().collect(); + let mut sorted_type_names: Vec<&String> = rendered_type_keys.iter().collect(); sorted_type_names.sort(); - for original_name in sorted_type_names { + for original_name in &sorted_type_names { if !original_name.starts_with("std::") && !original_name.starts_with("reflectapi::") { let dotted = type_name_to_python_ref(original_name); external_types_and_rebuilds.push(format!(" {dotted}.model_rebuild()")); @@ -1543,8 +1528,8 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { if config.generate_testing { // contains user-defined types that have Pydantic classes generated for them. // Note types with fallbacks to primitives are not added. - let mut user_defined_types: Vec = rendered_types - .keys() + let mut user_defined_types: Vec = rendered_type_keys + .iter() .map(|original_name| type_name_to_python_ref(original_name)) .collect(); user_defined_types.sort(); @@ -4042,7 +4027,7 @@ fn to_screaming_snake_case(s: &str) -> String { } fn sanitize_field_name(s: &str) -> String { - let mut result = to_valid_python_identifier(&to_snake_case(s)); + let mut result = safe_python_identifier(&to_snake_case(s)); // Strip leading underscores - Pydantic v2 treats _-prefixed fields as private result = result.trim_start_matches('_').to_string(); if result.is_empty() { @@ -4055,7 +4040,7 @@ fn sanitize_field_name(s: &str) -> String { fn sanitize_field_name_with_alias(name: &str, serde_name: &str) -> (String, Option) { let snake_case = to_snake_case(name); - let sanitized = to_valid_python_identifier(&snake_case); + let sanitized = safe_python_identifier(&snake_case); // Strip leading underscores - Pydantic v2 treats _-prefixed fields as private let sanitized = sanitized.trim_start_matches('_').to_string(); @@ -5089,11 +5074,16 @@ pub mod templates { } } else if let Some(eq_pos) = trimmed.find(" = ") { let name = &trimmed[..eq_pos]; + let value = trimmed[eq_pos + 3..].trim(); // Only match PascalCase type aliases (not enum members, constants, - // or internal *Variants union aliases) + // or internal *Variants union aliases). + // Skip short names (1-2 chars) which are likely TypeVars, and + // also skip any assignment whose value contains `TypeVar`. if name.chars().next().is_some_and(|c| c.is_ascii_uppercase()) && !name.chars().all(|c| c.is_ascii_uppercase() || c == '_') && !name.ends_with("Variants") + && name.len() > 2 + && !value.contains("TypeVar") { names.push(name.to_string()); } @@ -5202,7 +5192,6 @@ pub mod templates { pub has_reflectapi_option: bool, pub has_reflectapi_empty: bool, pub has_reflectapi_infallible: bool, - pub has_flatten_support: bool, pub has_warnings: bool, pub has_datetime: bool, pub has_uuid: bool, @@ -5216,105 +5205,6 @@ pub mod templates { pub global_type_vars: Vec, } - impl Imports { - pub fn render(&self) -> String { - let mut s = String::new(); - writeln!(s).unwrap(); - writeln!(s, "# Standard library imports").unwrap(); - if self.has_datetime { - write!(s, "from datetime import datetime").unwrap(); - if self.has_date { - write!(s, ", date").unwrap(); - } - if self.has_timedelta { - write!(s, ", timedelta").unwrap(); - } - writeln!(s).unwrap(); - } else if self.has_date { - write!(s, "from datetime import date").unwrap(); - if self.has_timedelta { - write!(s, ", timedelta").unwrap(); - } - writeln!(s).unwrap(); - } else if self.has_timedelta { - writeln!(s, "from datetime import timedelta").unwrap(); - } - if self.has_enums { - writeln!(s, "from enum import Enum").unwrap(); - } - write!( - s, - "from typing import Any, Optional, TypeVar, Generic, Union" - ) - .unwrap(); - if self.has_annotated { - write!(s, ", Annotated").unwrap(); - } - if self.has_literal { - write!(s, ", Literal").unwrap(); - } - writeln!(s).unwrap(); - if self.has_uuid { - writeln!(s, "from uuid import UUID").unwrap(); - } - if self.has_warnings { - writeln!(s, "import warnings").unwrap(); - } - writeln!(s).unwrap(); - writeln!(s, "# Third-party imports").unwrap(); - write!(s, "from pydantic import BaseModel, ConfigDict, Field").unwrap(); - if self.has_externally_tagged_enums { - write!( - s, - ", RootModel, model_validator, model_serializer, PrivateAttr" - ) - .unwrap(); - } - writeln!(s).unwrap(); - writeln!(s).unwrap(); - writeln!(s, "# Runtime imports").unwrap(); - if self.has_async { - if self.has_sync { - writeln!( - s, - "from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse" - ) - .unwrap(); - } else { - writeln!( - s, - "from reflectapi_runtime import AsyncClientBase, ApiResponse" - ) - .unwrap(); - } - } else if self.has_sync { - writeln!(s, "from reflectapi_runtime import ClientBase, ApiResponse").unwrap(); - } - if self.has_reflectapi_option { - writeln!(s, "from reflectapi_runtime import ReflectapiOption").unwrap(); - } - if self.has_reflectapi_empty { - writeln!(s, "from reflectapi_runtime import ReflectapiEmpty").unwrap(); - } - if self.has_reflectapi_infallible { - writeln!(s, "from reflectapi_runtime import ReflectapiInfallible").unwrap(); - } - if self.has_testing { - writeln!( - s, - "from reflectapi_runtime.testing import MockClient, create_api_response" - ) - .unwrap(); - } - writeln!(s).unwrap(); - for type_var in &self.global_type_vars { - writeln!(s, "{type_var} = TypeVar('{type_var}')").unwrap(); - } - writeln!(s).unwrap(); - s - } - } - pub struct DataClass { pub name: String, pub description: Option, From 77774024558696b6a137d8549b9c25b45b4cb869 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 19:38:54 +1300 Subject: [PATCH 29/47] refactor: remove dead flat_name/leaf_name fields from ModuleType --- reflectapi/src/codegen/python.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 24e84e7a..ace600f4 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1193,17 +1193,8 @@ fn modules_from_rendered_types( }); } if let Some(rendered_type) = rendered_types.remove(&original_type_name) { - let flat_name = improve_class_name(&original_type_name); - let leaf_name = improve_class_name_part( - original_type_name - .split("::") - .last() - .unwrap_or(&original_type_name), - ); module.types.push(templates::ModuleType { rendered: rendered_type, - flat_name, - leaf_name, }); } } @@ -4993,10 +4984,6 @@ pub mod templates { pub struct ModuleType { /// The rendered Python source code for this type. pub rendered: String, - /// The flat class name used at module top-level (e.g., `ReflectapiDemoTestsSerdeOffer`). - pub flat_name: String, - /// The PascalCase leaf name for namespace aliases (e.g., `Offer`). - pub leaf_name: String, } pub struct Module { From 10df0540fb8d3539c4b0fa5a4c7055e96c25d9cc Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 21:53:38 +1300 Subject: [PATCH 30/47] test: add 21 comprehensive edge case tests for Python codegen Coverage for previously untested code paths across 6 categories: Namespace edge cases (3): single-segment types, deeply nested modules, numeric/special character field names Flatten edge cases (5): nested flatten depth > 1, optional internally- tagged enum flatten, multiple flattened structs, combined struct + enum flatten, unit-variant-only enum flatten Enum representation edge cases (4): generic externally-tagged enum, generic adjacently-tagged enum, mixed variant types (unit + struct), serde rename on variants Type reference edge cases (4): Box unwrapping, nested generic containers (Vec>), self-referential struct, Option> Field sanitization edge cases (3): all Python keywords as field names, special characters in serde renames, multiple underscore prefixes Factory/client edge cases (2): 12-variant enum at scale, empty enum 105 new snapshot files (21 tests x 5 snapshots each). --- reflectapi-demo/src/tests/serde.rs | 374 ++++++++++++++++++ ..._tests__serde__box_field_unwrapping-2.snap | 62 +++ ..._tests__serde__box_field_unwrapping-3.snap | 73 ++++ ..._tests__serde__box_field_unwrapping-4.snap | 74 ++++ ..._tests__serde__box_field_unwrapping-5.snap | 164 ++++++++ ...o__tests__serde__box_field_unwrapping.snap | 207 ++++++++++ ...tapi_demo__tests__serde__empty_enum-2.snap | 59 +++ ...tapi_demo__tests__serde__empty_enum-3.snap | 66 ++++ ...tapi_demo__tests__serde__empty_enum-4.snap | 49 +++ ...tapi_demo__tests__serde__empty_enum-5.snap | 161 ++++++++ ...ectapi_demo__tests__serde__empty_enum.snap | 51 +++ ...xed_variant_types_internally_tagged-2.snap | 69 ++++ ...xed_variant_types_internally_tagged-3.snap | 71 ++++ ...xed_variant_types_internally_tagged-4.snap | 106 +++++ ...xed_variant_types_internally_tagged-5.snap | 215 ++++++++++ ...mixed_variant_types_internally_tagged.snap | 163 ++++++++ ...sts__serde__enum_with_many_variants-2.snap | 90 +++++ ...sts__serde__enum_with_many_variants-3.snap | 80 ++++ ...sts__serde__enum_with_many_variants-4.snap | 242 ++++++++++++ ...sts__serde__enum_with_many_variants-5.snap | 334 ++++++++++++++++ ...tests__serde__enum_with_many_variants.snap | 345 ++++++++++++++++ ..._enum_with_serde_rename_on_variants-2.snap | 71 ++++ ..._enum_with_serde_rename_on_variants-3.snap | 72 ++++ ..._enum_with_serde_rename_on_variants-4.snap | 108 +++++ ..._enum_with_serde_rename_on_variants-5.snap | 250 ++++++++++++ ...e__enum_with_serde_rename_on_variants.snap | 143 +++++++ ...s__serde__field_all_python_keywords-2.snap | 64 +++ ...s__serde__field_all_python_keywords-3.snap | 72 ++++ ...s__serde__field_all_python_keywords-4.snap | 74 ++++ ...s__serde__field_all_python_keywords-5.snap | 165 ++++++++ ...sts__serde__field_all_python_keywords.snap | 125 ++++++ ...rde__field_names_with_special_chars-2.snap | 63 +++ ...rde__field_names_with_special_chars-3.snap | 73 ++++ ...rde__field_names_with_special_chars-4.snap | 74 ++++ ...rde__field_names_with_special_chars-5.snap | 170 ++++++++ ...serde__field_names_with_special_chars.snap | 127 ++++++ ...latten_enum_with_unit_variants_only-2.snap | 66 ++++ ...latten_enum_with_unit_variants_only-3.snap | 78 ++++ ...latten_enum_with_unit_variants_only-4.snap | 109 +++++ ...latten_enum_with_unit_variants_only-5.snap | 262 ++++++++++++ ..._flatten_enum_with_unit_variants_only.snap | 145 +++++++ ...ts__serde__flatten_multiple_structs-2.snap | 72 ++++ ...ts__serde__flatten_multiple_structs-3.snap | 84 ++++ ...ts__serde__flatten_multiple_structs-4.snap | 108 +++++ ...ts__serde__flatten_multiple_structs-5.snap | 202 ++++++++++ ...ests__serde__flatten_multiple_structs.snap | 213 ++++++++++ ...ten_optional_internally_tagged_enum-2.snap | 68 ++++ ...ten_optional_internally_tagged_enum-3.snap | 79 ++++ ...ten_optional_internally_tagged_enum-4.snap | 109 +++++ ...ten_optional_internally_tagged_enum-5.snap | 244 ++++++++++++ ...atten_optional_internally_tagged_enum.snap | 231 +++++++++++ ...n_struct_and_internal_enum_combined-2.snap | 77 ++++ ...n_struct_and_internal_enum_combined-3.snap | 89 +++++ ...n_struct_and_internal_enum_combined-4.snap | 128 ++++++ ...n_struct_and_internal_enum_combined-5.snap | 274 +++++++++++++ ...ten_struct_and_internal_enum_combined.snap | 247 ++++++++++++ ..._flatten_struct_with_nested_flatten-2.snap | 69 ++++ ..._flatten_struct_with_nested_flatten-3.snap | 82 ++++ ..._flatten_struct_with_nested_flatten-4.snap | 104 +++++ ..._flatten_struct_with_nested_flatten-5.snap | 199 ++++++++++ ...e__flatten_struct_with_nested_flatten.snap | 185 +++++++++ ...rde__generic_adjacently_tagged_enum-2.snap | 59 +++ ...rde__generic_adjacently_tagged_enum-3.snap | 70 ++++ ...rde__generic_adjacently_tagged_enum-4.snap | 120 ++++++ ...rde__generic_adjacently_tagged_enum-5.snap | 238 +++++++++++ ...serde__generic_adjacently_tagged_enum.snap | 133 +++++++ ...rde__generic_externally_tagged_enum-2.snap | 63 +++ ...rde__generic_externally_tagged_enum-3.snap | 69 ++++ ...rde__generic_externally_tagged_enum-4.snap | 82 ++++ ...rde__generic_externally_tagged_enum-5.snap | 242 ++++++++++++ ...serde__generic_externally_tagged_enum.snap | 121 ++++++ ...__multiple_underscore_prefix_fields-2.snap | 63 +++ ...__multiple_underscore_prefix_fields-3.snap | 70 ++++ ...__multiple_underscore_prefix_fields-4.snap | 78 ++++ ...__multiple_underscore_prefix_fields-5.snap | 164 ++++++++ ...de__multiple_underscore_prefix_fields.snap | 131 ++++++ ...de__namespace_deeply_nested_modules-2.snap | 70 ++++ ...de__namespace_deeply_nested_modules-3.snap | 74 ++++ ...de__namespace_deeply_nested_modules-4.snap | 62 +++ ...de__namespace_deeply_nested_modules-5.snap | 171 ++++++++ ...erde__namespace_deeply_nested_modules.snap | 83 ++++ ...erde__namespace_single_segment_type-2.snap | 61 +++ ...erde__namespace_single_segment_type-3.snap | 68 ++++ ...erde__namespace_single_segment_type-4.snap | 62 +++ ...erde__namespace_single_segment_type-5.snap | 162 ++++++++ ..._serde__namespace_single_segment_type.snap | 83 ++++ ...serde__namespace_with_numeric_start-2.snap | 62 +++ ...serde__namespace_with_numeric_start-3.snap | 71 ++++ ...serde__namespace_with_numeric_start-4.snap | 70 ++++ ...serde__namespace_with_numeric_start-5.snap | 165 ++++++++ ...__serde__namespace_with_numeric_start.snap | 111 ++++++ ...s__serde__nested_generic_containers-2.snap | 62 +++ ...s__serde__nested_generic_containers-3.snap | 72 ++++ ...s__serde__nested_generic_containers-4.snap | 94 +++++ ...s__serde__nested_generic_containers-5.snap | 164 ++++++++ ...sts__serde__nested_generic_containers.snap | 283 +++++++++++++ ...emo__tests__serde__option_of_option-2.snap | 61 +++ ...emo__tests__serde__option_of_option-3.snap | 68 ++++ ...emo__tests__serde__option_of_option-4.snap | 78 ++++ ...emo__tests__serde__option_of_option-5.snap | 163 ++++++++ ..._demo__tests__serde__option_of_option.snap | 167 ++++++++ ...sts__serde__self_referential_struct-2.snap | 62 +++ ...sts__serde__self_referential_struct-3.snap | 70 ++++ ...sts__serde__self_referential_struct-4.snap | 70 ++++ ...sts__serde__self_referential_struct-5.snap | 163 ++++++++ ...tests__serde__self_referential_struct.snap | 127 ++++++ 106 files changed, 13012 insertions(+) create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-2.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-3.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-4.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap create mode 100644 reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct.snap diff --git a/reflectapi-demo/src/tests/serde.rs b/reflectapi-demo/src/tests/serde.rs index 84df03f3..c0cbd3e5 100644 --- a/reflectapi-demo/src/tests/serde.rs +++ b/reflectapi-demo/src/tests/serde.rs @@ -820,3 +820,377 @@ fn test_external_impls() { assert_snapshot!(Test); } + +// ────────────────────────────────────────────────────────────────────── +// Group 1: Namespace Edge Cases +// ────────────────────────────────────────────────────────────────────── + +#[test] +fn test_namespace_single_segment_type() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct SimpleTopLevel { + value: u32, + } + assert_snapshot!(SimpleTopLevel); +} + +#[test] +fn test_namespace_deeply_nested_modules() { + mod deep { + pub mod nested { + pub mod inner { + #[derive( + serde::Serialize, + serde::Deserialize, + Debug, + reflectapi::Input, + reflectapi::Output, + )] + pub struct DeepType { + pub data: String, + } + } + } + } + assert_snapshot!(deep::nested::inner::DeepType); +} + +#[test] +fn test_namespace_with_numeric_start() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct TypeWithNumbers { + #[serde(rename = "123start")] + field_123: String, + #[serde(rename = "kebab-field")] + kebab_field: u32, + } + assert_snapshot!(TypeWithNumbers); +} + +// ────────────────────────────────────────────────────────────────────── +// Group 2: Flatten Edge Cases +// ────────────────────────────────────────────────────────────────────── + +#[test] +fn test_flatten_struct_with_nested_flatten() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Inner { + z: String, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Middle { + y: u32, + #[serde(flatten)] + inner: Inner, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Outer { + x: String, + #[serde(flatten)] + nested: Middle, + } + assert_snapshot!(Outer); +} + +#[test] +fn test_flatten_optional_internally_tagged_enum() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "kind")] + enum Priority { + High { deadline: String }, + Low, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Task { + title: String, + #[serde(flatten)] + priority: Option, + } + assert_snapshot!(Task); +} + +#[test] +fn test_flatten_multiple_structs() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Timestamps { + created_at: String, + updated_at: String, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Metadata { + author: String, + version: u32, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Document { + title: String, + #[serde(flatten)] + timestamps: Timestamps, + #[serde(flatten)] + meta: Metadata, + } + assert_snapshot!(Document); +} + +#[test] +fn test_flatten_struct_and_internal_enum_combined() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Audit { + modified_by: String, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "type")] + enum Content { + Text { body: String }, + Image { url: String, width: u32 }, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Post { + id: String, + #[serde(flatten)] + audit: Audit, + #[serde(flatten)] + content: Content, + } + assert_snapshot!(Post); +} + +#[test] +fn test_flatten_enum_with_unit_variants_only() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "status")] + enum Status { + Active, + Inactive, + Pending, + } + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Item { + name: String, + #[serde(flatten)] + status: Status, + } + assert_snapshot!(Item); +} + +// ────────────────────────────────────────────────────────────────────── +// Group 3: Enum Representation Edge Cases +// ────────────────────────────────────────────────────────────────────── + +#[test] +fn test_generic_externally_tagged_enum() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + enum Wrapper { + Value(T), + Empty, + } + assert_snapshot!(Wrapper); +} + +#[test] +fn test_generic_adjacently_tagged_enum() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "t", content = "c")] + enum Tagged { + Item(T), + Nothing, + } + assert_snapshot!(Tagged); +} + +#[test] +fn test_enum_mixed_variant_types_internally_tagged() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "type")] + enum Mixed { + Unit, + // Note: tuple variants are not allowed in internally-tagged representation, + // so we use a struct variant instead. + Wrap { value: String }, + Full { x: i32, y: i32 }, + } + assert_snapshot!(Mixed); +} + +#[test] +fn test_enum_with_serde_rename_on_variants() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "kind", content = "data")] + enum Action { + #[serde(rename = "create_item")] + Create { name: String }, + #[serde(rename = "delete_item")] + Delete { id: u32 }, + } + assert_snapshot!(Action); +} + +// ── Group 4: Type Reference Edge Cases ────────────────────────────────────── + +#[test] +fn test_box_field_unwrapping() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct TreeNode { + label: String, + child: Option>, + } + assert_snapshot!(TreeNode); +} + +#[test] +fn test_nested_generic_containers() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Complex { + matrix: Vec>, + lookup: std::collections::HashMap>>, + } + assert_snapshot!(Complex); +} + +#[test] +fn test_self_referential_struct() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Category { + name: String, + subcategories: Vec, + } + assert_snapshot!(Category); +} + +#[test] +fn test_option_of_option() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Nested { + value: Option>, + } + assert_snapshot!(Nested); +} + +// ── Group 5: Field Sanitization Edge Cases ────────────────────────────────── + +#[test] +fn test_field_all_python_keywords() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Keywords { + #[serde(rename = "type")] + type_field: String, + #[serde(rename = "class")] + class_field: String, + #[serde(rename = "from")] + from_field: String, + #[serde(rename = "import")] + import_field: String, + } + assert_snapshot!(Keywords); +} + +#[test] +fn test_field_names_with_special_chars() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct SpecialNames { + #[serde(rename = "Content-Type")] + content_type: String, + #[serde(rename = "x.nested.key")] + nested_key: String, + #[serde(rename = "has spaces")] + has_spaces: u32, + } + assert_snapshot!(SpecialNames); +} + +#[test] +fn test_multiple_underscore_prefix_fields() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + struct Underscored { + _single: u32, + __double: String, + ___triple: bool, + } + assert_snapshot!(Underscored); +} + +// ── Group 6: Factory & Client Edge Cases ──────────────────────────────────── + +#[test] +fn test_enum_with_many_variants() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + #[serde(tag = "type")] + enum LargeEnum { + Alpha, + Beta, + Gamma { x: i32 }, + Delta { value: String }, + Epsilon, + Zeta { y: bool }, + Eta, + Theta { value: u32 }, + Iota, + Kappa { z: f64 }, + Lambda, + Mu { w: String, v: i32 }, + } + assert_snapshot!(LargeEnum); +} + +#[test] +fn test_empty_enum() { + #[derive( + serde::Serialize, serde::Deserialize, Debug, reflectapi::Input, reflectapi::Output, + )] + enum Never {} + assert_snapshot!(Never); +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-2.snap new file mode 100644 index 00000000..cfd8ad92 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-2.snap @@ -0,0 +1,62 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < TreeNode > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.TreeNode, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface TreeNode { + label: string; + child: reflectapi_demo.tests.serde.TreeNode | null; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.TreeNode, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.TreeNode, + {}, + reflectapi_demo.tests.serde.TreeNode, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-3.snap new file mode 100644 index 00000000..f95796e8 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-3.snap @@ -0,0 +1,73 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < TreeNode > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::TreeNode, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::TreeNode, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct TreeNode { + pub label: std::string::String, + pub child: std::option::Option< + std::boxed::Box< + super::super::super::reflectapi_demo::tests::serde::TreeNode, + >, + >, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-4.snap new file mode 100644 index 00000000..1b74af71 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-4.snap @@ -0,0 +1,74 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.TreeNode" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.TreeNode" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.TreeNode": { + "type": "object", + "title": "reflectapi_demo.tests.serde.TreeNode", + "required": [ + "child", + "label" + ], + "properties": { + "child": { + "oneOf": [ + { + "description": "Null", + "type": "null" + }, + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.TreeNode" + } + ] + }, + "label": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap new file mode 100644 index 00000000..d4609a90 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap @@ -0,0 +1,164 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < TreeNode > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeTreeNode(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + label: str + child: reflectapi_demo.tests.serde.TreeNode | None = None + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TreeNode = ReflectapiDemoTestsSerdeTreeNode + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.TreeNode] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TreeNode]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.TreeNode]: Response containing reflectapi_demo.tests.serde.TreeNode data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.TreeNode, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.TreeNode] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TreeNode]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.TreeNode]: Response containing reflectapi_demo.tests.serde.TreeNode data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.TreeNode, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.TreeNode.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_treenode_response( + value: reflectapi_demo.tests.serde.TreeNode, +) -> ApiResponse[reflectapi_demo.tests.serde.TreeNode]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TreeNode.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping.snap new file mode 100644 index 00000000..7ec9eb7f --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping.snap @@ -0,0 +1,207 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::TreeNode" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::TreeNode" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::TreeNode", + "fields": { + "named": [ + { + "name": "label", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "child", + "type": { + "name": "std::option::Option", + "arguments": [ + { + "name": "std::boxed::Box", + "arguments": [ + { + "name": "reflectapi_demo::tests::serde::TreeNode" + } + ] + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::boxed::Box", + "description": "std::boxed::Box pointer type", + "parameters": [ + { + "name": "T" + } + ], + "fallback": { + "name": "T" + } + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::TreeNode", + "fields": { + "named": [ + { + "name": "label", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "child", + "type": { + "name": "std::option::Option", + "arguments": [ + { + "name": "std::boxed::Box", + "arguments": [ + { + "name": "reflectapi_demo::tests::serde::TreeNode" + } + ] + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::boxed::Box", + "description": "std::boxed::Box pointer type", + "parameters": [ + { + "name": "T" + } + ], + "fallback": { + "name": "T" + } + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-2.snap new file mode 100644 index 00000000..22d5f7d2 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-2.snap @@ -0,0 +1,59 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Never > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Never, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Never = never; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Never, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Never, + {}, + reflectapi_demo.tests.serde.Never, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-3.snap new file mode 100644 index 00000000..10044cef --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-3.snap @@ -0,0 +1,66 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Never > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Never, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Never, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub enum Never {} + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-4.snap new file mode 100644 index 00000000..64b40249 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-4.snap @@ -0,0 +1,49 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Never" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Never" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Never": { + "oneOf": [] + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap new file mode 100644 index 00000000..87ea3411 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap @@ -0,0 +1,161 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Never > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeNever(str, Enum): + """Generated enum.""" + + pass + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Never = ReflectapiDemoTestsSerdeNever + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Never] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Never]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Never]: Response containing reflectapi_demo.tests.serde.Never data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Never, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Never] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Never]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Never]: Response containing reflectapi_demo.tests.serde.Never data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Never, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Never.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_never_response( + value: reflectapi_demo.tests.serde.Never, +) -> ApiResponse[reflectapi_demo.tests.serde.Never]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Never.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum.snap new file mode 100644 index 00000000..786321cf --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum.snap @@ -0,0 +1,51 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Never" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Never" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Never" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Never" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-2.snap new file mode 100644 index 00000000..7001019d --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-2.snap @@ -0,0 +1,69 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Mixed > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Mixed, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Mixed = + | { type: "Unit" } + | { + type: "Wrap"; + value: string; + } + | { + type: "Full"; + x: number /* i32 */; + y: number /* i32 */; + }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Mixed, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Mixed, + {}, + reflectapi_demo.tests.serde.Mixed, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-3.snap new file mode 100644 index 00000000..b0aa4aa3 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-3.snap @@ -0,0 +1,71 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Mixed > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Mixed, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Mixed, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "type")] + pub enum Mixed { + Unit, + Wrap { value: std::string::String }, + Full { x: i32, y: i32 }, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-4.snap new file mode 100644 index 00000000..25567eb1 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-4.snap @@ -0,0 +1,106 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Mixed" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Mixed" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "i32": { + "description": "32-bit signed integer", + "type": "integer" + }, + "reflectapi_demo.tests.serde.Mixed": { + "oneOf": [ + { + "type": "object", + "title": "Unit", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Unit" + } + } + }, + { + "type": "object", + "title": "Wrap", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "const": "Wrap" + }, + "value": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + { + "type": "object", + "title": "Full", + "required": [ + "type", + "x", + "y" + ], + "properties": { + "type": { + "const": "Full" + }, + "x": { + "$ref": "#/components/schemas/i32" + }, + "y": { + "$ref": "#/components/schemas/i32" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap new file mode 100644 index 00000000..9b4899c5 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap @@ -0,0 +1,215 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Mixed > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Literal, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict, Field, RootModel + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeMixedUnit(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Unit"] = "Unit" + + +class ReflectapiDemoTestsSerdeMixedWrap(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Wrap"] = "Wrap" + value: str + + +class ReflectapiDemoTestsSerdeMixedFull(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Full"] = "Full" + x: int + y: int + + +class ReflectapiDemoTestsSerdeMixed(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeMixedUnit, + ReflectapiDemoTestsSerdeMixedWrap, + ReflectapiDemoTestsSerdeMixedFull, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + MixedUnit = ReflectapiDemoTestsSerdeMixedUnit + MixedWrap = ReflectapiDemoTestsSerdeMixedWrap + MixedFull = ReflectapiDemoTestsSerdeMixedFull + Mixed = ReflectapiDemoTestsSerdeMixed + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Mixed] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Mixed]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Mixed]: Response containing reflectapi_demo.tests.serde.Mixed data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Mixed, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Mixed] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Mixed]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Mixed]: Response containing reflectapi_demo.tests.serde.Mixed data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Mixed, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Mixed.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_MixedFactory: + """Factory class for creating reflectapi_demo.tests.serde.Mixed variants with ergonomic syntax. + + reflectapi_demo.tests.serde.Mixed variants + """ + + UNIT = reflectapi_demo.tests.serde.MixedUnit() + + @staticmethod + def wrap(value: str) -> reflectapi_demo.tests.serde.MixedWrap: + """Creates the 'Wrap' variant of the reflectapi_demo.tests.serde.Mixed enum.""" + return reflectapi_demo.tests.serde.MixedWrap(value=value) + + @staticmethod + def full(x: int, y: int) -> reflectapi_demo.tests.serde.MixedFull: + """Creates the 'Full' variant of the reflectapi_demo.tests.serde.Mixed enum.""" + return reflectapi_demo.tests.serde.MixedFull(x=x, y=y) + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_mixed_response( + value: reflectapi_demo.tests.serde.Mixed, +) -> ApiResponse[reflectapi_demo.tests.serde.Mixed]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Mixed.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged.snap new file mode 100644 index 00000000..09f134a5 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged.snap @@ -0,0 +1,163 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Mixed" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Mixed" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "primitive", + "name": "i32", + "description": "32-bit signed integer" + }, + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Mixed", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Unit", + "fields": "none" + }, + { + "name": "Wrap", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Full", + "fields": { + "named": [ + { + "name": "x", + "type": { + "name": "i32" + }, + "required": true + }, + { + "name": "y", + "type": { + "name": "i32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "primitive", + "name": "i32", + "description": "32-bit signed integer" + }, + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Mixed", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Unit", + "fields": "none" + }, + { + "name": "Wrap", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Full", + "fields": { + "named": [ + { + "name": "x", + "type": { + "name": "i32" + }, + "required": true + }, + { + "name": "y", + "type": { + "name": "i32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-2.snap new file mode 100644 index 00000000..9e855ecb --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-2.snap @@ -0,0 +1,90 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < LargeEnum > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.LargeEnum, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type LargeEnum = + | { type: "Alpha" } + | { type: "Beta" } + | { + type: "Gamma"; + x: number /* i32 */; + } + | { + type: "Delta"; + value: string; + } + | { type: "Epsilon" } + | { + type: "Zeta"; + y: boolean; + } + | { type: "Eta" } + | { + type: "Theta"; + value: number /* u32 */; + } + | { type: "Iota" } + | { + type: "Kappa"; + z: number /* f64 */; + } + | { type: "Lambda" } + | { + type: "Mu"; + w: string; + v: number /* i32 */; + }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.LargeEnum, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.LargeEnum, + {}, + reflectapi_demo.tests.serde.LargeEnum, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-3.snap new file mode 100644 index 00000000..a5ffe5e0 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-3.snap @@ -0,0 +1,80 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < LargeEnum > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::LargeEnum, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::LargeEnum, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "type")] + pub enum LargeEnum { + Alpha, + Beta, + Gamma { x: i32 }, + Delta { value: std::string::String }, + Epsilon, + Zeta { y: bool }, + Eta, + Theta { value: u32 }, + Iota, + Kappa { z: f64 }, + Lambda, + Mu { w: std::string::String, v: i32 }, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-4.snap new file mode 100644 index 00000000..aebf4f89 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-4.snap @@ -0,0 +1,242 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.LargeEnum" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.LargeEnum" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "bool": { + "description": "Boolean value", + "type": "boolean" + }, + "f64": { + "description": "64-bit floating point number", + "type": "number" + }, + "i32": { + "description": "32-bit signed integer", + "type": "integer" + }, + "reflectapi_demo.tests.serde.LargeEnum": { + "oneOf": [ + { + "type": "object", + "title": "Alpha", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Alpha" + } + } + }, + { + "type": "object", + "title": "Beta", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Beta" + } + } + }, + { + "type": "object", + "title": "Gamma", + "required": [ + "type", + "x" + ], + "properties": { + "type": { + "const": "Gamma" + }, + "x": { + "$ref": "#/components/schemas/i32" + } + } + }, + { + "type": "object", + "title": "Delta", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "const": "Delta" + }, + "value": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + { + "type": "object", + "title": "Epsilon", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Epsilon" + } + } + }, + { + "type": "object", + "title": "Zeta", + "required": [ + "type", + "y" + ], + "properties": { + "type": { + "const": "Zeta" + }, + "y": { + "$ref": "#/components/schemas/bool" + } + } + }, + { + "type": "object", + "title": "Eta", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Eta" + } + } + }, + { + "type": "object", + "title": "Theta", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "const": "Theta" + }, + "value": { + "$ref": "#/components/schemas/u32" + } + } + }, + { + "type": "object", + "title": "Iota", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Iota" + } + } + }, + { + "type": "object", + "title": "Kappa", + "required": [ + "type", + "z" + ], + "properties": { + "type": { + "const": "Kappa" + }, + "z": { + "$ref": "#/components/schemas/f64" + } + } + }, + { + "type": "object", + "title": "Lambda", + "required": [ + "type" + ], + "properties": { + "type": { + "const": "Lambda" + } + } + }, + { + "type": "object", + "title": "Mu", + "required": [ + "type", + "v", + "w" + ], + "properties": { + "type": { + "const": "Mu" + }, + "v": { + "$ref": "#/components/schemas/i32" + }, + "w": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap new file mode 100644 index 00000000..50bd7ce9 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap @@ -0,0 +1,334 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < LargeEnum > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Literal, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict, Field, RootModel + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeLargeEnumAlpha(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Alpha"] = "Alpha" + + +class ReflectapiDemoTestsSerdeLargeEnumBeta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Beta"] = "Beta" + + +class ReflectapiDemoTestsSerdeLargeEnumGamma(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Gamma"] = "Gamma" + x: int + + +class ReflectapiDemoTestsSerdeLargeEnumDelta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Delta"] = "Delta" + value: str + + +class ReflectapiDemoTestsSerdeLargeEnumEpsilon(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Epsilon"] = "Epsilon" + + +class ReflectapiDemoTestsSerdeLargeEnumZeta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Zeta"] = "Zeta" + y: bool + + +class ReflectapiDemoTestsSerdeLargeEnumEta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Eta"] = "Eta" + + +class ReflectapiDemoTestsSerdeLargeEnumTheta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Theta"] = "Theta" + value: int + + +class ReflectapiDemoTestsSerdeLargeEnumIota(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Iota"] = "Iota" + + +class ReflectapiDemoTestsSerdeLargeEnumKappa(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Kappa"] = "Kappa" + z: float + + +class ReflectapiDemoTestsSerdeLargeEnumLambda(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Lambda"] = "Lambda" + + +class ReflectapiDemoTestsSerdeLargeEnumMu(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Mu"] = "Mu" + w: str + v: int + + +class ReflectapiDemoTestsSerdeLargeEnum(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeLargeEnumAlpha, + ReflectapiDemoTestsSerdeLargeEnumBeta, + ReflectapiDemoTestsSerdeLargeEnumGamma, + ReflectapiDemoTestsSerdeLargeEnumDelta, + ReflectapiDemoTestsSerdeLargeEnumEpsilon, + ReflectapiDemoTestsSerdeLargeEnumZeta, + ReflectapiDemoTestsSerdeLargeEnumEta, + ReflectapiDemoTestsSerdeLargeEnumTheta, + ReflectapiDemoTestsSerdeLargeEnumIota, + ReflectapiDemoTestsSerdeLargeEnumKappa, + ReflectapiDemoTestsSerdeLargeEnumLambda, + ReflectapiDemoTestsSerdeLargeEnumMu, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + LargeEnumAlpha = ReflectapiDemoTestsSerdeLargeEnumAlpha + LargeEnumBeta = ReflectapiDemoTestsSerdeLargeEnumBeta + LargeEnumGamma = ReflectapiDemoTestsSerdeLargeEnumGamma + LargeEnumDelta = ReflectapiDemoTestsSerdeLargeEnumDelta + LargeEnumEpsilon = ReflectapiDemoTestsSerdeLargeEnumEpsilon + LargeEnumZeta = ReflectapiDemoTestsSerdeLargeEnumZeta + LargeEnumEta = ReflectapiDemoTestsSerdeLargeEnumEta + LargeEnumTheta = ReflectapiDemoTestsSerdeLargeEnumTheta + LargeEnumIota = ReflectapiDemoTestsSerdeLargeEnumIota + LargeEnumKappa = ReflectapiDemoTestsSerdeLargeEnumKappa + LargeEnumLambda = ReflectapiDemoTestsSerdeLargeEnumLambda + LargeEnumMu = ReflectapiDemoTestsSerdeLargeEnumMu + LargeEnum = ReflectapiDemoTestsSerdeLargeEnum + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.LargeEnum] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.LargeEnum]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.LargeEnum]: Response containing reflectapi_demo.tests.serde.LargeEnum data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.LargeEnum, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.LargeEnum] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.LargeEnum]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.LargeEnum]: Response containing reflectapi_demo.tests.serde.LargeEnum data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.LargeEnum, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.LargeEnum.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_LargeEnumFactory: + """Factory class for creating reflectapi_demo.tests.serde.LargeEnum variants with ergonomic syntax. + + reflectapi_demo.tests.serde.LargeEnum variants + """ + + ALPHA = reflectapi_demo.tests.serde.LargeEnumAlpha() + BETA = reflectapi_demo.tests.serde.LargeEnumBeta() + EPSILON = reflectapi_demo.tests.serde.LargeEnumEpsilon() + ETA = reflectapi_demo.tests.serde.LargeEnumEta() + IOTA = reflectapi_demo.tests.serde.LargeEnumIota() + LAMBDA = reflectapi_demo.tests.serde.LargeEnumLambda() + + @staticmethod + def gamma(x: int) -> reflectapi_demo.tests.serde.LargeEnumGamma: + """Creates the 'Gamma' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" + return reflectapi_demo.tests.serde.LargeEnumGamma(x=x) + + @staticmethod + def delta(value: str) -> reflectapi_demo.tests.serde.LargeEnumDelta: + """Creates the 'Delta' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" + return reflectapi_demo.tests.serde.LargeEnumDelta(value=value) + + @staticmethod + def zeta(y: bool) -> reflectapi_demo.tests.serde.LargeEnumZeta: + """Creates the 'Zeta' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" + return reflectapi_demo.tests.serde.LargeEnumZeta(y=y) + + @staticmethod + def theta(value: int) -> reflectapi_demo.tests.serde.LargeEnumTheta: + """Creates the 'Theta' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" + return reflectapi_demo.tests.serde.LargeEnumTheta(value=value) + + @staticmethod + def kappa(z: float) -> reflectapi_demo.tests.serde.LargeEnumKappa: + """Creates the 'Kappa' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" + return reflectapi_demo.tests.serde.LargeEnumKappa(z=z) + + @staticmethod + def mu(w: str, v: int) -> reflectapi_demo.tests.serde.LargeEnumMu: + """Creates the 'Mu' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" + return reflectapi_demo.tests.serde.LargeEnumMu(w=w, v=v) + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_largeenum_response( + value: reflectapi_demo.tests.serde.LargeEnum, +) -> ApiResponse[reflectapi_demo.tests.serde.LargeEnum]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.LargeEnum.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants.snap new file mode 100644 index 00000000..06c3a9da --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants.snap @@ -0,0 +1,345 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::LargeEnum" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::LargeEnum" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "primitive", + "name": "bool", + "description": "Boolean value" + }, + { + "kind": "primitive", + "name": "f64", + "description": "64-bit floating point number" + }, + { + "kind": "primitive", + "name": "i32", + "description": "32-bit signed integer" + }, + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::LargeEnum", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Alpha", + "fields": "none" + }, + { + "name": "Beta", + "fields": "none" + }, + { + "name": "Gamma", + "fields": { + "named": [ + { + "name": "x", + "type": { + "name": "i32" + }, + "required": true + } + ] + } + }, + { + "name": "Delta", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Epsilon", + "fields": "none" + }, + { + "name": "Zeta", + "fields": { + "named": [ + { + "name": "y", + "type": { + "name": "bool" + }, + "required": true + } + ] + } + }, + { + "name": "Eta", + "fields": "none" + }, + { + "name": "Theta", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "name": "Iota", + "fields": "none" + }, + { + "name": "Kappa", + "fields": { + "named": [ + { + "name": "z", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + }, + { + "name": "Lambda", + "fields": "none" + }, + { + "name": "Mu", + "fields": { + "named": [ + { + "name": "w", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "v", + "type": { + "name": "i32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "primitive", + "name": "bool", + "description": "Boolean value" + }, + { + "kind": "primitive", + "name": "f64", + "description": "64-bit floating point number" + }, + { + "kind": "primitive", + "name": "i32", + "description": "32-bit signed integer" + }, + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::LargeEnum", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Alpha", + "fields": "none" + }, + { + "name": "Beta", + "fields": "none" + }, + { + "name": "Gamma", + "fields": { + "named": [ + { + "name": "x", + "type": { + "name": "i32" + }, + "required": true + } + ] + } + }, + { + "name": "Delta", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Epsilon", + "fields": "none" + }, + { + "name": "Zeta", + "fields": { + "named": [ + { + "name": "y", + "type": { + "name": "bool" + }, + "required": true + } + ] + } + }, + { + "name": "Eta", + "fields": "none" + }, + { + "name": "Theta", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "name": "Iota", + "fields": "none" + }, + { + "name": "Kappa", + "fields": { + "named": [ + { + "name": "z", + "type": { + "name": "f64" + }, + "required": true + } + ] + } + }, + { + "name": "Lambda", + "fields": "none" + }, + { + "name": "Mu", + "fields": { + "named": [ + { + "name": "w", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "v", + "type": { + "name": "i32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-2.snap new file mode 100644 index 00000000..50efd6d9 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-2.snap @@ -0,0 +1,71 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Action > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Action, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Action = + | { + kind: "create_item"; + data: { + name: string; + }; + } + | { + kind: "delete_item"; + data: { + id: number /* u32 */; + }; + }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Action, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Action, + {}, + reflectapi_demo.tests.serde.Action, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-3.snap new file mode 100644 index 00000000..34b8e251 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-3.snap @@ -0,0 +1,72 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Action > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Action, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Action, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "kind", content = "data")] + pub enum Action { + #[serde(rename = "create_item")] + CreateItem { name: std::string::String }, + #[serde(rename = "delete_item")] + DeleteItem { id: u32 }, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-4.snap new file mode 100644 index 00000000..bb7425b6 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-4.snap @@ -0,0 +1,108 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Action" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Action" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Action": { + "oneOf": [ + { + "type": "object", + "title": "create_item", + "required": [ + "data", + "kind" + ], + "properties": { + "data": { + "type": "object", + "title": "create_item", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "kind": { + "const": "create_item" + } + } + }, + { + "type": "object", + "title": "delete_item", + "required": [ + "data", + "kind" + ], + "properties": { + "data": { + "type": "object", + "title": "delete_item", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/u32" + } + } + }, + "kind": { + "const": "delete_item" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap new file mode 100644 index 00000000..d23c021b --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap @@ -0,0 +1,250 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Action > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeActionCreateItemVariant(BaseModel): + """create_item variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + + +class ReflectapiDemoTestsSerdeActionDeleteItemVariant(BaseModel): + """delete_item variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: int + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeActionVariants = Union[ + ReflectapiDemoTestsSerdeActionCreateItemVariant, + ReflectapiDemoTestsSerdeActionDeleteItemVariant, +] + + +class ReflectapiDemoTestsSerdeAction(RootModel[ReflectapiDemoTestsSerdeActionVariants]): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdeActionCreateItemVariant, + ReflectapiDemoTestsSerdeActionDeleteItemVariant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("kind") + content = data.get("data") + if tag is None: + raise ValueError("Missing tag field 'kind'") + if content is None and tag not in (): + raise ValueError("Missing content field 'data' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "create_item": + return ReflectapiDemoTestsSerdeActionCreateItemVariant(**content) + if tag == "delete_item": + return ReflectapiDemoTestsSerdeActionDeleteItemVariant(**content) + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeAction: {}".format(data) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeActionCreateItemVariant): + return {"kind": "create_item", "data": self.root.model_dump()} + if isinstance(self.root, ReflectapiDemoTestsSerdeActionDeleteItemVariant): + return {"kind": "delete_item", "data": self.root.model_dump()} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeAction variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + ActionCreateItemVariant = ReflectapiDemoTestsSerdeActionCreateItemVariant + ActionDeleteItemVariant = ReflectapiDemoTestsSerdeActionDeleteItemVariant + Action = ReflectapiDemoTestsSerdeAction + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Action] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Action]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Action]: Response containing reflectapi_demo.tests.serde.Action data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Action, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Action] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Action]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Action]: Response containing reflectapi_demo.tests.serde.Action data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Action, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Action.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_ActionFactory: + """Factory class for creating reflectapi_demo.tests.serde.Action variants with ergonomic syntax. + + reflectapi_demo.tests.serde.Action variants + """ + + @staticmethod + def create_item(name: str) -> reflectapi_demo.tests.serde.Action: + """Creates the 'create_item' variant of the reflectapi_demo.tests.serde.Action enum.""" + return reflectapi_demo.tests.serde.Action( + reflectapi_demo.tests.serde.ActionCreateItemVariant(name=name) + ) + + @staticmethod + def delete_item(id: int) -> reflectapi_demo.tests.serde.Action: + """Creates the 'delete_item' variant of the reflectapi_demo.tests.serde.Action enum.""" + return reflectapi_demo.tests.serde.Action( + reflectapi_demo.tests.serde.ActionDeleteItemVariant(id=id) + ) + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_action_response( + value: reflectapi_demo.tests.serde.Action, +) -> ApiResponse[reflectapi_demo.tests.serde.Action]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Action.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants.snap new file mode 100644 index 00000000..7e7e7ca6 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants.snap @@ -0,0 +1,143 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Action" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Action" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Action", + "representation": { + "adjacent": { + "tag": "kind", + "content": "data" + } + }, + "variants": [ + { + "name": "create_item", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "delete_item", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Action", + "representation": { + "adjacent": { + "tag": "kind", + "content": "data" + } + }, + "variants": [ + { + "name": "create_item", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "delete_item", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-2.snap new file mode 100644 index 00000000..c542aa43 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-2.snap @@ -0,0 +1,64 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Keywords > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Keywords, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface Keywords { + type: string; + class: string; + from: string; + import: string; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Keywords, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Keywords, + {}, + reflectapi_demo.tests.serde.Keywords, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-3.snap new file mode 100644 index 00000000..574c49da --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-3.snap @@ -0,0 +1,72 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Keywords > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Keywords, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Keywords, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Keywords { + #[serde(rename = "type")] + pub type_: std::string::String, + pub class: std::string::String, + pub from: std::string::String, + pub import: std::string::String, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-4.snap new file mode 100644 index 00000000..c43d499b --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-4.snap @@ -0,0 +1,74 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Keywords" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Keywords" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Keywords": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Keywords", + "required": [ + "class", + "from", + "import", + "type" + ], + "properties": { + "class": { + "$ref": "#/components/schemas/std.string.String" + }, + "from": { + "$ref": "#/components/schemas/std.string.String" + }, + "import": { + "$ref": "#/components/schemas/std.string.String" + }, + "type": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap new file mode 100644 index 00000000..d977e9e1 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap @@ -0,0 +1,165 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Keywords > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeKeywords(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type_: str = Field(serialization_alias="type", validation_alias="type") + class_: str = Field(serialization_alias="class", validation_alias="class") + from_: str = Field(serialization_alias="from", validation_alias="from") + import_: str = Field(serialization_alias="import", validation_alias="import") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Keywords = ReflectapiDemoTestsSerdeKeywords + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Keywords] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Keywords]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Keywords]: Response containing reflectapi_demo.tests.serde.Keywords data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Keywords, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Keywords] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Keywords]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Keywords]: Response containing reflectapi_demo.tests.serde.Keywords data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Keywords, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Keywords.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_keywords_response( + value: reflectapi_demo.tests.serde.Keywords, +) -> ApiResponse[reflectapi_demo.tests.serde.Keywords]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Keywords.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords.snap new file mode 100644 index 00000000..c1317400 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords.snap @@ -0,0 +1,125 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Keywords" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Keywords" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Keywords", + "fields": { + "named": [ + { + "name": "type", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "class", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "from", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "import", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Keywords", + "fields": { + "named": [ + { + "name": "type", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "class", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "from", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "import", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-2.snap new file mode 100644 index 00000000..8211417e --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-2.snap @@ -0,0 +1,63 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < SpecialNames > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.SpecialNames, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface SpecialNames { + "Content-Type": string; + "x.nested.key": string; + "has spaces": number /* u32 */; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.SpecialNames, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.SpecialNames, + {}, + reflectapi_demo.tests.serde.SpecialNames, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-3.snap new file mode 100644 index 00000000..bf7828a3 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-3.snap @@ -0,0 +1,73 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < SpecialNames > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::SpecialNames, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::SpecialNames, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct SpecialNames { + #[serde(rename = "Content-Type")] + pub content__type: std::string::String, + #[serde(rename = "x.nested.key")] + pub nested_key: std::string::String, + #[serde(rename = "has spaces")] + pub has_spaces: u32, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-4.snap new file mode 100644 index 00000000..fb55328d --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-4.snap @@ -0,0 +1,74 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.SpecialNames" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.SpecialNames" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.SpecialNames": { + "type": "object", + "title": "reflectapi_demo.tests.serde.SpecialNames", + "required": [ + "Content-Type", + "has spaces", + "x.nested.key" + ], + "properties": { + "Content-Type": { + "$ref": "#/components/schemas/std.string.String" + }, + "has spaces": { + "$ref": "#/components/schemas/u32" + }, + "x.nested.key": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap new file mode 100644 index 00000000..728c73a7 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap @@ -0,0 +1,170 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < SpecialNames > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeSpecialNames(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + content_type: str = Field( + serialization_alias="Content-Type", validation_alias="Content-Type" + ) + nested_key: str = Field( + serialization_alias="x.nested.key", validation_alias="x.nested.key" + ) + has_spaces: int = Field( + serialization_alias="has spaces", validation_alias="has spaces" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + SpecialNames = ReflectapiDemoTestsSerdeSpecialNames + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.SpecialNames] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.SpecialNames]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.SpecialNames]: Response containing reflectapi_demo.tests.serde.SpecialNames data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.SpecialNames, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.SpecialNames] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.SpecialNames]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.SpecialNames]: Response containing reflectapi_demo.tests.serde.SpecialNames data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.SpecialNames, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.SpecialNames.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_specialnames_response( + value: reflectapi_demo.tests.serde.SpecialNames, +) -> ApiResponse[reflectapi_demo.tests.serde.SpecialNames]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.SpecialNames.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars.snap new file mode 100644 index 00000000..729799a8 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars.snap @@ -0,0 +1,127 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::SpecialNames" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::SpecialNames" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::SpecialNames", + "fields": { + "named": [ + { + "name": "Content_Type", + "serde_name": "Content-Type", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "nested_key", + "serde_name": "x.nested.key", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "has_spaces", + "serde_name": "has spaces", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::SpecialNames", + "fields": { + "named": [ + { + "name": "Content_Type", + "serde_name": "Content-Type", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "nested_key", + "serde_name": "x.nested.key", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "has_spaces", + "serde_name": "has spaces", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-2.snap new file mode 100644 index 00000000..4f5275ad --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-2.snap @@ -0,0 +1,66 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Item > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Item, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Item = { + name: string; + } & NullToEmptyObject; + + export type Status = + | { status: "Active" } + | { status: "Inactive" } + | { status: "Pending" }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Item, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Item, + {}, + reflectapi_demo.tests.serde.Item, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-3.snap new file mode 100644 index 00000000..450c9930 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-3.snap @@ -0,0 +1,78 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Item > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Item, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Item, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Item { + pub name: std::string::String, + #[serde(flatten)] + pub status: super::super::super::reflectapi_demo::tests::serde::Status, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "status")] + pub enum Status { + Active, + Inactive, + Pending, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-4.snap new file mode 100644 index 00000000..102d8ac2 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-4.snap @@ -0,0 +1,109 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Item" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Item" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Item": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Status" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Item", + "required": [ + "name" + ], + "properties": { + "name": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Status": { + "oneOf": [ + { + "type": "object", + "title": "Active", + "required": [ + "status" + ], + "properties": { + "status": { + "const": "Active" + } + } + }, + { + "type": "object", + "title": "Inactive", + "required": [ + "status" + ], + "properties": { + "status": { + "const": "Inactive" + } + } + }, + { + "type": "object", + "title": "Pending", + "required": [ + "status" + ], + "properties": { + "status": { + "const": "Pending" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap new file mode 100644 index 00000000..996dcc5d --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap @@ -0,0 +1,262 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Item > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Literal, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict, Field, RootModel + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeStatusActive(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + status: Literal["Active"] = "Active" + + +class ReflectapiDemoTestsSerdeStatusInactive(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + status: Literal["Inactive"] = "Inactive" + + +class ReflectapiDemoTestsSerdeStatusPending(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + status: Literal["Pending"] = "Pending" + + +class ReflectapiDemoTestsSerdeStatus(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeStatusActive, + ReflectapiDemoTestsSerdeStatusInactive, + ReflectapiDemoTestsSerdeStatusPending, + ], + Field(discriminator="status"), + ] + + +class ReflectapiDemoTestsSerdeItemActive(BaseModel): + """'Active' variant of ReflectapiDemoTestsSerdeItem""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + status: Literal["Active"] = "Active" + + +class ReflectapiDemoTestsSerdeItemInactive(BaseModel): + """'Inactive' variant of ReflectapiDemoTestsSerdeItem""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + status: Literal["Inactive"] = "Inactive" + + +class ReflectapiDemoTestsSerdeItemPending(BaseModel): + """'Pending' variant of ReflectapiDemoTestsSerdeItem""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + status: Literal["Pending"] = "Pending" + + +class ReflectapiDemoTestsSerdeItem(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeItemActive, + ReflectapiDemoTestsSerdeItemInactive, + ReflectapiDemoTestsSerdeItemPending, + ], + Field(discriminator="status"), + ] + + +try: + ReflectapiDemoTestsSerdeItemActive.model_rebuild() + ReflectapiDemoTestsSerdeItemInactive.model_rebuild() + ReflectapiDemoTestsSerdeItemPending.model_rebuild() +except AttributeError: + pass + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + StatusActive = ReflectapiDemoTestsSerdeStatusActive + StatusInactive = ReflectapiDemoTestsSerdeStatusInactive + StatusPending = ReflectapiDemoTestsSerdeStatusPending + Status = ReflectapiDemoTestsSerdeStatus + ItemActive = ReflectapiDemoTestsSerdeItemActive + ItemInactive = ReflectapiDemoTestsSerdeItemInactive + ItemPending = ReflectapiDemoTestsSerdeItemPending + Item = ReflectapiDemoTestsSerdeItem + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Item] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Item]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Item]: Response containing reflectapi_demo.tests.serde.Item data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Item, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Item] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Item]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Item]: Response containing reflectapi_demo.tests.serde.Item data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Item, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Item.model_rebuild() + reflectapi_demo.tests.serde.Status.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_StatusFactory: + """Factory class for creating reflectapi_demo.tests.serde.Status variants with ergonomic syntax. + + reflectapi_demo.tests.serde.Status variants + """ + + ACTIVE = reflectapi_demo.tests.serde.StatusActive() + INACTIVE = reflectapi_demo.tests.serde.StatusInactive() + PENDING = reflectapi_demo.tests.serde.StatusPending() + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_item_response( + value: reflectapi_demo.tests.serde.Item, +) -> ApiResponse[reflectapi_demo.tests.serde.Item]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Item.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_status_response( + value: reflectapi_demo.tests.serde.Status, +) -> ApiResponse[reflectapi_demo.tests.serde.Status]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Status.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only.snap new file mode 100644 index 00000000..ce79d688 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only.snap @@ -0,0 +1,145 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Item" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Item" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Item", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "status", + "type": { + "name": "reflectapi_demo::tests::serde::Status" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Status", + "representation": { + "internal": { + "tag": "status" + } + }, + "variants": [ + { + "name": "Active", + "fields": "none" + }, + { + "name": "Inactive", + "fields": "none" + }, + { + "name": "Pending", + "fields": "none" + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Item", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "status", + "type": { + "name": "reflectapi_demo::tests::serde::Status" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Status", + "representation": { + "internal": { + "tag": "status" + } + }, + "variants": [ + { + "name": "Active", + "fields": "none" + }, + { + "name": "Inactive", + "fields": "none" + }, + { + "name": "Pending", + "fields": "none" + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-2.snap new file mode 100644 index 00000000..6e128c1e --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-2.snap @@ -0,0 +1,72 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Document > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Document, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Document = { + title: string; + } & NullToEmptyObject & + NullToEmptyObject; + + export interface Metadata { + author: string; + version: number /* u32 */; + } + + export interface Timestamps { + created_at: string; + updated_at: string; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Document, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Document, + {}, + reflectapi_demo.tests.serde.Document, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-3.snap new file mode 100644 index 00000000..f5774e43 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-3.snap @@ -0,0 +1,84 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Document > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Document, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Document, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Document { + pub title: std::string::String, + #[serde(flatten)] + pub timestamps: super::super::super::reflectapi_demo::tests::serde::Timestamps, + #[serde(flatten)] + pub meta: super::super::super::reflectapi_demo::tests::serde::Metadata, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Metadata { + pub author: std::string::String, + pub version: u32, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Timestamps { + pub created_at: std::string::String, + pub updated_at: std::string::String, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-4.snap new file mode 100644 index 00000000..56d47fdf --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-4.snap @@ -0,0 +1,108 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Document" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Document" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Document": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Timestamps" + }, + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Metadata" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Document", + "required": [ + "title" + ], + "properties": { + "title": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Metadata": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Metadata", + "required": [ + "author", + "version" + ], + "properties": { + "author": { + "$ref": "#/components/schemas/std.string.String" + }, + "version": { + "$ref": "#/components/schemas/u32" + } + } + }, + "reflectapi_demo.tests.serde.Timestamps": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Timestamps", + "required": [ + "created_at", + "updated_at" + ], + "properties": { + "created_at": { + "$ref": "#/components/schemas/std.string.String" + }, + "updated_at": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap new file mode 100644 index 00000000..72a197d1 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap @@ -0,0 +1,202 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Document > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeTimestamps(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + created_at: str + updated_at: str + + +class ReflectapiDemoTestsSerdeMetadata(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + author: str + version: int + + +class ReflectapiDemoTestsSerdeDocument(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + title: str + created_at: str + updated_at: str + author: str + version: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Timestamps = ReflectapiDemoTestsSerdeTimestamps + Metadata = ReflectapiDemoTestsSerdeMetadata + Document = ReflectapiDemoTestsSerdeDocument + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Document] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Document]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Document]: Response containing reflectapi_demo.tests.serde.Document data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Document, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Document] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Document]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Document]: Response containing reflectapi_demo.tests.serde.Document data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Document, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Document.model_rebuild() + reflectapi_demo.tests.serde.Metadata.model_rebuild() + reflectapi_demo.tests.serde.Timestamps.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_document_response( + value: reflectapi_demo.tests.serde.Document, +) -> ApiResponse[reflectapi_demo.tests.serde.Document]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Document.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_metadata_response( + value: reflectapi_demo.tests.serde.Metadata, +) -> ApiResponse[reflectapi_demo.tests.serde.Metadata]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Metadata.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_timestamps_response( + value: reflectapi_demo.tests.serde.Timestamps, +) -> ApiResponse[reflectapi_demo.tests.serde.Timestamps]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Timestamps.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs.snap new file mode 100644 index 00000000..f5d4dda4 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs.snap @@ -0,0 +1,213 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Document" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Document" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Document", + "fields": { + "named": [ + { + "name": "title", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "timestamps", + "type": { + "name": "reflectapi_demo::tests::serde::Timestamps" + }, + "required": true, + "flattened": true + }, + { + "name": "meta", + "type": { + "name": "reflectapi_demo::tests::serde::Metadata" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Metadata", + "fields": { + "named": [ + { + "name": "author", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "version", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Timestamps", + "fields": { + "named": [ + { + "name": "created_at", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "updated_at", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Document", + "fields": { + "named": [ + { + "name": "title", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "timestamps", + "type": { + "name": "reflectapi_demo::tests::serde::Timestamps" + }, + "required": true, + "flattened": true + }, + { + "name": "meta", + "type": { + "name": "reflectapi_demo::tests::serde::Metadata" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Metadata", + "fields": { + "named": [ + { + "name": "author", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "version", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Timestamps", + "fields": { + "named": [ + { + "name": "created_at", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "updated_at", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-2.snap new file mode 100644 index 00000000..a3b00636 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-2.snap @@ -0,0 +1,68 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Task > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Task, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Priority = + | { + kind: "High"; + deadline: string; + } + | { kind: "Low" }; + + export type Task = { + title: string; + } & NullToEmptyObject; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Task, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Task, + {}, + reflectapi_demo.tests.serde.Task, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-3.snap new file mode 100644 index 00000000..08f18b11 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-3.snap @@ -0,0 +1,79 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Task > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Task, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Task, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "kind")] + pub enum Priority { + High { deadline: std::string::String }, + Low, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Task { + pub title: std::string::String, + #[serde(flatten)] + pub priority: std::option::Option< + super::super::super::reflectapi_demo::tests::serde::Priority, + >, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-4.snap new file mode 100644 index 00000000..e512fad1 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-4.snap @@ -0,0 +1,109 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Task" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Task" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Priority": { + "oneOf": [ + { + "type": "object", + "title": "High", + "required": [ + "deadline", + "kind" + ], + "properties": { + "deadline": { + "$ref": "#/components/schemas/std.string.String" + }, + "kind": { + "const": "High" + } + } + }, + { + "type": "object", + "title": "Low", + "required": [ + "kind" + ], + "properties": { + "kind": { + "const": "Low" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Task": { + "allOf": [ + { + "oneOf": [ + { + "description": "Null", + "type": "null" + }, + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Priority" + } + ] + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Task", + "required": [ + "title" + ], + "properties": { + "title": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap new file mode 100644 index 00000000..7cb6149c --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap @@ -0,0 +1,244 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Task > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Literal, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict, Field, RootModel + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdePriorityHigh(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + kind: Literal["High"] = "High" + deadline: str + + +class ReflectapiDemoTestsSerdePriorityLow(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + kind: Literal["Low"] = "Low" + + +class ReflectapiDemoTestsSerdePriority(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdePriorityHigh, ReflectapiDemoTestsSerdePriorityLow + ], + Field(discriminator="kind"), + ] + + +class ReflectapiDemoTestsSerdeTaskHigh(BaseModel): + """'High' variant of ReflectapiDemoTestsSerdeTask""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + title: str + kind: Literal["High"] = "High" + deadline: str + + +class ReflectapiDemoTestsSerdeTaskLow(BaseModel): + """'Low' variant of ReflectapiDemoTestsSerdeTask""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + title: str + kind: Literal["Low"] = "Low" + + +class ReflectapiDemoTestsSerdeTask(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeTaskHigh, + ReflectapiDemoTestsSerdeTaskLow, + ], + Field(discriminator="kind"), + ] + + +try: + ReflectapiDemoTestsSerdeTaskHigh.model_rebuild() + ReflectapiDemoTestsSerdeTaskLow.model_rebuild() +except AttributeError: + pass + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + PriorityHigh = ReflectapiDemoTestsSerdePriorityHigh + PriorityLow = ReflectapiDemoTestsSerdePriorityLow + Priority = ReflectapiDemoTestsSerdePriority + TaskHigh = ReflectapiDemoTestsSerdeTaskHigh + TaskLow = ReflectapiDemoTestsSerdeTaskLow + Task = ReflectapiDemoTestsSerdeTask + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Task] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Task]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Task]: Response containing reflectapi_demo.tests.serde.Task data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Task, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Task] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Task]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Task]: Response containing reflectapi_demo.tests.serde.Task data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Task, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Priority.model_rebuild() + reflectapi_demo.tests.serde.Task.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_PriorityFactory: + """Factory class for creating reflectapi_demo.tests.serde.Priority variants with ergonomic syntax. + + reflectapi_demo.tests.serde.Priority variants + """ + + LOW = reflectapi_demo.tests.serde.PriorityLow() + + @staticmethod + def high(deadline: str) -> reflectapi_demo.tests.serde.PriorityHigh: + """Creates the 'High' variant of the reflectapi_demo.tests.serde.Priority enum.""" + return reflectapi_demo.tests.serde.PriorityHigh(deadline=deadline) + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_priority_response( + value: reflectapi_demo.tests.serde.Priority, +) -> ApiResponse[reflectapi_demo.tests.serde.Priority]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Priority.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_task_response( + value: reflectapi_demo.tests.serde.Task, +) -> ApiResponse[reflectapi_demo.tests.serde.Task]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Task.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum.snap new file mode 100644 index 00000000..bfc043b8 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum.snap @@ -0,0 +1,231 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Task" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Task" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Priority", + "representation": { + "internal": { + "tag": "kind" + } + }, + "variants": [ + { + "name": "High", + "fields": { + "named": [ + { + "name": "deadline", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Low", + "fields": "none" + } + ] + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Task", + "fields": { + "named": [ + { + "name": "title", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "priority", + "type": { + "name": "std::option::Option", + "arguments": [ + { + "name": "reflectapi_demo::tests::serde::Priority" + } + ] + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Priority", + "representation": { + "internal": { + "tag": "kind" + } + }, + "variants": [ + { + "name": "High", + "fields": { + "named": [ + { + "name": "deadline", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Low", + "fields": "none" + } + ] + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Task", + "fields": { + "named": [ + { + "name": "title", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "priority", + "type": { + "name": "std::option::Option", + "arguments": [ + { + "name": "reflectapi_demo::tests::serde::Priority" + } + ] + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-2.snap new file mode 100644 index 00000000..2c85608a --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-2.snap @@ -0,0 +1,77 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Post > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Post, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface Audit { + modified_by: string; + } + + export type Content = + | { + type: "Text"; + body: string; + } + | { + type: "Image"; + url: string; + width: number /* u32 */; + }; + + export type Post = { + id: string; + } & NullToEmptyObject & + NullToEmptyObject; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Post, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Post, + {}, + reflectapi_demo.tests.serde.Post, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-3.snap new file mode 100644 index 00000000..bfa321e6 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-3.snap @@ -0,0 +1,89 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Post > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Post, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Post, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Audit { + pub modified_by: std::string::String, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "type")] + pub enum Content { + Text { + body: std::string::String, + }, + Image { + url: std::string::String, + width: u32, + }, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Post { + pub id: std::string::String, + #[serde(flatten)] + pub audit: super::super::super::reflectapi_demo::tests::serde::Audit, + #[serde(flatten)] + pub content: super::super::super::reflectapi_demo::tests::serde::Content, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-4.snap new file mode 100644 index 00000000..53a1b92d --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-4.snap @@ -0,0 +1,128 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Post" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Post" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Audit": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Audit", + "required": [ + "modified_by" + ], + "properties": { + "modified_by": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "reflectapi_demo.tests.serde.Content": { + "oneOf": [ + { + "type": "object", + "title": "Text", + "required": [ + "body", + "type" + ], + "properties": { + "body": { + "$ref": "#/components/schemas/std.string.String" + }, + "type": { + "const": "Text" + } + } + }, + { + "type": "object", + "title": "Image", + "required": [ + "type", + "url", + "width" + ], + "properties": { + "type": { + "const": "Image" + }, + "url": { + "$ref": "#/components/schemas/std.string.String" + }, + "width": { + "$ref": "#/components/schemas/u32" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Post": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Audit" + }, + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Content" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Post", + "required": [ + "id" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap new file mode 100644 index 00000000..41a64930 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap @@ -0,0 +1,274 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Post > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Literal, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict, Field, RootModel + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeAudit(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + modified_by: str + + +class ReflectapiDemoTestsSerdeContentText(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Text"] = "Text" + body: str + + +class ReflectapiDemoTestsSerdeContentImage(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Image"] = "Image" + url: str + width: int + + +class ReflectapiDemoTestsSerdeContent(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeContentText, ReflectapiDemoTestsSerdeContentImage + ], + Field(discriminator="type"), + ] + + +class ReflectapiDemoTestsSerdePostText(BaseModel): + """'Text' variant of ReflectapiDemoTestsSerdePost""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + modified_by: str + type_: Literal["Text"] = Field( + default="Text", serialization_alias="type", validation_alias="type" + ) + body: str + + +class ReflectapiDemoTestsSerdePostImage(BaseModel): + """'Image' variant of ReflectapiDemoTestsSerdePost""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + modified_by: str + type_: Literal["Image"] = Field( + default="Image", serialization_alias="type", validation_alias="type" + ) + url: str + width: int + + +class ReflectapiDemoTestsSerdePost(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdePostText, + ReflectapiDemoTestsSerdePostImage, + ], + Field(discriminator="type_"), + ] + + +try: + ReflectapiDemoTestsSerdePostText.model_rebuild() + ReflectapiDemoTestsSerdePostImage.model_rebuild() +except AttributeError: + pass + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Audit = ReflectapiDemoTestsSerdeAudit + ContentText = ReflectapiDemoTestsSerdeContentText + ContentImage = ReflectapiDemoTestsSerdeContentImage + Content = ReflectapiDemoTestsSerdeContent + PostText = ReflectapiDemoTestsSerdePostText + PostImage = ReflectapiDemoTestsSerdePostImage + Post = ReflectapiDemoTestsSerdePost + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Post] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Post]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Post]: Response containing reflectapi_demo.tests.serde.Post data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Post, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Post] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Post]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Post]: Response containing reflectapi_demo.tests.serde.Post data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Post, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Audit.model_rebuild() + reflectapi_demo.tests.serde.Content.model_rebuild() + reflectapi_demo.tests.serde.Post.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_ContentFactory: + """Factory class for creating reflectapi_demo.tests.serde.Content variants with ergonomic syntax. + + reflectapi_demo.tests.serde.Content variants + """ + + @staticmethod + def text(body: str) -> reflectapi_demo.tests.serde.ContentText: + """Creates the 'Text' variant of the reflectapi_demo.tests.serde.Content enum.""" + return reflectapi_demo.tests.serde.ContentText(body=body) + + @staticmethod + def image(url: str, width: int) -> reflectapi_demo.tests.serde.ContentImage: + """Creates the 'Image' variant of the reflectapi_demo.tests.serde.Content enum.""" + return reflectapi_demo.tests.serde.ContentImage(url=url, width=width) + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_audit_response( + value: reflectapi_demo.tests.serde.Audit, +) -> ApiResponse[reflectapi_demo.tests.serde.Audit]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Audit.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_content_response( + value: reflectapi_demo.tests.serde.Content, +) -> ApiResponse[reflectapi_demo.tests.serde.Content]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Content.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_post_response( + value: reflectapi_demo.tests.serde.Post, +) -> ApiResponse[reflectapi_demo.tests.serde.Post]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Post.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined.snap new file mode 100644 index 00000000..3d76d0b7 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined.snap @@ -0,0 +1,247 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Post" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Post" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Audit", + "fields": { + "named": [ + { + "name": "modified_by", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Content", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Text", + "fields": { + "named": [ + { + "name": "body", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Image", + "fields": { + "named": [ + { + "name": "url", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "width", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Post", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "audit", + "type": { + "name": "reflectapi_demo::tests::serde::Audit" + }, + "required": true, + "flattened": true + }, + { + "name": "content", + "type": { + "name": "reflectapi_demo::tests::serde::Content" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Audit", + "fields": { + "named": [ + { + "name": "modified_by", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Content", + "representation": { + "internal": { + "tag": "type" + } + }, + "variants": [ + { + "name": "Text", + "fields": { + "named": [ + { + "name": "body", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "name": "Image", + "fields": { + "named": [ + { + "name": "url", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "width", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + } + ] + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Post", + "fields": { + "named": [ + { + "name": "id", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "audit", + "type": { + "name": "reflectapi_demo::tests::serde::Audit" + }, + "required": true, + "flattened": true + }, + { + "name": "content", + "type": { + "name": "reflectapi_demo::tests::serde::Content" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-2.snap new file mode 100644 index 00000000..104ae1cd --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-2.snap @@ -0,0 +1,69 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Outer > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Outer, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface Inner { + z: string; + } + + export type Middle = { + y: number /* u32 */; + } & NullToEmptyObject; + + export type Outer = { + x: string; + } & NullToEmptyObject; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Outer, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Outer, + {}, + reflectapi_demo.tests.serde.Outer, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-3.snap new file mode 100644 index 00000000..92969993 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-3.snap @@ -0,0 +1,82 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Outer > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Outer, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Outer, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Inner { + pub z: std::string::String, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Middle { + pub y: u32, + #[serde(flatten)] + pub inner: super::super::super::reflectapi_demo::tests::serde::Inner, + } + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Outer { + pub x: std::string::String, + #[serde(flatten)] + pub nested: super::super::super::reflectapi_demo::tests::serde::Middle, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-4.snap new file mode 100644 index 00000000..e358c7d6 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-4.snap @@ -0,0 +1,104 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Outer" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Outer" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Inner": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Inner", + "required": [ + "z" + ], + "properties": { + "z": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "reflectapi_demo.tests.serde.Middle": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Inner" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Middle", + "required": [ + "y" + ], + "properties": { + "y": { + "$ref": "#/components/schemas/u32" + } + } + } + ] + }, + "reflectapi_demo.tests.serde.Outer": { + "allOf": [ + { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Middle" + }, + { + "type": "object", + "title": "reflectapi_demo.tests.serde.Outer", + "required": [ + "x" + ], + "properties": { + "x": { + "$ref": "#/components/schemas/std.string.String" + } + } + } + ] + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap new file mode 100644 index 00000000..46b90147 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap @@ -0,0 +1,199 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Outer > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeInner(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + z: str + + +class ReflectapiDemoTestsSerdeMiddle(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + y: int + z: str + + +class ReflectapiDemoTestsSerdeOuter(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + x: str + y: int + z: str + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Inner = ReflectapiDemoTestsSerdeInner + Middle = ReflectapiDemoTestsSerdeMiddle + Outer = ReflectapiDemoTestsSerdeOuter + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Outer] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Outer]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Outer]: Response containing reflectapi_demo.tests.serde.Outer data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Outer, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Outer] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Outer]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Outer]: Response containing reflectapi_demo.tests.serde.Outer data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Outer, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Inner.model_rebuild() + reflectapi_demo.tests.serde.Middle.model_rebuild() + reflectapi_demo.tests.serde.Outer.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_inner_response( + value: reflectapi_demo.tests.serde.Inner, +) -> ApiResponse[reflectapi_demo.tests.serde.Inner]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Inner.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_middle_response( + value: reflectapi_demo.tests.serde.Middle, +) -> ApiResponse[reflectapi_demo.tests.serde.Middle]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Middle.""" + return create_api_response(value) + + +def create_reflectapi_demo_tests_serde_outer_response( + value: reflectapi_demo.tests.serde.Outer, +) -> ApiResponse[reflectapi_demo.tests.serde.Outer]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Outer.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten.snap new file mode 100644 index 00000000..b4f5c31e --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten.snap @@ -0,0 +1,185 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Outer" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Outer" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Inner", + "fields": { + "named": [ + { + "name": "z", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Middle", + "fields": { + "named": [ + { + "name": "y", + "type": { + "name": "u32" + }, + "required": true + }, + { + "name": "inner", + "type": { + "name": "reflectapi_demo::tests::serde::Inner" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Outer", + "fields": { + "named": [ + { + "name": "x", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "nested", + "type": { + "name": "reflectapi_demo::tests::serde::Middle" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Inner", + "fields": { + "named": [ + { + "name": "z", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Middle", + "fields": { + "named": [ + { + "name": "y", + "type": { + "name": "u32" + }, + "required": true + }, + { + "name": "inner", + "type": { + "name": "reflectapi_demo::tests::serde::Inner" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Outer", + "fields": { + "named": [ + { + "name": "x", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "nested", + "type": { + "name": "reflectapi_demo::tests::serde::Middle" + }, + "required": true, + "flattened": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-2.snap new file mode 100644 index 00000000..ba6f6301 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-2.snap @@ -0,0 +1,59 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Tagged > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Tagged, + headers: {}, + options?: RequestOptions, + ) => AsyncResult, {}>; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Tagged = { t: "Item"; c: T } | { t: "Nothing"; c: {} }; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Tagged, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Tagged, + {}, + reflectapi_demo.tests.serde.Tagged, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-3.snap new file mode 100644 index 00000000..e8ab1b85 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-3.snap @@ -0,0 +1,70 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Tagged > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Tagged, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Tagged, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + #[serde(tag = "t", content = "c")] + pub enum Tagged { + Item(T), + Nothing, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-4.snap new file mode 100644 index 00000000..977c9e86 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-4.snap @@ -0,0 +1,120 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "title": "Item", + "required": [ + "c", + "t" + ], + "properties": { + "c": { + "$ref": "#/components/schemas/u32" + }, + "t": { + "const": "Item" + } + } + }, + { + "type": "object", + "title": "Nothing", + "required": [ + "c", + "t" + ], + "properties": { + "c": { + "type": "object", + "title": "Nothing", + "properties": {} + }, + "t": { + "const": "Nothing" + } + } + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "title": "Item", + "required": [ + "c", + "t" + ], + "properties": { + "c": { + "$ref": "#/components/schemas/u32" + }, + "t": { + "const": "Item" + } + } + }, + { + "type": "object", + "title": "Nothing", + "required": [ + "c", + "t" + ], + "properties": { + "c": { + "type": "object", + "title": "Nothing", + "properties": {} + }, + "t": { + "const": "Nothing" + } + } + } + ] + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap new file mode 100644 index 00000000..28351155 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap @@ -0,0 +1,238 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Tagged > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +# Type variables for generic types + + +T = TypeVar("T") + + +class ReflectapiDemoTestsSerdeTaggedItemVariant(BaseModel, Generic[T]): + """Item variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: T + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeTaggedVariants = Union[ + ReflectapiDemoTestsSerdeTaggedItemVariant, Literal["Nothing"] +] + + +class ReflectapiDemoTestsSerdeTagged( + RootModel[ReflectapiDemoTestsSerdeTaggedVariants], Generic[T] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance(data, (ReflectapiDemoTestsSerdeTaggedItemVariant)): + return data + if isinstance(data, dict): + tag = data.get("t") + content = data.get("c") + if tag is None: + raise ValueError("Missing tag field 't'") + if content is None and tag not in ("Nothing"): + raise ValueError("Missing content field 'c' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "Item": + return ReflectapiDemoTestsSerdeTaggedItemVariant(field_0=content) + if tag == "Nothing": + return "Nothing" + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeTagged: {}".format(data) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeTaggedItemVariant): + return {"t": "Item", "c": self.root.field_0} + if self.root == "Nothing": + return {"t": "Nothing"} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTagged variant: {type(self.root)}" + ) + + def __class_getitem__(cls, params): + return cls + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TaggedItemVariant = ReflectapiDemoTestsSerdeTaggedItemVariant + Tagged = ReflectapiDemoTestsSerdeTagged + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Tagged[int]] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Tagged[int]]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Tagged[int]]: Response containing reflectapi_demo.tests.serde.Tagged[int] data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Tagged[int], + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Tagged[int]] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Tagged[int]]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Tagged[int]]: Response containing reflectapi_demo.tests.serde.Tagged[int] data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Tagged[int], + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Tagged.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_TaggedFactory: + """Factory class for creating reflectapi_demo.tests.serde.Tagged variants with ergonomic syntax. + + reflectapi_demo.tests.serde.Tagged variants + """ + + @staticmethod + def item(field_0: T) -> reflectapi_demo.tests.serde.Tagged[T]: + """Creates the 'Item' variant of the reflectapi_demo.tests.serde.Tagged enum.""" + return reflectapi_demo.tests.serde.Tagged( + reflectapi_demo.tests.serde.TaggedItemVariant[T](field_0=field_0) + ) + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_tagged_response( + value: reflectapi_demo.tests.serde.Tagged, +) -> ApiResponse[reflectapi_demo.tests.serde.Tagged]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Tagged.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum.snap new file mode 100644 index 00000000..8f4ca1b9 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum.snap @@ -0,0 +1,133 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Tagged", + "arguments": [ + { + "name": "u32" + } + ] + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Tagged", + "arguments": [ + { + "name": "u32" + } + ] + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Tagged", + "parameters": [ + { + "name": "T" + } + ], + "representation": { + "adjacent": { + "tag": "t", + "content": "c" + } + }, + "variants": [ + { + "name": "Item", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + }, + "required": true + } + ] + } + }, + { + "name": "Nothing", + "fields": "none" + } + ] + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Tagged", + "parameters": [ + { + "name": "T" + } + ], + "representation": { + "adjacent": { + "tag": "t", + "content": "c" + } + }, + "variants": [ + { + "name": "Item", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + }, + "required": true + } + ] + } + }, + { + "name": "Nothing", + "fields": "none" + } + ] + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-2.snap new file mode 100644 index 00000000..6430fbcb --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-2.snap @@ -0,0 +1,63 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Wrapper > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Wrapper, + headers: {}, + options?: RequestOptions, + ) => AsyncResult, {}>; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export type Wrapper = + | { + Value: T; + } + | "Empty"; + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Wrapper, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Wrapper, + {}, + reflectapi_demo.tests.serde.Wrapper, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-3.snap new file mode 100644 index 00000000..6f55afde --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-3.snap @@ -0,0 +1,69 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Wrapper > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Wrapper, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Wrapper, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub enum Wrapper { + Value(T), + Empty, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-4.snap new file mode 100644 index 00000000..9f7a1c85 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-4.snap @@ -0,0 +1,82 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "title": "Value", + "required": [ + "Value" + ], + "properties": { + "Value": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + { + "const": "Empty" + } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "title": "Value", + "required": [ + "Value" + ], + "properties": { + "Value": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + { + "const": "Empty" + } + ] + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap new file mode 100644 index 00000000..798fb7d7 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap @@ -0,0 +1,242 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Wrapper > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +# Type variables for generic types + + +T = TypeVar("T") + + +T = TypeVar("T") + + +class ReflectapiDemoTestsSerdeWrapperValueVariant(BaseModel, Generic[T]): + """Value variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: T + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeWrapperVariants = Union[ + ReflectapiDemoTestsSerdeWrapperValueVariant[T], Literal["Empty"] +] + + +class ReflectapiDemoTestsSerdeWrapper( + RootModel[ReflectapiDemoTestsSerdeWrapperVariants], Generic[T] +): + """Externally tagged enum""" + + @classmethod + def __class_getitem__(cls, params): + return cls + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance(data, ReflectapiDemoTestsSerdeWrapperValueVariant): + return data + + # Handle JSON data (for deserialization) + if isinstance(data, str) and data == "Empty": + return data + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Value": + return ReflectapiDemoTestsSerdeWrapperValueVariant(field_0=value) + + raise ValueError(f"Unknown variant for ReflectapiDemoTestsSerdeWrapper: {data}") + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeWrapperValueVariant): + return {"Value": self.root.field_0} + if self.root == "Empty": + return "Empty" + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeWrapper variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + WrapperValueVariant = ReflectapiDemoTestsSerdeWrapperValueVariant + Wrapper = ReflectapiDemoTestsSerdeWrapper + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Wrapper[str]] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Wrapper[str]]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Wrapper[str]]: Response containing reflectapi_demo.tests.serde.Wrapper[str] data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Wrapper[str], + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Wrapper[str]] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Wrapper[str]]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Wrapper[str]]: Response containing reflectapi_demo.tests.serde.Wrapper[str] data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Wrapper[str], + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Wrapper.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + + +# Factory classes (generated after model rebuild to avoid forward references) +class reflectapi_demo_tests_serde_WrapperFactory: + """Factory class for creating reflectapi_demo.tests.serde.Wrapper variants with ergonomic syntax. + + reflectapi_demo.tests.serde.Wrapper variants + """ + + @staticmethod + def value(field_0: T) -> reflectapi_demo.tests.serde.Wrapper[T]: + """Creates the 'Value' variant of the reflectapi_demo.tests.serde.Wrapper enum.""" + return reflectapi_demo.tests.serde.Wrapper( + reflectapi_demo.tests.serde.WrapperValueVariant[T](field_0=field_0) + ) + + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_wrapper_response( + value: reflectapi_demo.tests.serde.Wrapper, +) -> ApiResponse[reflectapi_demo.tests.serde.Wrapper]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Wrapper.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum.snap new file mode 100644 index 00000000..354efb91 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum.snap @@ -0,0 +1,121 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Wrapper", + "arguments": [ + { + "name": "std::string::String" + } + ] + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Wrapper", + "arguments": [ + { + "name": "std::string::String" + } + ] + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Wrapper", + "parameters": [ + { + "name": "T" + } + ], + "variants": [ + { + "name": "Value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + }, + "required": true + } + ] + } + }, + { + "name": "Empty", + "fields": "none" + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "enum", + "name": "reflectapi_demo::tests::serde::Wrapper", + "parameters": [ + { + "name": "T" + } + ], + "variants": [ + { + "name": "Value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + }, + "required": true + } + ] + } + }, + { + "name": "Empty", + "fields": "none" + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-2.snap new file mode 100644 index 00000000..2a57ffb1 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-2.snap @@ -0,0 +1,63 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Underscored > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Underscored, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface Underscored { + _single: number /* u32 */; + __double: string; + ___triple: boolean; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Underscored, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Underscored, + {}, + reflectapi_demo.tests.serde.Underscored, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-3.snap new file mode 100644 index 00000000..08cbfd79 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-3.snap @@ -0,0 +1,70 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Underscored > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Underscored, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Underscored, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Underscored { + pub _single: u32, + pub __double: std::string::String, + pub ___triple: bool, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-4.snap new file mode 100644 index 00000000..6b15ae2a --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-4.snap @@ -0,0 +1,78 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Underscored" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Underscored" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "bool": { + "description": "Boolean value", + "type": "boolean" + }, + "reflectapi_demo.tests.serde.Underscored": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Underscored", + "required": [ + "___triple", + "__double", + "_single" + ], + "properties": { + "___triple": { + "$ref": "#/components/schemas/bool" + }, + "__double": { + "$ref": "#/components/schemas/std.string.String" + }, + "_single": { + "$ref": "#/components/schemas/u32" + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap new file mode 100644 index 00000000..7be32acf --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap @@ -0,0 +1,164 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Underscored > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeUnderscored(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + single: int = Field(serialization_alias="_single", validation_alias="_single") + double: str = Field(serialization_alias="__double", validation_alias="__double") + triple: bool = Field(serialization_alias="___triple", validation_alias="___triple") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Underscored = ReflectapiDemoTestsSerdeUnderscored + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Underscored] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Underscored]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Underscored]: Response containing reflectapi_demo.tests.serde.Underscored data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Underscored, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Underscored] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Underscored]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Underscored]: Response containing reflectapi_demo.tests.serde.Underscored data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Underscored, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Underscored.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_underscored_response( + value: reflectapi_demo.tests.serde.Underscored, +) -> ApiResponse[reflectapi_demo.tests.serde.Underscored]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Underscored.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields.snap new file mode 100644 index 00000000..707e8b5a --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields.snap @@ -0,0 +1,131 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Underscored" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Underscored" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "primitive", + "name": "bool", + "description": "Boolean value" + }, + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Underscored", + "fields": { + "named": [ + { + "name": "_single", + "type": { + "name": "u32" + }, + "required": true + }, + { + "name": "__double", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "___triple", + "type": { + "name": "bool" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "primitive", + "name": "bool", + "description": "Boolean value" + }, + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Underscored", + "fields": { + "named": [ + { + "name": "_single", + "type": { + "name": "u32" + }, + "required": true + }, + { + "name": "__double", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "___triple", + "type": { + "name": "bool" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-2.snap new file mode 100644 index 00000000..05d7935f --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-2.snap @@ -0,0 +1,70 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < deep::nested::inner::DeepType > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.deep.nested.inner.DeepType, + headers: {}, + options?: RequestOptions, + ) => AsyncResult< + reflectapi_demo.tests.serde.deep.nested.inner.DeepType, + {} + >; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export namespace deep { + export namespace nested { + export namespace inner { + export interface DeepType { + data: string; + } + } + } + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.deep.nested.inner.DeepType, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.deep.nested.inner.DeepType, + {}, + reflectapi_demo.tests.serde.deep.nested.inner.DeepType, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-3.snap new file mode 100644 index 00000000..49e58dd4 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-3.snap @@ -0,0 +1,74 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < deep::nested::inner::DeepType > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::deep::nested::inner::DeepType, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::deep::nested::inner::DeepType, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + pub mod deep { + pub mod nested { + pub mod inner { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct DeepType { + pub data: std::string::String, + } + } + } + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-4.snap new file mode 100644 index 00000000..1514a865 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-4.snap @@ -0,0 +1,62 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.deep.nested.inner.DeepType" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.deep.nested.inner.DeepType" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.deep.nested.inner.DeepType": { + "type": "object", + "title": "reflectapi_demo.tests.serde.deep.nested.inner.DeepType", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/std.string.String" + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap new file mode 100644 index 00000000..09ddd255 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap @@ -0,0 +1,171 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < deep::nested::inner::DeepType > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeDeepNestedInnerDeepType(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + data: str + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class deep: + """Namespace for deep types.""" + + class nested: + """Namespace for nested types.""" + + class inner: + """Namespace for inner types.""" + + DeepType = ReflectapiDemoTestsSerdeDeepNestedInnerDeepType + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.deep.nested.inner.DeepType] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.deep.nested.inner.DeepType]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.deep.nested.inner.DeepType]: Response containing reflectapi_demo.tests.serde.deep.nested.inner.DeepType data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.deep.nested.inner.DeepType, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.deep.nested.inner.DeepType] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.deep.nested.inner.DeepType]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.deep.nested.inner.DeepType]: Response containing reflectapi_demo.tests.serde.deep.nested.inner.DeepType data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.deep.nested.inner.DeepType, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.deep.nested.inner.DeepType.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_deep_nested_inner_deeptype_response( + value: reflectapi_demo.tests.serde.deep.nested.inner.DeepType, +) -> ApiResponse[reflectapi_demo.tests.serde.deep.nested.inner.DeepType]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.deep.nested.inner.DeepType.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules.snap new file mode 100644 index 00000000..3756b6fe --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules.snap @@ -0,0 +1,83 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::deep::nested::inner::DeepType" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::deep::nested::inner::DeepType" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::deep::nested::inner::DeepType", + "fields": { + "named": [ + { + "name": "data", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::deep::nested::inner::DeepType", + "fields": { + "named": [ + { + "name": "data", + "type": { + "name": "std::string::String" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-2.snap new file mode 100644 index 00000000..1168e2bc --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-2.snap @@ -0,0 +1,61 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < SimpleTopLevel > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.SimpleTopLevel, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface SimpleTopLevel { + value: number /* u32 */; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.SimpleTopLevel, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.SimpleTopLevel, + {}, + reflectapi_demo.tests.serde.SimpleTopLevel, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-3.snap new file mode 100644 index 00000000..700c3183 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-3.snap @@ -0,0 +1,68 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < SimpleTopLevel > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::SimpleTopLevel, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::SimpleTopLevel, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct SimpleTopLevel { + pub value: u32, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-4.snap new file mode 100644 index 00000000..bd50055e --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-4.snap @@ -0,0 +1,62 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.SimpleTopLevel" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.SimpleTopLevel" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.SimpleTopLevel": { + "type": "object", + "title": "reflectapi_demo.tests.serde.SimpleTopLevel", + "required": [ + "value" + ], + "properties": { + "value": { + "$ref": "#/components/schemas/u32" + } + } + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap new file mode 100644 index 00000000..287e3157 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap @@ -0,0 +1,162 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < SimpleTopLevel > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeSimpleTopLevel(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + value: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + SimpleTopLevel = ReflectapiDemoTestsSerdeSimpleTopLevel + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.SimpleTopLevel] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.SimpleTopLevel]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.SimpleTopLevel]: Response containing reflectapi_demo.tests.serde.SimpleTopLevel data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.SimpleTopLevel, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.SimpleTopLevel] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.SimpleTopLevel]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.SimpleTopLevel]: Response containing reflectapi_demo.tests.serde.SimpleTopLevel data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.SimpleTopLevel, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.SimpleTopLevel.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_simpletoplevel_response( + value: reflectapi_demo.tests.serde.SimpleTopLevel, +) -> ApiResponse[reflectapi_demo.tests.serde.SimpleTopLevel]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.SimpleTopLevel.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type.snap new file mode 100644 index 00000000..d99668ca --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type.snap @@ -0,0 +1,83 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::SimpleTopLevel" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::SimpleTopLevel" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::SimpleTopLevel", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::SimpleTopLevel", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-2.snap new file mode 100644 index 00000000..c55dcb24 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-2.snap @@ -0,0 +1,62 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < TypeWithNumbers > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.TypeWithNumbers, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface TypeWithNumbers { + "123start": string; + "kebab-field": number /* u32 */; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.TypeWithNumbers, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.TypeWithNumbers, + {}, + reflectapi_demo.tests.serde.TypeWithNumbers, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-3.snap new file mode 100644 index 00000000..525664c2 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-3.snap @@ -0,0 +1,71 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < TypeWithNumbers > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::TypeWithNumbers, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::TypeWithNumbers, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct TypeWithNumbers { + #[serde(rename = "123start")] + pub field_123: std::string::String, + #[serde(rename = "kebab-field")] + pub kebab_field: u32, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-4.snap new file mode 100644 index 00000000..3aecf9e9 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-4.snap @@ -0,0 +1,70 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.TypeWithNumbers" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.TypeWithNumbers" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.TypeWithNumbers": { + "type": "object", + "title": "reflectapi_demo.tests.serde.TypeWithNumbers", + "required": [ + "123start", + "kebab-field" + ], + "properties": { + "123start": { + "$ref": "#/components/schemas/std.string.String" + }, + "kebab-field": { + "$ref": "#/components/schemas/u32" + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap new file mode 100644 index 00000000..4957ac54 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap @@ -0,0 +1,165 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < TypeWithNumbers > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeTypeWithNumbers(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_123: str = Field(serialization_alias="123start", validation_alias="123start") + kebab_field: int = Field( + serialization_alias="kebab-field", validation_alias="kebab-field" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TypeWithNumbers = ReflectapiDemoTestsSerdeTypeWithNumbers + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.TypeWithNumbers] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TypeWithNumbers]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.TypeWithNumbers]: Response containing reflectapi_demo.tests.serde.TypeWithNumbers data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.TypeWithNumbers, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.TypeWithNumbers] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TypeWithNumbers]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.TypeWithNumbers]: Response containing reflectapi_demo.tests.serde.TypeWithNumbers data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.TypeWithNumbers, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.TypeWithNumbers.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_typewithnumbers_response( + value: reflectapi_demo.tests.serde.TypeWithNumbers, +) -> ApiResponse[reflectapi_demo.tests.serde.TypeWithNumbers]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.TypeWithNumbers.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start.snap new file mode 100644 index 00000000..77082242 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start.snap @@ -0,0 +1,111 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::TypeWithNumbers" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::TypeWithNumbers" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::TypeWithNumbers", + "fields": { + "named": [ + { + "name": "field_123", + "serde_name": "123start", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "kebab_field", + "serde_name": "kebab-field", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::TypeWithNumbers", + "fields": { + "named": [ + { + "name": "field_123", + "serde_name": "123start", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "kebab_field", + "serde_name": "kebab-field", + "type": { + "name": "u32" + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-2.snap new file mode 100644 index 00000000..3a2c435c --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-2.snap @@ -0,0 +1,62 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Complex > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Complex, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface Complex { + matrix: Array>; + lookup: Record>; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Complex, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Complex, + {}, + reflectapi_demo.tests.serde.Complex, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-3.snap new file mode 100644 index 00000000..89f050f5 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-3.snap @@ -0,0 +1,72 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Complex > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Complex, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Complex, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Complex { + pub matrix: std::vec::Vec>, + pub lookup: std::collections::HashMap< + std::string::String, + std::vec::Vec>, + >, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-4.snap new file mode 100644 index 00000000..93902e14 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-4.snap @@ -0,0 +1,94 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Complex" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Complex" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "i32": { + "description": "32-bit signed integer", + "type": "integer" + }, + "reflectapi_demo.tests.serde.Complex": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Complex", + "required": [ + "lookup", + "matrix" + ], + "properties": { + "lookup": { + "description": "Key-value map type", + "type": "object", + "additionalProperties": { + "description": "Expandable array type", + "type": "array", + "items": { + "oneOf": [ + { + "description": "Null", + "type": "null" + }, + { + "$ref": "#/components/schemas/i32" + } + ] + } + } + }, + "matrix": { + "description": "Expandable array type", + "type": "array", + "items": { + "description": "Expandable array type", + "type": "array", + "items": { + "$ref": "#/components/schemas/u32" + } + } + } + } + }, + "u32": { + "description": "32-bit unsigned integer", + "type": "integer" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap new file mode 100644 index 00000000..3fe5347e --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap @@ -0,0 +1,164 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Complex > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeComplex(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + matrix: list[list[int]] + lookup: dict[str, list[int | None]] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Complex = ReflectapiDemoTestsSerdeComplex + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Complex] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Complex]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Complex]: Response containing reflectapi_demo.tests.serde.Complex data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Complex, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Complex] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Complex]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Complex]: Response containing reflectapi_demo.tests.serde.Complex data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Complex, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Complex.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_complex_response( + value: reflectapi_demo.tests.serde.Complex, +) -> ApiResponse[reflectapi_demo.tests.serde.Complex]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Complex.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers.snap new file mode 100644 index 00000000..11b31863 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers.snap @@ -0,0 +1,283 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Complex" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Complex" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "primitive", + "name": "i32", + "description": "32-bit signed integer" + }, + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Complex", + "fields": { + "named": [ + { + "name": "matrix", + "type": { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "u32" + } + ] + } + ] + }, + "required": true + }, + { + "name": "lookup", + "type": { + "name": "std::collections::HashMap", + "arguments": [ + { + "name": "std::string::String" + }, + { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "std::option::Option", + "arguments": [ + { + "name": "i32" + } + ] + } + ] + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::collections::HashMap", + "description": "Key-value map type", + "parameters": [ + { + "name": "K" + }, + { + "name": "V" + } + ] + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "std::vec::Vec", + "description": "Expandable array type", + "parameters": [ + { + "name": "T" + } + ] + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "primitive", + "name": "i32", + "description": "32-bit signed integer" + }, + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Complex", + "fields": { + "named": [ + { + "name": "matrix", + "type": { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "u32" + } + ] + } + ] + }, + "required": true + }, + { + "name": "lookup", + "type": { + "name": "std::collections::HashMap", + "arguments": [ + { + "name": "std::string::String" + }, + { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "std::option::Option", + "arguments": [ + { + "name": "i32" + } + ] + } + ] + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::collections::HashMap", + "description": "Key-value map type", + "parameters": [ + { + "name": "K" + }, + { + "name": "V" + } + ] + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "std::vec::Vec", + "description": "Expandable array type", + "parameters": [ + { + "name": "T" + } + ] + }, + { + "kind": "primitive", + "name": "u32", + "description": "32-bit unsigned integer" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-2.snap new file mode 100644 index 00000000..9368a30b --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-2.snap @@ -0,0 +1,61 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Nested > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Nested, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface Nested { + value: (string | null) | null; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Nested, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Nested, + {}, + reflectapi_demo.tests.serde.Nested, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-3.snap new file mode 100644 index 00000000..d0b3c31c --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-3.snap @@ -0,0 +1,68 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Nested > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Nested, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Nested, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Nested { + pub value: std::option::Option>, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-4.snap new file mode 100644 index 00000000..77c11857 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-4.snap @@ -0,0 +1,78 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Nested" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Nested" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Nested": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Nested", + "required": [ + "value" + ], + "properties": { + "value": { + "oneOf": [ + { + "description": "Null", + "type": "null" + }, + { + "oneOf": [ + { + "description": "Null", + "type": "null" + }, + { + "$ref": "#/components/schemas/std.string.String" + } + ] + } + ] + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap new file mode 100644 index 00000000..9b13740c --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap @@ -0,0 +1,163 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Nested > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from enum import Enum +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + value: str | None | None = None + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Nested = ReflectapiDemoTestsSerdeNested + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Nested] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Nested]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Nested]: Response containing reflectapi_demo.tests.serde.Nested data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Nested, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Nested] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Nested]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Nested]: Response containing reflectapi_demo.tests.serde.Nested data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Nested, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Nested.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_nested_response( + value: reflectapi_demo.tests.serde.Nested, +) -> ApiResponse[reflectapi_demo.tests.serde.Nested]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Nested.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option.snap new file mode 100644 index 00000000..a523a9fb --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option.snap @@ -0,0 +1,167 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Nested" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Nested" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Nested", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "std::option::Option", + "arguments": [ + { + "name": "std::option::Option", + "arguments": [ + { + "name": "std::string::String" + } + ] + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Nested", + "fields": { + "named": [ + { + "name": "value", + "type": { + "name": "std::option::Option", + "arguments": [ + { + "name": "std::option::Option", + "arguments": [ + { + "name": "std::string::String" + } + ] + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "enum", + "name": "std::option::Option", + "description": "Optional nullable type", + "parameters": [ + { + "name": "T" + } + ], + "representation": "none", + "variants": [ + { + "name": "None", + "description": "The value is not provided, i.e. null", + "fields": "none" + }, + { + "name": "Some", + "description": "The value is provided and set to some value", + "fields": { + "unnamed": [ + { + "name": "0", + "type": { + "name": "T" + } + } + ] + } + } + ] + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + } + ] + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-2.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-2.snap new file mode 100644 index 00000000..c422df9c --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-2.snap @@ -0,0 +1,62 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_typescript_code :: < Category > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +export function client(base: string | Client): __definition.Interface { + return __implementation.__client(base); +} + +export namespace __definition { + export interface Interface { + inout_test: ( + input: reflectapi_demo.tests.serde.Category, + headers: {}, + options?: RequestOptions, + ) => AsyncResult; + } +} +export namespace reflectapi { + /** + * Struct object with no fields + */ + export interface Empty {} + + /** + * Error object which is expected to be never returned + */ + export interface Infallible {} +} + +export namespace reflectapi_demo { + export namespace tests { + export namespace serde { + export interface Category { + name: string; + subcategories: Array; + } + } + } +} + +namespace __implementation { + + function inout_test(client: Client) { + return ( + input: reflectapi_demo.tests.serde.Category, + headers: {}, + options?: RequestOptions, + ) => + __request< + reflectapi_demo.tests.serde.Category, + {}, + reflectapi_demo.tests.serde.Category, + {} + >(client, "/inout_test", input, headers, options); + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-3.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-3.snap new file mode 100644 index 00000000..f280e0cf --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-3.snap @@ -0,0 +1,70 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_rust_code :: < Category > ()" +--- +// DO NOT MODIFY THIS FILE MANUALLY +// This file was generated by reflectapi-cli +// +// Schema name: +// + +#![allow(non_camel_case_types)] +#![allow(dead_code)] + +pub use interface::Interface; +pub use reflectapi::rt::*; + +pub mod interface { + + #[derive(Debug)] + pub struct Interface { + client: C, + base_url: reflectapi::rt::Url, + } + + impl Interface { + pub fn try_new( + client: C, + base_url: reflectapi::rt::Url, + ) -> std::result::Result { + if base_url.cannot_be_a_base() { + return Err(reflectapi::rt::UrlParseError::RelativeUrlWithCannotBeABaseBase); + } + + Ok(Self { client, base_url }) + } + pub async fn inout_test( + &self, + input: super::types::reflectapi_demo::tests::serde::Category, + headers: reflectapi::Empty, + ) -> Result< + super::types::reflectapi_demo::tests::serde::Category, + reflectapi::rt::Error, + > { + reflectapi::rt::__request_impl( + &self.client, + self.base_url + .join("/inout_test") + .expect("checked base_url already and path is valid"), + input, + headers, + ) + .await + } + } +} +pub mod types { + pub mod reflectapi_demo { + pub mod tests { + pub mod serde { + + #[derive(Debug, serde::Deserialize, serde::Serialize)] + pub struct Category { + pub name: std::string::String, + pub subcategories: + std::vec::Vec, + } + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-4.snap new file mode 100644 index 00000000..0764fdfa --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-4.snap @@ -0,0 +1,70 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "reflectapi :: codegen :: openapi :: Spec :: from(& schema)" +--- +{ + "openapi": "3.1.0", + "info": { + "title": "", + "description": "", + "version": "1.0.0" + }, + "paths": { + "/inout_test": { + "description": "", + "post": { + "operationId": "inout_test", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Category" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "200 OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Category" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "reflectapi_demo.tests.serde.Category": { + "type": "object", + "title": "reflectapi_demo.tests.serde.Category", + "required": [ + "name", + "subcategories" + ], + "properties": { + "name": { + "$ref": "#/components/schemas/std.string.String" + }, + "subcategories": { + "description": "Expandable array type", + "type": "array", + "items": { + "$ref": "#/components/schemas/reflectapi_demo.tests.serde.Category" + } + } + } + }, + "std.string.String": { + "description": "UTF-8 encoded string", + "type": "string" + } + } + } +} diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap new file mode 100644 index 00000000..945cd476 --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap @@ -0,0 +1,163 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: "super :: into_python_code :: < Category > ()" +--- +""" +Generated Python client for api_client. + +DO NOT MODIFY THIS FILE MANUALLY. +This file is automatically generated by ReflectAPI. +""" + +from __future__ import annotations + + +# Standard library imports +from typing import Annotated, Any, Generic, Optional, TypeVar, Union + +# Third-party imports +from pydantic import BaseModel, ConfigDict + +# Runtime imports +from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse +from reflectapi_runtime import ReflectapiEmpty +from reflectapi_runtime import ReflectapiInfallible +from reflectapi_runtime.testing import MockClient, create_api_response + + +class ReflectapiDemoTestsSerdeCategory(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + subcategories: list[reflectapi_demo.tests.serde.Category] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Category = ReflectapiDemoTestsSerdeCategory + + +class AsyncInoutClient: + """Async client for inout operations.""" + + def __init__(self, client: AsyncClientBase) -> None: + self._client = client + + async def test( + self, + data: Optional[reflectapi_demo.tests.serde.Category] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Category]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Category]: Response containing reflectapi_demo.tests.serde.Category data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return await self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Category, + ) + + +class AsyncClient(AsyncClientBase): + """Async client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = AsyncInoutClient(self) + + +class InoutClient: + """Synchronous client for inout operations.""" + + def __init__(self, client: ClientBase) -> None: + self._client = client + + def test( + self, + data: Optional[reflectapi_demo.tests.serde.Category] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.Category]: + """ + + Args: + data: Request data for the test operation. + + Returns: + ApiResponse[reflectapi_demo.tests.serde.Category]: Response containing reflectapi_demo.tests.serde.Category data + """ + path = "/inout_test" + + params: dict[str, Any] = {} + return self._client._make_request( + "POST", + path, + params=params if params else None, + json_model=data, + response_model=reflectapi_demo.tests.serde.Category, + ) + + +class Client(ClientBase): + """Synchronous client for the API.""" + + def __init__( + self, + base_url: str, + **kwargs: Any, + ) -> None: + super().__init__(base_url, **kwargs) + + self.inout = InoutClient(self) + + +# External type definitions +StdNumNonZeroU32 = Annotated[int, "Rust NonZero u32 type"] +StdNumNonZeroU64 = Annotated[int, "Rust NonZero u64 type"] +StdNumNonZeroI32 = Annotated[int, "Rust NonZero i32 type"] +StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] + +# Rebuild models to resolve forward references +try: + reflectapi_demo.tests.serde.Category.model_rebuild() +except AttributeError: + # Some types may not have model_rebuild method + pass + +# Factory classes (generated after model rebuild to avoid forward references) + +# Testing utilities + + +def create_reflectapi_demo_tests_serde_category_response( + value: reflectapi_demo.tests.serde.Category, +) -> ApiResponse[reflectapi_demo.tests.serde.Category]: + """Create a mock ApiResponse for reflectapi_demo.tests.serde.Category.""" + return create_api_response(value) + + +def create_mock_client() -> MockClient: + """Create a mock client for testing.""" + return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct.snap new file mode 100644 index 00000000..781a1e0b --- /dev/null +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct.snap @@ -0,0 +1,127 @@ +--- +source: reflectapi-demo/src/tests/serde.rs +expression: schema +--- +{ + "name": "", + "functions": [ + { + "name": "inout_test", + "path": "", + "input_type": { + "name": "reflectapi_demo::tests::serde::Category" + }, + "output_type": { + "name": "reflectapi_demo::tests::serde::Category" + }, + "serialization": [ + "json", + "msgpack" + ] + } + ], + "input_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Empty", + "description": "Struct object with no fields", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Category", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "subcategories", + "type": { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "reflectapi_demo::tests::serde::Category" + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "std::vec::Vec", + "description": "Expandable array type", + "parameters": [ + { + "name": "T" + } + ] + } + ] + }, + "output_types": { + "types": [ + { + "kind": "struct", + "name": "reflectapi::Infallible", + "description": "Error object which is expected to be never returned", + "fields": "none" + }, + { + "kind": "struct", + "name": "reflectapi_demo::tests::serde::Category", + "fields": { + "named": [ + { + "name": "name", + "type": { + "name": "std::string::String" + }, + "required": true + }, + { + "name": "subcategories", + "type": { + "name": "std::vec::Vec", + "arguments": [ + { + "name": "reflectapi_demo::tests::serde::Category" + } + ] + }, + "required": true + } + ] + } + }, + { + "kind": "primitive", + "name": "std::string::String", + "description": "UTF-8 encoded string" + }, + { + "kind": "primitive", + "name": "std::vec::Vec", + "description": "Expandable array type", + "parameters": [ + { + "name": "T" + } + ] + } + ] + } +} From 3acd2bdbefcda70a081246bd90571c18cef80733 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 22:13:34 +1300 Subject: [PATCH 31/47] fix: sanitize docstrings and factory method names for Python keywords Real-world validation against Partly's core-server (284 endpoints, 78K-line schema) revealed two codegen bugs: 1. Descriptions containing backslashes (e.g., "object\'s") break Python docstrings because \ acts as a line continuation character. Added sanitize_for_docstring() that escapes \ and """ in all 13 template render methods that emit docstrings. 2. Factory method names derived from enum variant names (e.g., "global", "from") can be Python keywords, producing SyntaxError. Applied safe_python_identifier() to all factory method name and parameter name generation sites. The generated 57K-line Python client for core-server now parses as valid Python (verified with py_compile). --- ...__enum_with_rename_to_invalid_chars-5.snap | 93 +++++++++++++------ ..._newtype_variants_adjacently_tagged-5.snap | 4 +- ..._newtype_variants_externally_tagged-5.snap | 4 +- reflectapi/src/codegen/python.rs | 80 +++++++++++----- 4 files changed, 126 insertions(+), 55 deletions(-) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index 04a06eb3..c580b650 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithRenameToInvalidChars > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -26,46 +33,64 @@ from reflectapi_runtime import ReflectapiInfallible from reflectapi_runtime.testing import MockClient, create_api_response -class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant(BaseModel): +class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant( + BaseModel +): """Variant1 variant""" model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: int = Field(serialization_alias='field-name&&', validation_alias='field-name&&') + f: int = Field(serialization_alias="field-name&&", validation_alias="field-name&&") # Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant +ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants = ( + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant +) -class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars(RootModel[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants]): + +class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars( + RootModel[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants] +): """Externally tagged enum""" - @model_validator(mode='before') + @model_validator(mode="before") @classmethod def _validate_externally_tagged(cls, data): # Handle direct variant instances (for programmatic creation) - if isinstance(data, ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant): + if isinstance( + data, + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant, + ): return data # Handle JSON data (for deserialization) - if isinstance(data, dict): if len(data) != 1: raise ValueError("Externally tagged enum must have exactly one key") key, value = next(iter(data.items())) if key == "Variant1": - return ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant(**value) + return ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant( + **value + ) - raise ValueError(f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars: {data}") + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars: {data}" + ) @model_serializer def _serialize_externally_tagged(self): - if isinstance(self.root, ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant): + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant, + ): return {"Variant1": self.root.model_dump()} - raise ValueError(f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variant: {type(self.root)}") + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variant: {type(self.root)}" + ) # Namespace classes for dotted access to types @@ -77,8 +102,13 @@ class reflectapi_demo: class serde: """Namespace for serde types.""" - TestEnumWithRenameToInvalidCharsVariant1Variant = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant - TestEnumWithRenameToInvalidChars = ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars + + TestEnumWithRenameToInvalidCharsVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant + ) + TestEnumWithRenameToInvalidChars = ( + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars + ) class AsyncInoutClient: @@ -89,7 +119,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ @@ -121,7 +153,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -133,7 +164,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ @@ -165,7 +198,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -182,23 +214,32 @@ except AttributeError: # Some types may not have model_rebuild method pass + # Factory classes (generated after model rebuild to avoid forward references) class reflectapi_demo_tests_serde_TestEnumWithRenameToInvalidCharsFactory: - '''Factory class for creating reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars variants with ergonomic syntax. + """Factory class for creating reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars variants with ergonomic syntax. reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars variants - ''' + """ @staticmethod - def variant1(field_name&&: int) -> reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars: - '''Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars enum.''' - return reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars(reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidCharsVariant1Variant(f=field_name&&)) + def variant1( + field_name__: int, + ) -> reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars: + """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars enum.""" + return reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars( + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidCharsVariant1Variant( + f=field_name__ + ) + ) # Testing utilities -def create_reflectapi_demo_tests_serde_testenumwithrenametoinvalidchars_response(value: reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: +def create_reflectapi_demo_tests_serde_testenumwithrenametoinvalidchars_response( + value: reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars, +) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars.""" return create_api_response(value) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index b12961ac..799e8856 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -274,7 +274,7 @@ class reflectapi_demo_tests_serde_TestNewtypeVariantsAdjacentlyTaggedFactory: """ @staticmethod - def int( + def int_( field_0: int, ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: """Creates the 'int' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" @@ -296,7 +296,7 @@ class reflectapi_demo_tests_serde_TestNewtypeVariantsAdjacentlyTaggedFactory: ) @staticmethod - def bool( + def bool_( field_0: bool, ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: """Creates the 'bool' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index 7271b220..8f0f0454 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -278,7 +278,7 @@ class reflectapi_demo_tests_serde_TestNewtypeVariantsExternallyTaggedFactory: """ @staticmethod - def int( + def int_( field_0: int, ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: """Creates the 'int' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" @@ -300,7 +300,7 @@ class reflectapi_demo_tests_serde_TestNewtypeVariantsExternallyTaggedFactory: ) @staticmethod - def bool( + def bool_( field_0: bool, ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: """Creates the 'bool' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index ace600f4..be31b5bd 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -3,6 +3,13 @@ use std::collections::{BTreeMap, BTreeSet, HashSet, VecDeque}; use crate::{Schema, TypeReference}; use reflectapi_schema::{Function, Type}; +/// Sanitize text for inclusion in a Python triple-quoted docstring. +/// Escapes backslashes (which act as line continuation) and triple-quote +/// sequences (which would close the docstring prematurely). +fn sanitize_for_docstring(text: &str) -> String { + text.replace('\\', "\\\\").replace("\"\"\"", "\\\"\\\"\\\"") +} + /// Information needed to generate a factory class later #[derive(Clone, Debug)] struct FactoryInfo { @@ -2674,7 +2681,8 @@ fn generate_factory_class_with_representation( reflectapi_schema::Representation::Adjacent { tag, .. } => { // For adjacently tagged enums, unit variants need to be created as static methods // returning the RootModel with dictionary format that the validator expects - let method_name = to_snake_case(variant.name()); + let method_name = + safe_python_identifier(&to_snake_case(variant.name())); static_methods.push(format!( r#" @staticmethod def {}() -> {}: @@ -2691,7 +2699,8 @@ fn generate_factory_class_with_representation( } reflectapi_schema::Representation::External => { // For externally tagged enums, unit variants are also static methods - let method_name = to_snake_case(variant.name()); + let method_name = + safe_python_identifier(&to_snake_case(variant.name())); static_methods.push(format!( r#" @staticmethod def {}() -> {}: @@ -2719,7 +2728,7 @@ fn generate_factory_class_with_representation( } Fields::Unnamed(_) | Fields::Named(_) => { // Complex variant - create static method - let method_name = to_snake_case(variant.name()); + let method_name = safe_python_identifier(&to_snake_case(variant.name())); let method_params = generate_factory_method_params( variant, schema, @@ -2836,7 +2845,7 @@ fn generate_internally_tagged_factory_class( } Fields::Unnamed(_) | Fields::Named(_) => { // Complex variant - create static method - let method_name = to_snake_case(variant_name); + let method_name = safe_python_identifier(&to_snake_case(variant_name)); let method_params = generate_factory_method_params( variant, schema, @@ -2910,7 +2919,7 @@ fn generate_externally_tagged_factory_class( } Fields::Unnamed(_) | Fields::Named(_) => { // Complex variant - create static method that returns wrapped RootModel - let method_name = to_snake_case(variant_name); + let method_name = safe_python_identifier(&to_snake_case(variant_name)); let variant_class_name = format!("{}{}Variant", enum_name, to_pascal_case(variant_name)); let method_params = generate_factory_method_params( @@ -2993,7 +3002,7 @@ fn generate_factory_method_params( let mut optional_params: Vec = Vec::new(); for field in named_fields { - let param_name = to_snake_case(field.serde_name()); + let param_name = safe_python_identifier(&to_snake_case(field.serde_name())); let type_annotation = type_ref_to_python_type( &field.type_ref, schema, @@ -3039,7 +3048,7 @@ fn generate_factory_method_args(variant: &reflectapi_schema::Variant) -> anyhow: .iter() .map(|field| { let serde_name = field.serde_name(); - let param_name = to_snake_case(serde_name); + let param_name = safe_python_identifier(&to_snake_case(serde_name)); let field_name = sanitize_field_name(field.name()); format!("{field_name}={param_name}") }) @@ -5211,6 +5220,7 @@ pub mod templates { writeln!(s, "class {}(BaseModel):", self.name).unwrap(); } if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { @@ -5272,6 +5282,7 @@ pub mod templates { let mut s = String::new(); writeln!(s, "class {}(str, Enum):", self.name).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { @@ -5312,6 +5323,7 @@ pub mod templates { let base = if self.is_int_enum { "IntEnum" } else { "Enum" }; writeln!(s, "class {}({}):", self.name, base).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); } @@ -5319,6 +5331,7 @@ pub mod templates { writeln!(s).unwrap(); writeln!(s, " {} = {}", variant.name, variant.value).unwrap(); if let Some(desc) = &variant.description { + let desc = super::sanitize_for_docstring(desc); writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } writeln!(s).unwrap(); @@ -5344,10 +5357,11 @@ pub mod templates { let params = self.generic_params.join(", "); writeln!(s).unwrap(); writeln!(s, "class {}(Generic[{}]):", self.name, params).unwrap(); - let desc = self - .description - .as_deref() - .unwrap_or("Generated discriminated union type."); + let desc = super::sanitize_for_docstring( + self.description + .as_deref() + .unwrap_or("Generated discriminated union type."), + ); writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); writeln!(s, " @classmethod").unwrap(); @@ -5411,6 +5425,7 @@ pub mod templates { writeln!(s).unwrap(); if !self.is_generic { if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } @@ -5437,6 +5452,7 @@ pub mod templates { .collect(); writeln!(s, "{} = Union[{}]", self.name, type_annotations.join(", ")).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } @@ -5605,7 +5621,7 @@ pub mod templates { writeln!(s, " ) -> ApiResponse[{}]:", function.output_type).unwrap(); // Docstring - let desc = function.description.as_deref().unwrap_or(""); + let desc = super::sanitize_for_docstring(function.description.as_deref().unwrap_or("")); write!(s, " \"\"\"{desc}").unwrap(); if function.has_body || !function.path_params.is_empty() { writeln!(s).unwrap(); @@ -5620,7 +5636,9 @@ pub mod templates { .unwrap(); } for param in &function.path_params { - let param_desc = param.description.as_deref().unwrap_or("Path parameter"); + let param_desc = super::sanitize_for_docstring( + param.description.as_deref().unwrap_or("Path parameter"), + ); writeln!(s, " {}: {}", param.name, param_desc).unwrap(); } writeln!(s).unwrap(); @@ -5636,6 +5654,7 @@ pub mod templates { ) .unwrap(); if let Some(dep_note) = &function.deprecation_note { + let dep_note = super::sanitize_for_docstring(dep_note); writeln!(s).unwrap(); writeln!(s, " .. deprecated::").unwrap(); writeln!(s, " {dep_note}").unwrap(); @@ -5836,6 +5855,7 @@ pub mod templates { let mut s = String::new(); writeln!(s, "class {}(BaseModel):", self.name).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { @@ -5886,6 +5906,7 @@ pub mod templates { let mut s = String::new(); writeln!(s, "class {}(BaseModel):", self.name).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { @@ -5953,6 +5974,7 @@ pub mod templates { let mut s = String::new(); writeln!(s, "class {}(BaseModel):", self.name).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } else { @@ -6038,6 +6060,7 @@ pub mod templates { ) .unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } @@ -6071,6 +6094,7 @@ pub mod templates { } writeln!(s, "class {}(str, Enum):", self.enum_name).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } @@ -6122,6 +6146,7 @@ pub mod templates { writeln!(s, "@dataclass").unwrap(); writeln!(s, "class {}:", self.name).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } @@ -6166,6 +6191,7 @@ pub mod templates { writeln!(s, "@dataclass").unwrap(); writeln!(s, "class {}:", self.name).unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); if !desc.is_empty() { writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); } @@ -6247,6 +6273,7 @@ pub mod templates { ) .unwrap(); if let Some(desc) = &self.description { + let desc = super::sanitize_for_docstring(desc); writeln!(s, "\"\"\"{desc}\"\"\"").unwrap(); } s @@ -6293,10 +6320,11 @@ pub mod templates { } else { writeln!(s, "class {}(RootModel[{}Variants]):", self.name, self.name).unwrap(); } - let desc = self - .description - .as_deref() - .unwrap_or("Externally tagged enum"); + let desc = super::sanitize_for_docstring( + self.description + .as_deref() + .unwrap_or("Externally tagged enum"), + ); writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); if self.is_generic { @@ -6407,10 +6435,11 @@ pub mod templates { ) .unwrap(); writeln!(s, "class {}(Generic[{}]):", self.name, params).unwrap(); - let desc = self - .description - .as_deref() - .unwrap_or("Generic externally tagged enum using Approach B"); + let desc = super::sanitize_for_docstring( + self.description + .as_deref() + .unwrap_or("Generic externally tagged enum using Approach B"), + ); writeln!(s, " \"\"\"{desc}").unwrap(); writeln!(s).unwrap(); writeln!( @@ -6502,10 +6531,11 @@ pub mod templates { writeln!(s, "{}Variants = Union[{}]", self.name, self.union_variants).unwrap(); } writeln!(s, "class {}(RootModel[{}Variants]):", self.name, self.name).unwrap(); - let desc = self - .description - .as_deref() - .unwrap_or("Externally tagged enum"); + let desc = super::sanitize_for_docstring( + self.description + .as_deref() + .unwrap_or("Externally tagged enum"), + ); writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); writeln!(s).unwrap(); writeln!(s, " @model_validator(mode='before')").unwrap(); From 17661db1fa44ab7ca4a02b15ffecfe68184faeac Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 22:32:02 +1300 Subject: [PATCH 32/47] fix: move model_rebuild after namespace classes, sanitize all docstrings Fixes NameError when importing the generated client: model_rebuild() was called inline (in render_struct_with_flattened_internal_enum) before namespace alias classes were defined, so dotted type references like `business_rules.Response` could not be resolved. Moved all model_rebuild() calls to the global rebuild section which runs after namespace classes are defined. Also sanitized all remaining docstring emission points (13 locations) to escape backslashes and triple-quotes in description text. Fixed factory method names and parameters using Python keywords (from, global) via safe_python_identifier(). Validated against Partly's core-server (284 endpoints, 78K-line schema): - 57K-line Python client generates as valid Python - Imports in 0.65s - Successfully authenticates against live API (dev13) --- ..._flatten_enum_with_unit_variants_only-5.snap | 8 -------- ..._flatten_internally_tagged_enum_field-5.snap | 7 ------- ...atten_optional_internally_tagged_enum-5.snap | 7 ------- ...ten_struct_and_internal_enum_combined-5.snap | 7 ------- reflectapi-python-runtime/README.md | 0 .../__pycache__/__init__.cpython-314.pyc | Bin 0 -> 2775 bytes .../__pycache__/auth.cpython-314.pyc | Bin 0 -> 29921 bytes .../__pycache__/batch.cpython-314.pyc | Bin 0 -> 11387 bytes .../__pycache__/client.cpython-314.pyc | Bin 0 -> 36233 bytes .../__pycache__/exceptions.cpython-314.pyc | Bin 0 -> 7211 bytes .../hypothesis_strategies.cpython-314.pyc | Bin 0 -> 10815 bytes .../__pycache__/middleware.cpython-314.pyc | Bin 0 -> 13459 bytes .../__pycache__/option.cpython-314.pyc | Bin 0 -> 15584 bytes .../__pycache__/response.cpython-314.pyc | Bin 0 -> 7772 bytes .../__pycache__/streaming.cpython-314.pyc | Bin 0 -> 22278 bytes .../__pycache__/testing.cpython-314.pyc | Bin 0 -> 21658 bytes .../__pycache__/types.cpython-314.pyc | Bin 0 -> 1380 bytes reflectapi/src/codegen/python.rs | 10 ++++------ 18 files changed, 4 insertions(+), 35 deletions(-) create mode 100644 reflectapi-python-runtime/README.md create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/__init__.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/auth.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/batch.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/client.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/exceptions.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/hypothesis_strategies.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/middleware.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/option.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/response.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/streaming.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/testing.cpython-314.pyc create mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/types.cpython-314.pyc diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap index 996dcc5d..1d63ce48 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap @@ -99,14 +99,6 @@ class ReflectapiDemoTestsSerdeItem(RootModel): ] -try: - ReflectapiDemoTestsSerdeItemActive.model_rebuild() - ReflectapiDemoTestsSerdeItemInactive.model_rebuild() - ReflectapiDemoTestsSerdeItemPending.model_rebuild() -except AttributeError: - pass - - # Namespace classes for dotted access to types class reflectapi_demo: """Namespace for reflectapi_demo types.""" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index e7dc0f0d..cdd09378 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -88,13 +88,6 @@ class ReflectapiDemoTestsSerdeOffer(RootModel): ] -try: - ReflectapiDemoTestsSerdeOfferSingle.model_rebuild() - ReflectapiDemoTestsSerdeOfferGroup.model_rebuild() -except AttributeError: - pass - - # Namespace classes for dotted access to types class reflectapi_demo: """Namespace for reflectapi_demo types.""" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap index 7cb6149c..e575c9be 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap @@ -81,13 +81,6 @@ class ReflectapiDemoTestsSerdeTask(RootModel): ] -try: - ReflectapiDemoTestsSerdeTaskHigh.model_rebuild() - ReflectapiDemoTestsSerdeTaskLow.model_rebuild() -except AttributeError: - pass - - # Namespace classes for dotted access to types class reflectapi_demo: """Namespace for reflectapi_demo types.""" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap index 41a64930..12b50d35 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap @@ -99,13 +99,6 @@ class ReflectapiDemoTestsSerdePost(RootModel): ] -try: - ReflectapiDemoTestsSerdePostText.model_rebuild() - ReflectapiDemoTestsSerdePostImage.model_rebuild() -except AttributeError: - pass - - # Namespace classes for dotted access to types class reflectapi_demo: """Namespace for reflectapi_demo types.""" diff --git a/reflectapi-python-runtime/README.md b/reflectapi-python-runtime/README.md new file mode 100644 index 00000000..e69de29b diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/__init__.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..47fcdb8710897d250309ffcba078dec5e38f346a GIT binary patch literal 2775 zcmbuBNmJuS6vtb}@(Q*wn9VF=#{<~F46|nvhLE(Az)TF;7e&ZDg9;vy>8j-xuFch&(UwcI(C||zo^jr#Jcd0 z)EN7TH5jn(wT4#Lcno5E00wv*;#>!vCm_L-kmM;y@ie4)1~NPgSw0AZd${ zxDXgGJm2Wgy!leN!nZ&)4ZGz~hiaxWBs2KXk40zi63%3noLg?QC48Bt!ije-T$z4q z1&*z{l>=v&q8>XuJ$Uw?osPNtJ3$dY6! zGJIh(pWfeomTZu0h%84|BwHdIAzLFWkgbsA$u`L#TRwi3SJE}aENz-h4wrR>Z-LL<>Z>gWseN!8h z30vLvXy3FwnGvsTp-xv2MMwol?NaT7Rxe9uowkQ>w!jH`_reiD6q^3duD2pH7uQE# zg-#}-0~`fTg-eCTz{zjKf+8SOe)k|pxuQ7AG+wUg;6}-!Sj!~f@xrqlWwM_&l_pAr z)ae=qQC6?BC9|gaO85a@LX0s68_$_({=)vj5lntjJHy*mJH?CV)|%o~&5wQw@S5Jh z&9?ec*zCUJYk_ayXf=D)rs=p2m}a%zk*UY{rnzj1C;lEj2me5@z``RP4rrS8cWgk5 zUuAMy?27g5Ez#Rqrp^7qYFDuY78u%9u19ZkOk2B(rDzb^-(*)srtSX0p4{xuv=6l3 z*}LAI=jk&(1=Z+K@H@rdBTs~; R;vbL;p+)?2(tj6^+P|ra`=bB= literal 0 HcmV?d00001 diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/auth.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/auth.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a4e1ef00e8138850087186974883595a9dd80baf GIT binary patch literal 29921 zcmdsg32;uPp!aSNE3pwDD*=K4xKjctQ`|&Sq9CS8ld?ss-2|FqTVMnJ-4sR8 zWpgB#4aSNoCY2#*WkSetVsa*v$YVQJmMKTFHCrY%fFQY{j#8$}_GDbM6c~WRF>7jO z&b{w%{n2QEvaF=$k^TPrZ~6bd`|i8rfd@H$jpCtW+ZuH<533)Ch zOVULtDrKanrKo&B-tWjb8Y%5K;LJGr>dLrqbsliv7khmDNU@qpNV=sNL5^9W7F4%jlM!XEUc0 zsZ4Spo=Fa;l+*Fl;7~$ME2oB4C7L)jlo-hDJaj-gbUt$$#REf0R8IGF%DF&1l^V`) zt8{;-Bj?nr|?ki4P3L(`l}gI-m3Ijt>pRPvXfYj3r3} zvOM?Ck$X`(A!THsg5&9M#@PyV$he}86Yi+99i>rMriAa@d{>h3L_H|;YIj~tq&w=@ z?tFX~(C+-vAj(2~hsntVP6VS7fCW=BRBE6^2)Qeeiz%_>hNI=k!-N3zk!WS6G+F`> zR^@yI!Xv}aCQ_s8qlpnUktPr+@stwJhi!)HDCd%y(+a>7C&2XNoPbv@7#|o&q|-63 zkt^Aih^q-T=jYp4=KM&a|DHdY$|#>z`iE1AoImmWND}XfB~$nOXs_po)Wj)dpVpq^ zP7e%^B<=-I4GqVQwt?7ynuuo-gRyvK04vT2v@S3Sp}9{YaZx%d9Wsi{#Hj{Js+W#y zYeO#IA950FW% zK)ala@@~pGS2{6tDouTD&mHbPJ$xq7ds0otQ@w+U=Xx<@!qNCh(vs{RVRY?Q&jPbi zJ*^H{N@IF9%}>wB`CKR#8yQY#0M2A47Ryx|6WWtkP=_9*n-E=;ZUrLQK;2ZJ?(IO! z`;9Hv&wus&D;LK0{4iL5+bIQG=TJ#v=;{#GpexVSbNi#x(~bweAW4IOc)j#%@@Y9L zM;*O@&rRpgscx=BO=QlhshsQN@bJ)02`i}tOY%%S!+>a3Yp7B%7SmQ?0{yPC_S?*- z9;eIswRa_td;M*S#`o|=rS9aR0j)zugK=)L2pVv=X*!pW3Wr>Hpe?LrwjeS`;qzp(F_;+I>1P@T`(NrGS1ZVreDQidY$gJ&$xc)d(J}R#8Og1gu(#OU{!R zijSldgJ}YDyCMMTPo`s9(_DoKMl)AI<@AGyE=sc{Qn2*$j!Qe<4m7`4zVfGKRaZNI zv-7vQCR|x%-ITKK-LiFKo?DTs>pQOPxDkD~u6HW3ZqmEX1oeI61jf>cSF6+sm1a_H zM${>*Ex1_lL2ae7Hbh-ipwGF>z2UZmX#5~w%#NTE2MswxbH{PJ=+Zal95_KOY@slw zthLnQd28R7$ncbbQw$HC%_PK>3GS0m1bF^v>eOmPf&ggKr4zt-#yVYQ?iy-9RNg*a z)iaUuY@~52(m2ujjow##-;J!F^sYBSa^G`v(>gbV&P&eCdg_}#HxBm$wJhX2Dut@z1WI)q=dO3m{=vfS9&K`G*2{5?8&xno@(7Z z*|KFavUSqCl}8P9=4HAf=Z(cu@iRox{IS@X;lZ;*lm@N)%-Q&mRuYNDP9@cJW+<6T zq=r%KiNywo2arICMKX!S#84QQR?v9LC}OOtMJneVQNbkD%z3qg3J71-4OCDWi-8|O zFao2@sL7K+)ij<)E06ojn5g>bmZC6z>E{rAN&2yC+pV(7X;8 zO3jvW9@epzht%Dmjz6MH)R6)Fj6m3fAkTdou|=xdl5vtu1zE@enZ}tX=aeAVg2{+V)qn@23BN(s^LYZMDuB6YW22QKPso}F}MH@m-KO^K#!Q0e_@uW1p zqrF`tlyQ1mjGiXM18qin%zR>MX%C`{((Mw-7ZM$%&gr!9zJRRmK+B>ua2G02r3C=H zafSi*mjZkX0Y(FRkpM<(tyyYBj|pg-ok} z-tDCyqxMAjf38FD7iogn3r@G3hpY4s#?_@oK*8=GMgw&xMa_s7WB0pIwi`bSOIb}A zw|b(1FAL#_PC$kN95*2$;0WfS&o=V(a8%x;o^N5H_6I5@7%PtRJ8XkXUI^6z_w_Ss8 z)yfYDU-cmMX(^aOPho}WMgr!>8z=Zu7^Y4KVEQPUEf1#q0MAcjE}oY!IuE-2(q@+l zWsh{wr{Q&*fHY%b5l{m?4$!a`pmT&uge2Ctqik}2Tl0NV6Rx2t>~Pp=)AFd zx?)2%yy0E%hNiw>HDj)@Ra zi;ma2`EHRJAuMl2YZjb}VmO$VJo@m?Awpw~A7NLaoJ=TZu~`5GQR2#grnq1prcDbF zRvC$_kXJGZwMXs8%NEW7BpPZ9>4Y~IIuX`$d3+?C0M#Sqmp^~$^W*2HBdaI9t9e+A zs{NfomDa1enW8NeZKa6BLX}`HRvP2L6Lfo+qGJ?oqlnO5JdJja>O*=&Pf8Ox{-X4r z>*KfF%9p3HCXUR&fCZ;l-V+wFBOiMHmJOo&gflz3H_h-~Hq_Kl$3h$*!Ga zp39L-k@3isw__$!H5UFzX5>@o$ebw;3ko5`yAC1VbrhbF7imUl54JoOstJGc=-R^Y z7fjPW3x$a^v(KDHNel{O5tM~6$U`#(lYDCZi#fvX7s@JRHHJk0P2b`qo1SAK*@bBI zC#ecWq!vpP*(Msj`Hl-j<4!5C`mR5p`cmBi{ER?Ijv&wNLTsVF361*tY3oOuJ+>dX zY0F2H7Ygo@s0V3m^N{vLeW1YDKy?Okei#EDOPpuoyMqh^xUp|mboR*<3EJ7`lTh|6 zBSY~4mJOBR5i&KTd;0UlW7-9wzp}xv3u#DcD;IS|-MysLDABfa(EY}qO`K=ioC|2W z3DOhf{LGnIo1m8B`Nf1jsC|v0&6vZ_o|v%52d_P zW#erhQUbLJ74%?G@-@iGr{u>JvU`beY+Z_Ka?rMe|JhFA3Fa6q%nO4BKx!rU8dwC$ z*PCh7o*04!P<_gNp#mbPv2;U9RlQBeVB%E#>`^QM%99ez54_bJ1tv`&EgIMvT!+^R}Z8d0Z<)wQ-<-dVLH z2<^+KP%&4IKA}s5l9)HaiFnRvm4Xx1N-G;*3eMDF>#%aBw)HEKUpWcP;Kk?hGni6< zm=YplO1KbH!et=|B%Hw-2+dUhCl*uotwtpZgJ8GyU_gbK(}?4^W>*D^avY+yWefVw zZp4YbpVwB1+hgkrDdU;tIS!Fx&=!tDp|n-QuX;EEy$B7$wu4UdExE^Q=0Qa}6d3GU_Ov$jFrQ!76q>M#M=?P$r?Aj%^Q9 z#s!L~zJ_gzFcJtJTxr2Jll}5+e;Q4|egl!qJ1*}S+i|O`=4#iKuCd+kSJsTTTwil- z&2(kk*dsITYrZk`>d@FDS9e_5F%@i?scpF4eXaY(bK~99wOhvaz4RC;Non<1c-ASc z-~8R+H-lsQENChzzj}u9n<*l}Ur>=@N>N1UVDQ-kcU_?6cbc(K z@7Ct?S*kmLpAj^wy0FAjGA9UDorEL=U`=4SPBNla1;z|J}gz% zUVY*>pP1M`U9ok{^%b9hAQ4+#bhxj1Us~xhhDTqezSbflvB%|ZB->#lF)&<+f#Fh^ zC}4b{xqfa4Vvegl9J0>6R%ogk^I4b9rXcRgqjiF8m=j~}@_PX1FXLG%={|C`|Y{lxSiq$tf(-rH+eD6ofUq0~V&rf<+ zeIzsS&u9Q2J`vXTOogC{9jwrq>pR$@6uGt#5CuWzt{VgyI!c@+46hriVo>3= zcU+(xcglcmWbCr)nyA45en!yHN}l^1vMjruuW3}cV!68=?0jI zigcnJCUWZvN!yNzbWs?y%o}Es7K`kd98q@^d%CE%*Nvs*6NKN#I-wYZBtiLo!o4e& z9L$BZWI6#4os2M=(he$DA`0%UWt=nF@=K+)vjIv4r4L{p1~0fM)wpwgTrx}4-SRo+B~l)k6!aQX?-~ybsr}+ABRIk z_-#RFd4}|lUerrR+>cijZ)gE zZoC&0VBy@_@({R2PGb7%u}MLBeB8k1K1FNKIZ7fmI5JG`b03c$WL7R73p6(>YA-sl z$679M-(E-Lay|C1Lpkd+;zJ7G8{22`a!vVUd9I}aOLyA4$>B1uNm}VRmmC@rE^-O- zbb`O7vB~cA_jg8AVpZxmMb{`I49b;g?tdPZsguJw*TLa|XLA9O9UGz>_&d=iJf0dz zsK3sQb~BxVmjxSyM4w>9H`g<~scWEeNSj;KVA@!?xL7J8wZQS#= z?ybewzYv9Z?f(XvgB>?ZwJk4&XKI=eHLQ8ZTRT%(`;s37ptF0-^-|#dy5{TKzqPZT4U>hGYzzr)WkAq3nNq)Di_5$228Csg7l`89B7@ACB?c)1V}K%}V4b6Kl)ZFWPhK+Gct}lP zi!Pjy@~~YI?y!D%exx$&^O`FYm_`n(`trBoIv|;k{F?Owdww|ArfD>~hhJ3;p1JgD zZ5e3mGPj{93Knd`Q?LuqX8ABwGg;d+6RaMuxW4Mzs+nNj_>pWw?^HwYtjAUAA9I2K zz+JHKa^G0rOucgb(QA*6?RmNS(&Mo7jRnjZ(tq=rY|1T9kTU83Blmq-0uHF$yp8~rFe zvmjG}dk>PcW}F-YlY@det;LRjeavAqWR{c|fa7``>fH`v6`FfeXV1Oh?qT?Gr83<| z;J$vZiFQ}oHwL}Wcb_|VuA97>yCHfeQUk+K8pDO@U!qGwB}a0K@Y^E|p>X6iocC_J zg<~R3ldY)Jul_FOc2M+36n!00&PCqc%qw%HYCM@v#PD+V?mL^#xjvm9PVoZDIiE>n z;3US3j5?F^!kc~srV3aRm{`S_tPm+|hXP%=SXIW*id-R+gBoceK;+gJr7MM+@bdg? zJX`1xw_V;gwrxCf{lc{i*~ZQIKiRl>ro8&WM2Sek(TSf4{16rlw`0|J|C6Gu2I3KX>JG6GN}Sf%u<0>v zBa&_l#n|aH5Dpe=cNTpD&B8zZ`=foh&+iq}O^@w`xYftObkn=Ayr5QJDzujY-Gms? zD@R>A-L(5MF&!;JCz*~KdmpneMjxHW4O$7yg4;$%E6o;qigvdaI$EfPl};8aH|Qkj zY@u?$K}Q1?I;u17MX+IcGv<-@$_LlL>+8q(P2d+);KR>z3u+@g#5|H;(sAn<;8eYo z#P@Lx@Pnj(w2#{6Y><*N`;7(f_1zEcX35?l-u>#g0ao=p6#WTBMd`8nT~z4|sIO8@ z8~ObM%6pw6-WdETrT&Z};?e4#Q}h>zgrUVCsZ|R|D)(;*SwoLu=hsO_rFpth^RP@b*~ zkL|}JLY3KI+f=aao#5(QHBHwWt~I>UIQHoKwJkFZt8awgZP+?f*LMA5*FJV*?d#s@ zx}C<|blujORUOw;*HSlP)2kkusZy?{uB0Z8O;>e;~wM#yy7oztjH&;C`WIZKA; zg#0%<<-LCIn`?G?ar1)>ROtsh2A736fdWN(M>tqOT>b@;7H zKcy81#mzp{%rpEGJB9eQJe$SRx@(ejy_j&r|HMVcS42X0&Bj;U3D#gG%_IWi7n=JN z5^Q|MQ|!SYP$Vc)3tQ03Vceu~*+NuqM-J_UV3yh_wAq@f!lvAOBOV^IMXS&v9yB?nE zdU(2P*GKMCL~|N0G^gZKgvlhIqDANQMViyk;t2-3FEXzM8QJ~Mv*8;CQrB;mbmqPwPo&?j*Xz3maE^&^ha1!{XA{p(49c!GVbjV`(?<9vV(36pMN< zO`D~22?aVc`T*+;eB+(!H_!>OLvasK1N*mD>ffS5uBq6Zayte`8|w1TAscAG|H(iD zHUZgS!&I;#8*G82!4HFN^l@qdo7J+XO3hM_n-LY$Gt}hIP7h5>&-fr;7S0YWE?%N! zwK0|`()M7?5JtL~d|YgX>`U96F)UIqFH*;7hnP8Di_4oo5^-`R_{6=?1pbT)n~P1L zXviR2kIK9h>EmL34$G>tWvx?Xt=Y1!sj{x=vhHlK`|V&i&*Xc-Zfy~+dr1CQ@;2AE zd=JSm?y%HlAeWHIUd6+0$}*P8ZaVt=JHt!(De_jDc@C4Iz4R=iH;kYv4YHt<`EOGJ zMPI`&y%7;PFg|?O1!K&eM`S22@6d2;#JWI`bPg9E|`a3ygPgX@v2v#Pao;$MW@>mkfPm#m{1@Y4}#cvl71&{5<%<>ptp_26{c{YEaN< z-UyH;O=WcqSp@Ai2-@|j^g`DAtFKV12*t>0Ho&~`=^)6n0X731Y0_Mi`m&pBfQW9v z`_hdo^dT#oXFZhiN)@YSeUyUKzG^l=sUVexCb+^T5*|DB%h?EzItdL5l8d!q;T#-i;C+x-@K zZ@ulMxLwwJ3$)97uc3K3>WMnp-bk3rfft@D{ywH{p}jF~U55(kC5zb`t%r8N0ahGp zp@>|eEoG};-k}_QN>u1iHCvz6>X%BKiw|)Vp=^Y56wbSRXo%H>sdSL-0$;`sl1!2J zbc=P6JbX3#Ng+GueLtj_F?9J4)4$M9ri_u%Q6}cs|L_e~@T%d|VEX<{rmU3K#pblX z(wzelOBQ}p{38SEQwth}#ds>>s> zy@F{in^%c?3G-?p1M6bMRTx;Au##5hqBOros#a!d+Gc83L*qN|acK(Opxy48Z)v@Y zBQa{eUOth0{qf1RN3%_jz1{TK`(^brrHMJGqdbfc^+MtK;6F}l?9y81{|?an8t8?g zWv(aN8KQ|#@MWP)OWG~wAKM)S)xs8*qINMs!`*le2k3h>K7*5DpnF}+h+F8HY}h4^ zW(!d_`eo&MT6wRFHN*w%WrZwbcm^?hTY!cb`dDa)y*j64jWFS`E$9jp)(9Is%dDiA z!?I@bE@#wd(+F3aE%X%0E;=`XMz>InpbphV$`>(}7lQHO#1X~%KHvQi|TmEpG2s4 zgJKs!6POD|#j#3)jF}H)3idiRVKTK$Wp8;bkA<=SNv>CHnHHg23mfqA{GWI=cEF_7 zy>uZP>A?TVNXPqSt0o(_O_yz-3~q;%7^)fXWh4Fdr>;GfZP+r^u%)2!-sfiHeV7%$ zAGKla_15oo{b^UW@9gt2UuYre0;eX% z{(nRQp@8sNO?4kKN%Sv+BnG0v1fB|q|vHO?d(zK zi7G8k1p5nGx(ZT3^$tDKBz`Qk-8b>8un|A*c5dB$P(NLM6U`y;`YgH<4f)7`g_d2h>3KE+bo z*_wy(@g6I+sBqHhwpfjMmqUzPtS=JUEC;`_-Ai|^SwuLnn}NxU#`Cie&$5UIZP`fM zWTee>si6<|wq4qm4YcC_WT2H@YPzP%yQa&#CxhKT4cAWA9i9#!ne-kpCsdQlr4JdQ zu38bw=l%o`iehqWp{x0RjEMuu@yv3+j+Vt(?g#g4DTY2Diq8tc&=w9A*tZxc+ohqb zfs|%r9cAr0|K)jO9H$L82dnN3jOQ|bPvX~xU)3+^q2W}&k5}}o{|7O=r(eazz7FnD z9`hOdI`{!fba#klt^;Nij8|i5T*w_lIG4eJ4F4zLL$=Tj0w1QbUzZ_Vvm*q_(9;bM zWUC*z8!%iZ@YPy*<7DHp>9Qv$gHO&yP;lEXt$a|g0{;Z|M|cUHd7)-^Df|(3b-^D2 zsp}oPHoD*NgphorLf+L~@QfI%c!*NG)tZFJH<5LH+k=sQw3v{t8jPEqO0;a+=3L zVe~RR26#Y!P0t}-`l|-t4FcbPGTvqf-;4hkZ2jsK_3v$p7J~KwvUM~4QlJ%PdLHsS z^t5*o61ukeiATF-+5YwrQyzYj%YJ^r-F6>cdB%E z3D~yjtYDDnIdN7nQm}!Gymlk6{f@VQTLryz06!xT5+K-5j56FR0?T!)z_-)n;t5m@ey-WoCkbjt@cr~ey{(Tg}f6r@q}WeDpzd|KhK-t-_TUUo)6A> zS6bojy-m@rmHTGhxPnpD9*}Q)kQ5X_n--oMO5+!rJHoAx%KCbI23!t%c*9*l)1cx- zB3SqA_|)0RKc-kt(V%0#oTGnlv5oUFUIRRd_Bk`>#d`2mK79L>!{&!U#!Q0sJmR-o==c*Qe~Hx9O)M>;3s4Paoa2GouV8;^~Zn&(`T|s{C;% z_&(S6cI6D9LPvz^h>8+&mHC zI}`6wje|xs+;c=c^BnLb-D-qh$)nx7`HvYX@nxL=jBaw5V|b`VtDFm-m297%bL*%9K&g?@V(nmMO_Xr+1T zp*W>d!Nd4KvL%80-w3#C`Q5O+$eXa3LoB(&`u$FXL(++bYpe9gz10=QP%=|VFGt{s<;$+|6;LEEl_w)lB(fGc$w zbmEKDa~g=1C*}Nnpc9KoY8SfAUDr{$;^il&109nti#kUKDuIQ8D$uDYPz#+VB%D4N zxaN+EO{e60DPaBElv)bb|BGOaZ)X|SF8MHQ9~93-$_R^*Xl&LJ8@FhQ9S20>mRlhV zKdc!@2=aQ+aHbH7A8Xm9)#Q2Drq4r4KSoCQ2NpSo#)|YbMr<``FKO9Y5+L#qFU{2q z6T{k|ouHC;%0&-Az+f;J#OjIjub-F>L?>O*g=FX-#=l#kA@bgJsVV)xG^PEhPRl1C zm*BJ#xn!oSa@L9Kt@4IhH?E|etDW^w3U-FtSs$f@3pb^3j8olgh*Dvxr0I49DFFzY zSv_d<*scAUH7g-I)^cp`Cavxw^Gx$$xZxLa|FzCD4IFlx04~C_$~NQVn`uAw#+dWG zH^s=&SX~boF`NXMm@kupt7p6w6Q6kfAqf4!68dWgV#MkT^lG`k(=9X=_54Qw=#M3x zI*Y# zIz>JzbL|9J#2*Y`?m0{)U!aJWGa~@YBg8nxdA&q;R6=4N6|Z=nD{*3icf0tbP9IaZ zq6+>?=|4d<>y%~rJ!$*Tq~@PU;lGgrKayJhR%-f@r2Iq*0y!LkyN*`*fmsO=)EbV! zEZxrc%hhtn%WYTJTv;qZoMuH>Tta1ng_zFH zv5;^~=(g#$TB_TQiMohVJZA59=#Flu?(BByu3A>g>R8BL&O(khn>mZ_KI^VyZPwg+ z9v|(|J!c)wR@-16V^uV(^H_ejSNC=o=mq$S5ON(W?DpwCUUwh!cNghJ-5c}`{5kJf zad(Mc(p{>TT3_|xtNCYLXG>c*S`(va6V19_#v${fPeBH>xm>p5zO9q~(s>!=b})MzA<1(h)iW5Qw+S|`|9rVGHm z?VLv!LxOG(*#N0n&SHMu5wh#fkOPo94S$$}+LH(=S`vUN<1d^9DABkQlM(|j0Zd6% zlB%Nd#$ibxQ6zZ)PZ32*3`ufa>hA07MIUpt6pc#*tJWTj2!M!wln6|qRamS-WrFpy zbGE%dU~CX=RqO>}LKBIN{t($rmOEVV8{s^j>@`5Gu9h@+eZ?k z%Ju;@D#y1EDi^k^CU)gyG^e^P$q~IxO<`^5uBnlnx8Za%2R)d)WO&12Yaf(w*r;BO zq+ssr0>Gga^VKXf!O^fl*$uN;L^I>-rwS#48f(p4Bt9Ybz)FSjqV`qWa6t9q{kwu; z*Ob^0Uu%OBwQn!H3$m_T$M|F81rWo!{IToWDHrw5ij2=-izS?hO@TlZ!3rIytY8A2drY z5R@?`k^;{Sui+i(VpJcIB8hk;rK(`MOH|j@L~JEf*|8+7Pgs=r+SX^PkQlOWC;8-1 zAv2j#I4X~YGgIq^7{$!ASBAYO0r^7P84y%XOPtp@{i(E(Mg>Q-xr7zWP=~i#4YCQg z%tXiY!UE5yw0T~>f7pEHTOYAR7J75=O}^;ogHQS6yqU5fq(qz`;OPu4mZx4z)uf-P ztYiH`o7ESiGJT29-W7VVc2XRMGpx(ndChRi+NF3TnlSQCDx-38B%vx`3oTuL*QS=B zJ0GJFv`twijK-rnIHP1GCd^ij1zTCw$Y&yg0JeZ;1oAiD%e+WJO@xP1@yJ&j)7*3V^x0M^!&RsI&YtDFs|N6a$8D~< z1szC!-dFQq$)9y^oN;fw@ytDU-_lZFQ6{P&QrD#>*^l=*5#8`BlaW7Vn@UvwBvGRh?XS zZ_-xPF!rbljMsqOC@LgD_FZj37$|%0UZyJR#nofyQVXq>Cep3aXM}w?%bj zRElbn0^zHuWaQ*%9;ro3MIwr(1w63j%y(QvNi9QiG?r48Kv3!%!EgYRxTr}Z_&OBn zu#}WlJu1f}tDELo&sg%Tu$BnHFfG2BV7C(n)IAt#l38Ich4np_yo{DyaW*W|`h)GU zL`05h2UZCBHcYRXHrz6+%qv@%&TED?ZHw zgRpg~Sf7vr6fjEhm-Yva;&~+;4eSi9jHh!SpCK*EQ!lads#M3evoz(0Y-h+;;wdCP zZShmmc7}{Mo=$B@!}VlvfGhqSzbp8iAP$k(8Gm{%CmTFRYf6e)y!44#Y^1-G!2lEh zFo5+}1G7o-p!f(F0Jq7dF6M!B0X8yt4cYrdFWY776GM)tEy?lC=QF<^6{2jPSk0n> z#I`cN3oE{yhI<&_sbWz`ifTYZf232)k(R{RmXR2e2HuP*Tx^);R!042jIEyGGztTD zBcE*Flm^pjP%&I1iae;On&E_Bfr$*SDqn+BBqJRc4nIobPs z&&eZ3-jT70k|b3LbLRjJf)B+_V)v+JD;t8s^`b^})+9;Ngy~$ASz0wrc4yWOGIl*q zEUZ6<3y4`v|C=w^1eAkJLaR29) zKbS4=xKrLSSKGLp&nlX)U-^qGOMWKpoZH-dUuyhW!A}a_8Muqb+WPyAdzSJXQrWfc zB`>RLp1N>%)86H3KISj4{8x2g(SiDJmTFi<-4b&amEFfj>VEp|+4A6>^59&p^oD!6 zf%ks>%2E@n+B~=M;D^Eo+H^(d$2*rqTUFT-vz3-DH(P!FcfJObe6?K5pRZqe?aKdY zw6?32ho2SR5Dsl|zbT?NB^<7H{KRu;m;F8AP^CE-xed9%(z^`@O@ z|EQeWKiVuD+Tr}D(Mk1If!c!t)pziGSN`FRu8;PYA1-y>DiKh>Rcgm4ZdKCQTTMb| zz20<1@Y8v>8-&A6g||0* zsJ`7s`OZA_G>S}Z8CKGiq;(+}!7VE_$SKOy4FS7pUiF~OBsG_%U^S9uL!d0vYj}YM zZCFc1+>|+wmnM}IGJnadmtVa+d3mn5bn@7;9ZF=LG|SRnRw=zz_&0@fPw)HZ%l~-! zZb9eIFTbNt7jB;FyH~j7=a**+I_E{P((|CEVZnhC-bb-#(lzg4{_@GfhriBag@=U& z5seSI+Pd1_(JcInze950^m$OdSt)ch+HY?3qP{`}lgxq^d6Iy|8q+SvY8p`nE8Az#J@ zE{LqS>7n84eW*2JhVPejc!j?bIvn=vZq(kY=y2J8;Y4=RX23A#3}i$$AhwUj>rxCDvM%`t51ct(F~c1>uWd+v}jo7N;6^BlrTg=&_jL;A5G= zqAUe&1e})))oKd72w7J^wLK8ND~VR!3uvM9Gn8xOWu`IQ={ZbtPAh(kpf^|q&GkOF zR5YVz9g5C*{~dfxgFVSf`awli4naR?4Nm6GH8f7TKQF7E?7Hu(ywUX2t+T%19ba(H zUpecSX8h7r**$;D1AoPJ-)p`p=RJS(LLMuxnfEe(<+QJU+Fid;PIRx4`3jnECYo=w zU+?h!UL>^If@#0j(@xMD;ec^*Y;#By_mFNB^I|Q{l8C^sU=f6Y5oa<&7y{Wceeoib z(v-v_z%8ab%0n6P)aU>VKg8EfUv@==17S`Pa?jMo1X^xz7;##>Ls+Ufckir5z8H!H zPq1J5He74FzVEetcYU?f?%M29(jfmHn12uO=v5q`F}0F1I(kwm=%((X>>0{9hf_>cJwusH z89}0w@6G9#f5o)28mWykiok00SqizsjG{>FmmY-fzH}p0^yME3WK?{)0TTGj8c_7I z8(Waw06s+oqce#p8%bC^gghsBK4t~aJx>}u*WIB!(0hKGKoQMW#`F_%Tpm``@k5>F zvovZp@aXu!s`DglnXJQ)(v@M7gqjs2w~o+OC_eJ@0lKibnS=f4xOm7Ba&AX-Dc~|= z<4*HLPPJnkkN%qCg0}5ziQJG(8deiIx{M%-9` zta2FTpkZC4YiS#c9d!$oP1o<@Wfm-S;E7Oum9)c;P{zd`%Ku&1c>qm#;p-?e9sXul$sTXJoW+B!cc{Ip1b&}CtuLk`YvPLtj2vO27pM9^&~ z#oo-YY-QbZkxY!d76vKglQ_PmQ&k}LB-xBuabb8d3Z<5NCK5vrb>-#|@$k(tgSP9- zLi6A~>&Kb`(2JpuIte`fq=+6MF`kwW>*N0wd`BxoM)tUCK5T!xr*D7{$-9B`7v7Mb14wIKS3rf`8dF=58# z%+N~b?}%zLCOL}959RTe2gT*H#XTprmqOu3b3Mc# zFU8V<#)1{(U_A9(EsgUlMUcJ%!8nOje$5F6K14y$thai`TRrP-n(;PG>7RI8=ZecG zk8>IVgrt~^f)zT8?+RZ=`p}T5iXR#dSzZ!uOr#}9+B;gK zrKdAJ(4(+OZp@>u(cmPFM6HcmH}9;v$hL3Bw zlfLdL=KAhduKJ{NO-uFJ#@mmKMfFE$K14Hh#FnJAm6KM01ImbeA(~L(g^MQP5a8+r zvUE)J2h{Kix%@s7v$&`F)7Y&|FA zC3->G7=ApKN>0Xejgy|()POy=4h;(w;Wy2@gqP2p@LaWK|bimNWpto8>uKD-$J zC>2?rg?NPrlf2Bpa<8N&}FERYKp$#2XJGMp09@mX-X zF#bOoJAsSZj6Fv;5VN;_a$>4D5`R&H8}_URQG1DBjLCJaf_$2mm6wM0@7xhUR}=5% zKpJd@E%r;NO{51S+++zS6}_bwKe}bMf2bbS@a5^Y^FYnY;rK4cRNr%V2Z zskXbmz0>Z!9M|0HxA?^MXg+xr!`J1GKcyFxy@_Au*4zGNJ2rDMv!lF6pprZLbPsPR zh06)Jho=(!)(Hy)G!7J1;uO;iBWuUJRdG` z!yA5nXt;q$e#cXls1tcthJ)0Arq)wK17(eraeVTX5M7&iDMZb1x0^Qx52)AiNDh~# zAe$EjLHLyI{}rqMoE3h?f-@|*?6wOC@>1q!rHyw>nx7Ur-@Diauy|wfA|3<*5C9({L5d{!0ACQif&fJ#y7%w!YYr2*{H~sp3T@<7#)A{=K zKljeeJ^&IRO*--SX+Gl4**kac+{d}+oO|v$hwEKVn}DnLZ@(F>dr1&}NI%re$N_Pw zQxt^rLQsec9~FY)L9s^{*Hsd%JE)KA+1(H~u)8sC#9e>T)MJjDSsBAYOOG{f?Xkse zJ@&X=dCw7dpq%lbv&R*8u{;xCciaP544Mz-^?2i623rpLdh+A>Jq7WCp2Bz`%D7p+ z^`O6}C|=Z4953!EiI?=0#!Feg?O<6?dAyv#_Jb8YmGR1+Ks-<>6bMy9(BT(?&Q2Zg zS-k3aRh7`G^fz98+=ddazJ4)n4!)H{|Qk{O}5(I{I&q0#V}NGK%RLZLHb!xJL}J3^t4PlQL5 zC+<+_WK@d9N1~&V(J?$O2!&!aD?_1hJT65~OvEFxP)MSWFHt+>Ct6RBor$!bK+i^7 zha;b8mG~@&$DETRIL5g(CJkjg4XN22X5zC1n6&v@Aa(eAi%+ z=qJmU#eNK_@x<7~=Q0Wc6%TnYdAPgg~O!$a+S`3OoT~Hs? zwGz4-{+`fY){mWdMxr-mlN5MLZ%dvh-q2irp{O@ZYTQtgR@@E)!C;%eb@+^`94xseM4Jk15Mh5c)Joc?&mn zIoB&$!+F%Z0ijPJVCj-5tNf_BQ~lJ6oa;X8x2n|)fM_nO!>6>-u9iyQX-2jvy+=Ep z>XV@1m|KMh1R~0GIY36+_3E$FVxwtt`=Q4l>kViNObVQw7#*TD#wZU~QH1a=0CE7@ zGaLpM4h1mhAV;wl*@o2+83_$foEh(*5oJf@?9j->a3nN3HX509KgNm$#!d#}AVY!4 z;y^SO0IdpSeKLGvB+_V+ZP8eC6f0(QC?Z?b&&t+lY>Xq4Y@kfpd^#MX1trl0%2uLp zoD3Q08;zn=jeLf5>p0SRLeIoNFwz~AHlhSWya@p3h4;;QQ#HSRHtBDe^*1EVjdSM4 z1-JL*PrmfY&weUlskmnKO?7{<==Ji~%9GamIct6PL(i0NY9wi`nX}f=gXdp*e!BC* z^YiYugr)78%{Mjn<>Bd$H=~!HPP83N&ttwzb3yO(U$2WwHP?k=UMjr!m^l&ZgbDb_wiumL3- zb4v!Bkh`98sBG(IG6eDY$reSZfHc8YH1Xxr(%9(OL@ZOT z;0y#y+DywG?EJ?ZH+SyBl8c0gBT}pv%RSA|4Pi(LvWdT!#YbFtlkpLn?Yr<1j?ZS` zvNdQ6+JlauGw5nHqX%xO3a`qR6X-x_LK>0vF|2s1?zZD3q?mZ%*8;sDG16wrDj;Ft zX_ROVAUUo++k$74r6bW;{ON3|LMySA-mc7$cJS)yczpb93+1WxJVN#Ocs?Ij^+^q$ z$OhIBV(TD2wYX()JjUZ>e|k1rGC3eMKGuhXm|wNAZjqAf-hz}7_moBOR-~*1*#vKW z%1)3&C}>ML333VUmXwryWm0j5OkQy2pB zwJWHxi2-3$dwxt~jQxh~qRKW;p|&!iQfSG12YLJ&>>D+x@PH}ep|XP?8`WwG>hJ}P zc?QKAFuiee2E#HQ!#n(1#tcz&nb2<>HyceWNd5h0^ybV)5#Tq_c&7 zUB7;LuUdrxGuW!q2edWaazk#*XN8X`HEm6gpQzL+2*ZCi*cS2%=JKilPTAfs4ZPm&}bLOYI8|89+X`6ZCb?Vg$1|of<65`wc|9ktm6&J_wFRTLyXXYHJe%uXpvbV zw2<3EBtLOU-b_C~5gw6EEdK-_q+O_Z)j>LrLNVS18l(amoq|ig6y2s{?DkeSyItAK zp7EX-@S1ulQ)pdUha4KYm1vbJNK``8P$Nh|6s1kg(8yRUGGk!lD?N!!=~pOW!$;p( zhf72J$k`PTpJ%dekW7a0wm4q4y=40>$MP{>GqTNOBHJ!%(Q3%{F%;5}O>eAP6p&2C z*)81=6k?as5a-ef{A5F>JjlGMqQEu1ni za^8hc%f|TFvyoBR^ei+Pr($f4+ymV>NnIdjKy<@u+>1RfrHs)N0K(|;rOXVp2)@FU zm4PQONCDQ_0C5cvA4Ts&dL}o2-cMse@)6@PGdj*{ zoOHVC^+4Y$xxeGX$u@ppK;~Bj z9>Lo51Gjf->#V!`jn>O`^VM4u?(Vnt<7dLsy&MS~c#Tm;K3I2FYp9eF8!RT0wwizp z_FQBzLq8LGHgZn3bFrAIhGZLKunfL!1HV^AL^c8jwBQ~PMndt}e%9Grg41YQq=cah z?!XpEh-QK;LSb>rN{~$`s7%=jau5PJ333tsxB>AI(IgnuOTq+0pLX^U4Sh^m=wqr9 z25SZks_qg9WYiF-c|`;w{UkCXW(c#FsWoUC24FD55gBwR1>bn%9Bu)t%J}ML= zlqc$~p^$?ii8>jXGIr*JkK?ta79>ENe8E}=#946UFY0w3+k2&TmrlKPXukA7iheE} z{s_xX2|BAXW<*9*QbL+z~ zOJd!uIkyCx@h}Jrr3_OD0IC2P%nam&g@HE8wKLE`IN~IbBMCJ?y-1)~iN+YSkiDP&0JDPj0Q&toPendsr> zG=wS)(U;_sW%NaR_Um|8r7m8qA0Z z$xB2A2}2#+fjRm9l$jt4K~{onLQ!eTPLM7s_ax+?b1pcP#o__`niv zO+dQ}1?y&&c9}f3ALKPJc#1EbS<>sgu9Oium>ze*qMabYq!2LK#J7F2m8n4KL`1eR zkg08Dr=r-QGmXedmJY{*&oXky1(&;$J5?*0t;ex|^eK8A)0qekt%fBgOc}<*kR5&( z^=B$>a9E|OWoW}GU8H0eC9fg5?IA7JQEH~bS!I``ocr+B-!{|!<>~(8jM3h9?M@#I zQRZs$_LuRI7;O`1IoOQlL`uuALoPGoj^*I?5+NxJa)fQIU}C>-p}+89EbwHWHE|AD@WC;&M?2&SgD$6R$53YdtS4778W2jjYlK zh7A_d>$L(KW?Y=mu?`U`Wc2Dw^fTSHUG$Un@AnC!PV#9j&79V>+K;ej^*R3csAefW z$4xZHP0AcMX>;79&2f`9$4%NCH)(U+L~~qDbKFF8Tt{=AYAfz9scR2*HmV=;Z2Twc*HdBaZwXp{_0c?q| z3HSxGhaXbcS0+d#fa^&SUJKw(ig5K%xmAzB=DJ|cg&99)W6BsX8^m4ovDL6Rg+fak z*e7oZX5&%pNh!VVYe*Rh0I4acOPLvHq4O#$f!Ra^Z&TChPt|Y@=ptUGwG<-`x~J_u zf|`bl>{Ar|q<*qVvEhjX6d5SMMBxZ@?EDyXXl(Q(teRlN&^y`O&CF5)vGK@I^yIm~ zi7{xyG?AH^KBT2)m^s)``2;sRfM)jynwpkfV$^cbE-r@^ks6)Mt29|mIf;>LGDWgG z6k>x(V~^t(hu|ojvsYb;&aK;i&0CfzKRoX}l5iY>=Ci(Q)?T%I2^#niu4>L>AakA> zBPVz?=iClW6}F?WMfIoLWiv;6e2 z?CSE_Px0*-Q4-=&TaAH5N)}3vr1ZF7x7IBhap(QaR9!2W?p%5bLm#%L)uCh7N+ErE zIRKTYs;H>PN9a0*V+0_Rwpr~XrAN+1>eOSjg=H6*gnkQ6F|Ix*zh|aFgQ{>H=cg>< zxPGvv10#$xSIrL$Jv`pDEP=fY7s4%1bO#CvPu zFf-~)iUY3dKTl+45s#Dk!oX%(JB)TLjh1B z1g%G_t#mgZt-!e6bG_Qw8V8JO{lhO&{jI{d39Tzlw@QW5t=qp(5S|0(NM|#~+48tG zcYKHI*!Wud2p4lM^{b~aQ#eGi^pWve&NX;y9dZsog1_wo%ADjQuv-uYKQmxv&km3h zwqkY6GuY#xrB3{Q;2Wm_ylggQPZ#cmrX;wLw3z3u28!_nwy zd_zBKx$Oz3tx;QvD({!*xUnAx5skRRX5?H5BsUym;yH5IMZ0ZiQpBY$09|4=u=>2v zFYL!Gj*Dq#G9W&#(TKCcd8j%M`}j=J-h7ijDzcMC9N=OJ;vhxVwY16hlhMe?FcJER zi1c5P&sjj=JZAycu2YfG$k}mer@SeX=4%FN>MlJ*W7*O*GByMi*3K5~H6H}(r5e=x z!QT@j5cGAnA5^wY*>C6tr+?~K6SbX5$EJj1(|0S|e!4_N|Ha}m5o0Pg%i^{fk8B#_ zLrqPST9C*F8aLTUR(mmK4Tpo?(IF^T*mSVI!P*W~U3Rm{WcGc`j84{vVO4BmeT~V+ zXgqQzCOe|B5FG-Zgz4+BY~mv^W8;jG7>aBLx1}j$h7qzw3O^TO%BVsZ^P&69xS2Hh zyrnVOGcJt{MPU9s45L~MZcMiEK_;!a^j+!*8)zcS>(&MMwTq9pKW*xlHL`N`>Z8v% z&CCNFg*-EDL3wrhnYuRinnXBIpqS8F@3l-$tk{H`Cn@?SbR zHTc=Flu>ZzL%u0mm#BXvQMm2GfdyYl!dH`U)F3y%BI#?G^)+0MBzz6?zOD-vs=MT3 z!R64qG%kE?3m^xYuLxL#TR`lnv|)YZzi zB_n=*#rGB8zg+RjlAy1)!MyR7O>k6SudGTq$`;ml{Nc`-o!?o%eb!SyWxM7pzxZro z{r04qz#+=g>q~Cu%k&yqhnW7uAw9iyI;5Z7mfJMI{_}CT|}?&+qp!-J*4*)?X^_SHm-+wyo>Q8U0-G`N_8;XhU}xt z1mgzqNvc2RQfu=F`->DlIWS;Sco(?$F|+!@fJx=UgPRyPE8#S9fOZl3$(}tE(UIZ6 z(AXKsf;ePWMwE$zf#@h12$QYA&_pZ_wxK>{JS0mW-O}HvlW2=6J5{sd37GlEXAH6d zXCLP{vHIUAz!b~azc5Lh)-a!~&GfE%O3TQZp3ZHJoO)4rAg2@U;Do~!IzbH&DUFbe zGwDUvBR09m@jl2g4%RA@-kMo&&Ahknf*C8_Q9Ng_T_~wfmbA~7w7<1C(bu0SX`e57 z;=ug2qcPci%Vw=)0_=>LjYOmF-yEO6Uwy6VOID!>X*^W9r{tK?b$C6la&btP9U=cr)WzV9`Bhe`Igo!tI0$Q8<~qW>O3e^uSoY;-LO zNSLY>cZ`uMFJ&gkLh5uYK{isS+X;e^V_nKgkc-smZh~;S8iVI?im1kA0t;LThV-u zU$mKJ{D1kQAE}S9hHnyVptlYHlAV0vDb;gZ$p1-2Xs0w|=S!aHOw(UVpCd5*Wgli# zfe{2>TDH)(_%YBoA_jCVCkV>NS0V_?BZltZLmkXcl5Nzl*ES?;cg@!Bx>7PyDo*X!w3j(?xUc2W`T}O*whX2@vG|&4EBpm5wP&@0Z zy)-!Q+mLWlt zo_htwtzU!N-FhOyLEX5%l;pq6T9g-5iEUiJng(moJD^wXxS%G5HYy+-GpOG+3B!O% z(^D=SSr-+y>&u0x2uZG(DcIm&rTkX z6R=#Ty(Cd}*}CuSP=xP4iRsBsW*wo{qFUXKS;+{ZdOk8v1C+(H9_R32gSMBRyX@22QN~d=gER@&1e*CrLzZaUa z-GEG2lk~RDdD|`*U3qHW+m~?kExH9q{ReoIUw%UnodxfC@>6=;Z!eKn?{_>qg}=1# zcIe->i%7GM2B{kiaRaOgcShVyJuDj$!dI?X&Df2wW7gGh_0xEBNhOdLlE08le-vJo zM%NYoYdL{bR+w|?8P-sScBm)!Qqhhfkw##FL}*l*Fs@6hT!WA+974OUUzgr~0R8mi zx<_?UQA0GtWJ6zAf;BO73sfgIz-&@E*0E{DrlDoBa(_5F5*db(Dk=1H-`N&`ovLvt z3YEyaROuvkWGy zYr$9g>W)`-eBsfAqxyqu?xGul!Ror^ty=JIyj*qJm+)*_DD>Yj>V4qqdZ+7WDLtOw zUh<%Z7u;Uq^Y(WAmpmKv{|-KyStz8)xZ+X+`_`RNh-e?Fl$mkAVtANFB|2N3Y*g%I zpt#qL?E!PeewOnyTajrhdAm8&_@bZ8buu&3`{lJ+WBeATA@&IC&n@AgNH|LAb#EYL zBmg2z@g6Z{W-wM{ZOY0(*hOz%v=hiNn3k7%nE^2JT8&(gR~<;{lThhJdtd64R)tlH`azOO>}?$+DdtV1mn0dL-scY_39Tj5#$f4)oDkm z!MZ*|o}6phTfe=wz7FX6aLSf@kz)NM8?9rSN;!S%HejMTRQ4^}Si$;SYdZuT6O;=3 zu!k`Zm{+RfkjUN14(CJ7kly>4ahRge7q$ONIV=OrfVt0~+g1VlEmc$+w`9!Si)u|1 z2u4xEmG4?>GiNqEwwPhGhhOU3YCDD@J7n$CVBVQq=G4!HVHx9qgQVQL73|fmbQ}X= zfhd2@l^zuw4y=mxz=Zo4TgDNHR!@XD{xeFIWz0S5AGKz19?N9?fO0;oNj8BA_@ST5 zInHQdP9MFp^@&k<#?wKB?Bc3%D3jRvuI$VH%{a+qSx}Le0!lgNSI<}&c$H4hOJ{Sr zCMMBoU}K)_?0qaWu=~ity}SDlKGrL3N3KMRlY5^KQ-fOy+7V+aeZDc?OS$mqBQF&M zSZJf-`{>2}l%()e_NzYpO25&beI(d14vAv`f@6(}?w)ZDW@yA@GiMfaln&C@Y!fsf z?2EDm-(_B8vP&J6VJ68*6r>?W@}IiFR&{P!=i^+m5ga8K zpSWtTzBKwZ=lr^T3uS?1*{0dDO_xv4mpyvn=rv!(#ZS)rwj>-|QYMo%Z^2#uW#7EJ zb|Fxk3_LO$c;u~y`9SxS^P0c<(vErm_Jn6U6#5=`+ICu9KXeqm?=GC0xcF?+-8AQJ z`s(C@r{XK_H{7@Mx;EGU6_9{kRn=wHbiI6ivb=M)ymN}#Q&-LT8ot_px%S^a_13nl z8}?l*U3V!y{p5V<=0yHxI0;s*pXyogSAID@z4y(@zw>YWlT!;tfkbsXzObe6hJYkx zG8ES>Y}l0Cuy=OD-YduFH#~l^_gYQM^z-vIJ#%F}i%wK>qY!F%wF8h=^GYx7{Ay>? z(>CX6yOv*iu{Y7&mCWBUm%n3qgEP9$&pn<`)Z^e|$DDh|LRD+Bs(ZGo`$|u8Z~yGx z{`smWURj~ftlZAos-16ra=z;5lPo8o@;L;}*P6!eh=gSTxu*o{SRJKzrol$&W8B4l8^zG z52g)9?K-A0@0Bbhs)T-*`YpzmU5~n=;<0qy0re~Cdq&;WYHnYx3Z?HW*R6^b&}y_E zg=svDy0W!r6yJsiFrr5p8=DqsFDmby@k!spoq4IrrV(tH;L`5}4#@@zm?2dHZ=jE6G?IqCRdWDyTbarPaF@pxkI(osqnrzVXCI5qPpAayt{ zrh`eF;SyDdk^UB(w?wcyla{(!OWmdDRZACWg17M1@>j~I+!sH7DgP^_Z^9`GT!}VYJ{I7iB=?k`$!E5bUfCk&& zJnL_s9-Q}Yy3lhC(Ruuv=lq*5pPly~xzK|TIrEZ^`dLT)wB@Q}JAQjAaFEX4>zws> zUVidjlzcMbc@mFum~#fN``~?de$rhx>#hSMvTnNOtw?$|&e4v2-rJdQbpGrbJ+GQ| zSJCqh_Plk@+j?1?_qHb-?byX5`*v(2M(yp=-Og^K@b$)0r0*CD_SWd%DJkr3)4$VJ z2>2Ujky1|3&)I$kz5AFuJ9}v8(txs-%=6-M;id^u18$n&`40AC%DbT>Z|EgGz!U>hg#dq|gO96{ zNq(;ttR(p~Dw)jFv51v~dzz9-E^7^f$(7QPkB&`f+@N~(G$XM z)kE(pZ=gN~k;OcJmn`P_yJQZ`-z9V4^{wO)L>BXb+MkfOh*nEe>RxK07A$|4Z1H&u z2;wauh+6OyHz4I}l!wt;p}(b-yuZ}awe^y}u}a@=7Lj4^O)pF~Z^lI!Iozzk@$JoH zB93Tox=1^Ivjob>oB2$sGoT}ZfOmu--VuUaLPN7EL(ouCo>w>mgNR!sL@bdw!qJcr zZwP7Q))G|Y7X2G8oK{1RJPm38l@|apI1SE^WWTJRl z6iW*+p3E769x0|43-d@%Q~`j+)Y?h$v?zYovY1+h$VdFFjPevy>rslQ6)esvPcgMh z(7ICmm7#_DJI2$>D24b?reJ{e2eGs$QWnLC(ppE+w{l7&o)%(hQM9bPmBiN(ON*jq z-LVwDj8gR|g-BU$&S`ND09(gBhcGYewH zt(9NU8^tWrr|kV#J?v5=DzHda(jaPHbvW8+I2urrj_^fe8I42Pw4UNom0ccUw<{g& z_HHM8w)}_*M46A#9sueXt)!h$ne72YsCou(ofXgPj~Hz@WhYy5vv9E3yXy57~)1)v;t~$mYG{!2*>5UB(vZ~?YFuU>LB-~LiWjLKn&m%`0 zPW5TVT|0SUCjn4$P_uKcl@vW0(;((dgUG$bFclUy6+@`5F*8mTVfnH+Rg@_g=1v5k zKGyeER710n6|V|g;^tSH`NntNTaRt)oTHvat$NQP7qU^ zWContie5?MR0*l7vM3NO7q%kk1m!Nmmqvlqh%PHejFNI<8conQPf=o^q=u3;&BH#L z2jZeM57_G7cU-9AhZ7e{dXBnsj*>|v%uSmPeAJLlO!2T>0Aw>m-XAc|-b<76NvdJl zq!8<1lhO=et&_5104C{E^nvq~+|M*TLDSI98gc(&mx>=s*d^%&>eQzx`DaLSgCa4d zk6gL(($JzI_0t?&pgNY#0m%hy4v4C*VGdRgb|n1B9jcV3E=LudMdI#d zCNtwzusF>uY?V{0qHi$8a~DBh)IRwof?lQMA|<;hVJhfL1Tlj520^PyuVkaIO{bND z@*rVnPq;&;OJ`36sX;5$pgfeP2Cbl=JP5^upcNF92cdWnv?3=Ij{$ALmvTklESEnn z`u-_OsbnoXIE7rEJ5yP4c0NHpQH5Uwt|%%0sWeW~1#MLxQoJ2$n(AI{j9(;_`8QOO zt#+(#cF`f++Q#HflvL4|?b9-j3jR5|_yVd~(z;%Vm>s<9S?K6NC5*6eF=NdKsOhlb z2p1v!0cu&b!&B5@m{C2n4!=wv_zjv|n>&-tVf@qQpplw3aS@iCXZ-%ewd=@LZxP z{UYkm#O4PwrI`^x5C@*eVUhlPE&ZLL{=T)WzYh+Fr?WatfwCR|4rg{)3wa{_$F+3$ z#+dx#zWQ~JQlIBdda*;1_qa2FYXX(q|PQu?d4bm{B##Vb@Yiw+@!zD9rd7YjuC zI@S3OCEr96qsqW#Ig$Dne#i~WD7R|8q`EyQF*{fj-=&&Z6R{Aq=%BQ;Q1jYiZAgDj zb*x61{{{o1MZLi#(vOb)=EUBsC>h+K35__@PTNDHV% zdJhSwZc5|{=^Aq6ZOf?JngdV#h)D8(r@FsS$#qJ8NXh>}qL_1X>yQACy}+C|<@z;# zkrB8VP|*)Q47Tu3I@rSX2N-NY`hXB!ho~+0NY+y_%xLgFe-@Szv96+*Ay{k=40ZolvYk^sv7u*#+ zHT=i$7?R%DIUaZYV)Zcw(0=fr+iyTb*zR+ z-9V%aA8wqt8I7IOXUK=UlUx*Wt0?9j-~3=Q$hqnDZ!ZbN~JWi6-YAuw3&^b99Tv$Wbc-t{wd^G7hns6Mwj{lOW?6tCFano#Z z)AW}4;*O-RBjM;kz>@r4@dv(+pT=rY^$WX=yF0|U&EoD>!`qf>f}6zM8x3!-XZagN zvD(req|qn)?&S+u+nzqdM*kP(V=Qf^)@-HZ z5hRKhKp99fY?W)54de>`zN}+AsFs~bvW8J%eydt7Xa-y4qATs9x>g&`Fosj}lzohO z%2LWaWeI>LoO#MJn0v}HkbBA!$mfA(TD^#Gqgvm=qq&;Pa*o=yOMQUr)cR2K<`(Qn$dCjJsSB_Pvr8_i#W>t(hRl8~N}Rq1Ccl;JF7`A72FeM@zmxr^8CQ(0cS)oSbEuv14PG;TYFJHOzy zYhzx!wmx+j)knCi%Bg-^j@Pd3QCr$;SLz1QY|NK>h<2vEYlyl@O_WEDsX1P;(jm%g zqaw^9HU$X(1vW?zp_l89g_7!INz-ge)0Fvr zf7PY>ukQPkN4_?cSidLf@1FB_FHlIY9kaDN-a0*BdtmD5LS09)ZqIDpo+~@%>pt>I z?{)fpV7BhSyXN`2zE^sedmY`?J@(^kbC2!1Z}-?9_$R?Vwx^EVV<|0lQ`%PA<0bc4 zz;KVH6z;LOeY0{;0JnDqdyiZHu1loUYwxKxzFTgf{3?;)YAX6}o&8|G{@u39gKqtQ zb{hd_$wnS50x(o@X)A!c92t>4Ri?2)mV2z!Pb+IRS?Q1P9q9=wnI-s>)`(W~izM=# z##++$jwqUY{c`)2VkfD~G<5uB^fSf2_c$1i#_;z`Icb@R}MzPy%c)NYKfFECP7xCch9i@QZaS{BETO>HIU~jAboppuX zUHW&r3ITt^CsLYUxVK6FjV2?(t$LJ~!ZcSWC<)?AD|=i@MBb!cJeNiZic`X@g@*|m zr3b%C$!91bORfjxWy$PBDIo`>*vF8Nm*pdO^Rn#Rs`|&Iy)2vCa=a|d$jh<;hExyB z%aWUEk*6djr9!eW%zrXoQO|I5jY$J0R?G2B|oC%DHKD9_!C1Ch?pRo5SIe6bhw=} zv0%Omn5&Ov{M>Mu{(oVKR1sX%Widhw;}8^j~y73$bd{DVOnxfvV{_g6vbVO zh^k5?Wk~N+LXi@3-v+Yk+l?D%aWg3#kMTQ6y;Z9NwE?$R%)xUSb3w$$U|b*=sPD4h@^_JT(oIyUgQ&hK`K*VpWd#`34^(+7P@x7HH2~D$RIow~ zF=_~?Vb|C&qc#Aw(M4@gJx55Ssc`zWg_NGRGC4z;&FEC4so6zkCPx)jpULVeD?UD| zj4xWV@IIBz=!Rv+B7z;#3?pZ0IL(AdPuy5cK-)4wHN(v3s5PcrT3WNTl*1crz5GGg zd>1+zaA=BH0&q#34qF~ou)M0MdQ`9K=@*d?ljMw``Z`Ef&NgR7OPcbjj1NF*KFgOP zmS1IDK$<11AuBLRUJ|SzoGon2@qFerN^`XE*{hnV!vQqYWQWtTSp`nkNA;{`>1jpB zQD!U{jAw6Yi>8vw8J3nYOvQ2zq|B91q}-a-4Mn@DWwP4!tR7YJGl8XxW)8+h70pO1)~v2j?Uq7yV3=X*v7jwG-$>X}N}D(J zlmN%X9~K#YpcTSqFLaiGJJaI8ZwN^P?I5`-%nGVd=AWbjr&PJ$3tR~NM}*Cxx?R(R7h(is8&A*G?KZn-!HDA*(_n z;c>)lI=D1>thev~I7r)JK#g9Nk1K5A)ZO%| zUjSY5Q1pGY5voEkV_1&9Gy@?b&=zR8D)4RMe&`;ky70wbs8BMZG$L%UdgU$NR<{I0 zSV6u54;wZop@Ul*=k%KTc=;*afd;VinDL5Ks#A}EONPUUg~OL8CdL()sVbS7s$s_x zt0I$z9pXchXw9nv-49E#WA^Z4D)4OYsYt^$_%M#_hH8nFe5CKx{jvLF_r{j3J0INs z;Biy$T2pUPzWC6Bs>*`0N;yjS!=ysP@G<&b;y8laa>U`2E`T_&UOB?s>RwOx?QbQ=A&uK-bix$5CU z*riLu1s@9u!?w^{5TlAML?W{7)#weAYpGAm=XE1Z6G*K=+3e#g8N%cI1k#5(*NlayK!{8;d-gaPR96UCNj zvAJ(qS`Rhd8NM^TJiH!mxpU?Am6h}Ny!RVc8y@$@*Lvf{Jrj^YYx{-s| z{$w(pOTn?3LzN+rgNwEnISZq>SUWghOmk96&9Z3b`n;u^FtMTRnp1i-)K7{Ps)KnMs&76d8=_Z|OJN?3VyB&GbmaI`j7DE!xGL=>zQ!#PedMMGx+T_q zDx-aFGAm{0W=p4F)k*>L#3F2-gxZx@MR{U1C8;7LfS#Jv$)|cDeUeb=>~KQ2Zsq8& zc)AoXKlNqxn|ijK9Vxw#6&a8cVy-v?>CZf*E>UG9@doBFx$Hc?h$_03ibY~I5ylI9 zf(;6r3ftW7nM=P2n~_+Qu_cz16(_-6W0f?T1wVvhb?0xPd)np3D zBNIi2@ko+_8(0;OohxDc@Ctk6UeN8g%3iRc5+@;B7bXStJCl%kohy%p6L<=zE>ay5 zOGQ)Mn^0zGZVr+^g`Ej9?CP0fg{JaI&g~%uw2J9Adh=D$_N1~V9mI_@o8_^`ZpIap zY`G-kmwm|n!C3w4ep~><(h}M5k>fuBI$oVS>U6Ey{#oO+F-_dtZMdHE)T) zZ`AV^*5h+<i?q^mINu9*4S2;N?Ke5c9*j(JNEVgFX19JTHAg1*xim|IPyPeEsf*mE@8EkwlW!EHGm&= zw6%LTZN-r(_*Dw}Iw->Cdr;S4+>t8A?FZCf#+zXp#c3fv>`TZ29`lh&1+ zS~df>0vJH}k^p*xte3>gf<%oGqWAOsaJ4r2zwlLLa#Q&ppjG(Z4~m( zsPkH@N}NywxbtKccXCt%ILr@|69Cpap=GHJJ2}Kv%+6gX6SvMY7yNELzTCINu{q9U zN5-}4aAr~Nd?cS;-+%PuCVn);GWf%S$79m`At=-K0LpxpaA*RSMUYs*Goln{@G>r} zyn*mCE>!md<5chXbAjBwiv*9>qwIqAWiFAC32fpKtmJL#PiCjsf5gYRO& zT(+7C8cMw|E3vi40mlkK^sCG(Dg|*!DR`7V1&|J!HMeAuAr!j-a!fO4B=fTrZa2Zc z@ve%ZHB`qkb1&Z?^*BhcfrVH{iuU39jq$Y6dH)tHXrg>T&zgbtD+`ai&a8EvDIPxi z;ME5UkI#**of|8@m?*aXV%h(%Q2TngZKZAHt(7aqj>td4k>yMOZfXVEdi$aEj_xhL z7jsN+ImZNbU|tC0Y$UvErpdh+dRdOm;@Eo=D;C1hThbSxazikta#)Svi=RPNg<#wv zKiBgV9r9P`u}gc(z$;z_UU30b&DZj^2nxosRMumvMseX3{3@ladjh*Ktcm+`)wsX= z-L~qtd@PpxL2G2YX|fV2S;#3|y2viycL}3P@0^y!yI6?6l%onjW*LLUTLnX_gUjre zY7FLx!Avlm@l%A}Dd0|_Ih!%9w;}3IIboN<8nhnn8@@9DAFN|WP5jNnIu)lOOM@7H z2g~ty5af3-it%?4Tm|0xV$X@cgWPFgV8T)pe^I=<#NRe|{GAYA5*!C{1I+#)+;zqv zAk{}@mJ!#+WMocFOhy8Se3<9&c<0->ofAAHGcFv1X*-4F*n0Qr$K39H;Bj_+8&6X;Jguzc{zb4SI{CbArNZ7*_owrFZKm)Yi!TG*P+gg zW}|9;M9oSQCEcA=s-|cg%@AouinRTapKY}x&5!;tFtQu(|jrP})kj(7l$7;Xt z+?Q>fSG7m-xu4JTJLi1wbGph(T?EqjH@_GDyPc3f;U7KORDjuTV+grS0z@VkNPrn( zhApzC31Q2KRkqTvO}4?;I$|Go$d2J6xoFraJBN$q;wDn3wsgrZXki<14VTF7CK9mA zrSQLKqLIW7lR(2cMy?B3S_wayBB6!`22OFuul1>ETo&E-&zs zAhD7xaxyA(hx{J-6hHXNuCqK3zO=B zq!fq9%SkbIn*e4G*euvs3FmB4BE1XoMZR}d6u4M#gumD;s@n*tW`RA4l)Mm+^@vG0 zMrbaH;jG$_Uc6w?f{qOwrazHV+@X-Rr+g?RdST`|_(}DUT_%4erFPdt%+lRQx9E3h zlK$U@dO|k{0ZdN#!DiUE*8sRoX0VK=3EYaj)SO*!%d3RHP+z2%&fv&2^=pTrf3xOz z!59HX@1uW%WTHeL*Zj@^JE=);*AHvL1cz$5^z8|e2ex53ouN{co$_gjl~W1WU6<=P zP~)JBg_KJOgRFl3v_CMZ+JJUsr{E8(Qsa@SV=zpBl882v(NkXFWaO1dG7NmV0|y}{ z$y^MpmIQf$P3lzL&5p-od^Zbxd6A1I5zld-L$OG*;(&@!d`_{wmjse6hEZ8=AyX+UIKRUfu z*>>xPnabXbd!JddJe8^J%(%NY+_mfO##MLYS`#+dF0y%CTf|oE5-VY_@5PQbWXIcf z(TxZfaq2$>}^nJf!+qEXdU3wOmcct z6^pgdyC!dL+@rkI3`!OS+d&OOiUDpIO$9K(eauUF7$E7;RG>E=b6(2p4g0002?Nqg z=$i8Pv)ZiHp=XX*tG6(}1#m>kn3wWKY}BhKSRFFI1x9Q!Yjr4l#F^Lh(jb^M{n|+w zCdm|@B1khZnex+2hh74+zDZBJOD_o$UBVe7f$#@fEYRWt>CW1lG5ZXdL261cGrc+- zG-PbTGPB<(wdnJ-l9@iE)R;YCEi_}o7PQXjgp0I#o8orR=x@_U1vUJ4poXKgen77e z81+FL7Dj;SV3%wcnCz9z6lf1~0guqOxvO^O_fFWe_;ygA+5CbIGx_?6S*}Co8E5UG zU0;`e&ai9dC6^H{sgGoSVFwCO#|2lwo+VGLGede0z~Mc5j)l&d9Qqi}@mVu%0mG8RUo zp9KR)0$&I%Y1Me6eog{C5iq~O;@dei*w5WAYFbGNJ}huic7cmUr~{Mh^AxZK4Lf9z zodVkr|KfzYbChRa=39U}aZ#6vW~8}Lzv~qEH^tzi#g{@cE~b>Jpb!J+MvzmAE2Q~I zq0l%uAI?SYgODU#;(b2F3YMLS3Kr}n{sURDqRHfhjGyO4NwLpG;~bca^dl*@*?2sv zI5FqB7*x-uz-Ln&vqFp$Q;IVJ8;HJ%QmjMJ2SLS-Is8c`g@|ICo*sEiu_G)gMGKt7 z$$&*GV4<3#c7%|l6mX-m3{Pswp~)$tX(XZrrC6hUOhj`{tir#x7+AK7Eh>PKYsVZB z5W=$J#vBNM6X7@&yPQl!dBs6L;6@6PZbTz2C1=A?PLf2lvXr_U91@xv9incuuUJGI z06J0kk0OZ1GZ@&^DOGILO)UkiLWo%iTPRj2RGjbgDfO?5TIUp&&=hY+Hv*GtnWB&r zG3$h%^iLo=E|aZV;@D~RygVzt<7)ZP8H%j+>+L|eCz_P>F58pVNcC%Ra zTBfuK%Lc9wEGO?yuX#_T-6yc3EmPX~oW?f}r`?U%u4BEnYqhp3Q`&{Ck6b@;<5=3= zOlv;t`J^XPx);k2T|abVFzs%jBY)=m#Fr^;%`SiJB&C(tMsEIe-Q9i9-M!(dS@*Q9 zdfL`H4rM%t9`qf)JF?z)>R#WePpg-GnVRmEx4*6F{pQ4#Gn)Ih9IrG)j-SAp#|DDNiTL-?HT5UPAS~Z&X zjNUKxek@nBfp;(A2o0EWyO02D+i%p`(^2aJ0OnD`O8i1wv#A zdWo$;>jcWSyp*ubpkSaWXc)ZbE83xClvRzrvGSP`wFQ9~X^^RsiiRH`)3XNmvs!zh8gb;xUh#tL& z&#{JLbL9@oQX1%HMIKc!1_{|YfsaDS5QqZih(*{i1PVb}fa=PP$7Iovs)GxSoTHO9 zd5!)KQWWEwqIb+Dg=jz%Lx=`ul+`{20CZF}sc!@^fuhBG z?eKEhdP(oSlHQHZAFOu{t#%HrcMh+14u9KuX4TVv&9%|6cfH}jYQuqRuFc*zzpTyl zo=tn$jHmmNopg;dpgX(`8x{VQpR6pV4~Ns9$hOtuRmI+8mlk=tS+`m~knT8yxpTne zXq{`3vw)-FZh<2B%*d`SU=KKYt-u9EG@L|rJT)>Dr)~_W!6XbTDK-qVy)dqH9hyq$ zrlSyY+s`l$X}>& z%osDsWH}5tdR__=lrVS);j>Z`JODQflFW<1)nSMn#urWIMpGDg9WCTJxMe^p(M16@ zN8xHg0+SLsEq;*~MYwIC><%G#E*X{0fiwXDwi>-s$Qe<>U?vxd=uAL^sv0JgE@4VD z6pJM^2$*Ypi{>Kq(^MH9Z7#h;?NZ19hXue&v~Vumpr|WVDncqAS)4TPvr-0Cs`V-J z+N8vHV1I90R08`Ez!IKKyBc;CF91w4N;^I955laK#8b6a)tlaba=rZ2z4B8VgGbif zZENm>8^=f1ob0-@Z`Ij%XC&i1wvz!g0%EpVI@YrpfL?8=TG%9hs&Ow>@3`4ue@X+* zFXVt_nAA|iCHBgP1hQp$3qR?7!}PC-Gc=}2!`Z%_fWI$G^bt1C&&E;m(nL{S0sPJO zSyi&X^vP*nekQr&*>|(T94IE0G5E;KP+&A3f1gbz@>R=;JeJBCSB>Vgc+V#;2@)_D zB_6mNQlGl7X*@2sEY%WTYx5F^ZN=GUo9nm>|PLJFwRn2v1-Sn#>j;^BArf)^;)m z?tU1qCw0-Fd+!)dpkV<`02%d~hStR&$_Q}S7r{1xt4~=>v57dCDXIYxUf{#;t9P}z z!+`nWn&m;Nf~WxjiYCu27k(e*Cyu6zO;cL3(fGU&ei`!9O)wy91Lp#kP9fokQrZL>@ZOgtir!^7d^HEax%-$HQW( z`ht!J7=Yi?@$hSoNB{Z#GdZqH`0 zYz~2uC0X@6fH{-0W&}Yf%`|-Ij4DHG?-^Jr3@;u;A^tra6FRS{9V*>63+n@ixZG#yHg^Dv8gZ;0|-rG zhH+AH3Np=i65$Smh|`z_F*^^LL_MQ!z*@aJuh_XTF$(Rdj6k~%9Hj#V9i{uvaFo0a zYu1l10#T^!1L)VOhEacn@Cou-rvB9C!!B`!D%(YeoLY zNkIgKi&Scmh^gpq!|R}tMf9FkueKJD%6hFpA12W35maoKQIsE))ue0BWXeX<&e5F` z_odb+qSqzHF$+VMJ>x+v#OyB!{1~%J$Z}rIyy6`2L;-bC_AEm=FlPaAXrx!1 zMGQgD!am3ULQU2rx@N_hUUicE?Lr+-dCLN$K4%W91fNH8=8=HiK~*<$q`IDNH8O#` zMj6hLGncPODH}dM85;iK#JQ>AlanKpD%sGJq#I3^jqx}qA3=&+1iMpI5lh4oY(>D!gXKtrsuXe_0Z9+<{EmtL0A+ZV(r1uuSs8|T zXt6Q2CvL*D{)v?Tk(7K#`ZA<%%jRI}{%G6%pSG_1yK63wKXDSK>CdG1&(>W}Z17C% zNh7|EdGaF*#898Sj`4~o_29=nsRfJtFP&i5JbIV0*v~SLoX^eO&JxRqMgOyvEFwi97n|Jo=Up_$6vXJtmJEJ@ld(->oNxN{{!~|S%d%p literal 0 HcmV?d00001 diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/middleware.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/middleware.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3ceb811c54d633a6de37e745bc8850f538034a89 GIT binary patch literal 13459 zcmd^GeNY@ncJJBQZ(u>Nu!s*a%cqe9NCH_h$XG}qA)mD37L2U3(AH`hVC`iW_YAg# zQ$Au}T)IkP>zu0`PA)O3+(qK*E|x2GclzV5%Br(nPF*Us80i*Ik~&q{sg&{;WVw^2 z{FC>(XFs)I$#$GdrHk$E>FMt2e%h!sIZeF65ux9p8fq|aI3lVdOO2|Lr6$z`sd&WPZ&5A%R@KVt8IRcd?W(;$Pt9Y` zrX%_N1!{rbheLIY7zef_KATG2WTdDAzKucMG?F*s7^vq@>2a$tVuv@4>18~>y&_fC zZb*Mpog4I)v#+f7r6UC+&XLlr(y~(GCSJ3Pcr7EA4v~Ldb+J+_l-klt%UP)%O7lis z$-0|aX+D$|jFcx!D_E%mN( z{Jfval5$Q_Q{r2u;OVp zXkyQSgPOyCMp3ChpiatAe-w&sJo?xCb4J%S8_zVokADDpB?NTT*KF%^! zR_Qr>3HOg4f^`y+*Ie zYi<+k$b#h-uDNE>$9cD4LRF{EwtD%nHCtFdtNH@47FrP_nFpTxVTvJ{YGxSCG!5T% zB--%VEf82UGtSNwoI{&(?X}iY7nX` zG?4bzmncqKhN*K}zR#y`F4^bPs?tYWn6s$UT?-Pyy^n>N>~ z37+FnnFREGhIxX7dYO=dxC1h^qy`A=73#=tF(@<}W`517BKZ?buCF*!h!t|;z|QHR z<4UJpf}j(pEnd}042 zuAJTHg8@v3Fb`|`?6g0mzbW+j#)4E)fnDTq1YTQwzR^g)=cCvit%67^_4yQ(F9Dxl zRcY|dv??o50jELBF~Sj3TOulhOuQ1JSIDZtXtJ*46SH&8fXgl>a=aZj3BWHIkOUC! zkvuK;DR~@&nS$r%S%T;Pi`=34Kt;Z_ke}H8(h89{X(EPh!dJx@;ZimW)Cma}Dtt+C zCAG>-nr1NlZfsBw(JaZu^!qcIo~?NX)1&-?B`=7hXyptK%>Le2#Ow(r_&>?!6yZ$< zXX`ALMO4n!s7)0MqXpw>&Ly}w9*Xico8_9Y45JpzG+@N|5sPy3)x+>6O{4d6zVcdA z8a*VaCa)3ny9xC>=yfybbqnZqn=Xrva&?(f(KGwF*i4g->V#iKMXDraE-LPXh6a7k z6&L`I)(jPEgyF%45aJRW=lUwP%>e4v#J0JXhYDP#Ox9^4pdPldHKQjImN(qlb!^=C z%qL@qABKU%aS?Hc3#Q$x7|kDC!Q`EK_QdzKj_#l)2T(8#TYMjDc#0KbG>~3PFLje) zA%UQWNjO=g-~yz$jMKDRG~f@mHNa03ZLQHneczoaB7Hg$C`n#~v2yq@Oa_v#Q<;JER(dhwwqaoaH(yrpil;1z zBB)_aj(2|!}%_uSp&l>>6{IXNXov^)eQ(~2(;8I>2T6nRZE zjml@H$7vtrX*))Tu+%sj45$=0I{g|%3r5Z~N$90n6QYTMC;(v+SAY!uRIkH8TxPS4 z`*+YQBC!=KAhFl-zMU7dZeFx*Ue2$&SyVpP^k(ZDt;P@dqi&3lUbG$~?4Bzl1`gZs5u;xCDJX4T zAs-nJ-8O<4y=?}TX8g_@V6_1Jl0j!#A)ckZX;b!Qj3G4%D!sTI7b3h4_41Ql+1JS+M|05VZ3Q@X_VN0%US#O+NyRb3t z$L5GkGL-!T+taie`@x;H4pya4!nBT`*kBq|vGjaUosi_S;Ln5Npg$y?@duuXjEyn3&(lE_+<~p0 z3}J%M4A@qPKg1@rzU6?mgjYO4Jl|`!z$^IwMT0u;YR)^KpvWn5o z(()A(q$_4py?w=kIV;(`WyOX$JFz=f^B~9NtiHz319z9Rc*5QewFe}Dr$j~J; z=}+TumQV$bH&}baqyUx(qJ9=m>`1dp1R$Gu>nHHi(~V!DDB*AY9-eRA#^_Usnnmiz zSGeuyC`8RV;>s*d@G*CJadlFDFIl)EVI*-wU%GLlT0S}k75*H4NlmlW)U-+C7uET@&LLgU8n1%r-ki_3XmqOiXw7om5?c8<-Hb#kYQ1nPVCRs>t0Zu z;{e~P$gnAwB?MzZeVr8^fw7LVeKTyDhV!O6GGu}opks*zXjPoZr_$4gVdHjWSUqfq z9umQ8NSujGS%xjA4cl=g^l%DsBMSp%iCijm!)aG`i$q`P6q~Z1LMXz*02mGZ zcH+*MG7p)j#G#zl?GVXjdE)*Uhuu&`POiJ_Mq!UvkqJ@_^PMt3W`+^Dc`hgfNtakn zf&$oginFb~x5_aP{3Z&ID&WGQObB)sEL!oFq43Ao&zqh$fRbO4hPZu#mp>v3_C}}qgnh47$U)lW>P}3Jf+!# zN-zu-E*x2DRw+3{ZC!M2z3ji@`pMHbT#sDsSSs0nzIVCWJ>T@&lVj1b@#sV-HgR@w;%s#MT=d*bwCII3(NN%6Gn0~v@3p+%GVfR_Zj0r& zeVE_2`Y0)HU+Wb}e%Xca59CYXi{V(_?ho^JFPFHZ`R-*$)qH)_+W4P+0;%fwbghgy zH^)jE7E2nyk}s%OcGq5TFbaIn^BvFS`qThcg-zA;k9}L<{J+*!Na=+ z!l6R*yN(vjcM0&~-R{yu`KI?uS`S%F?+a!qf8Sz)lK1nCkO%dQN;##YyHT`j;^Dp_ zO&oY)NHg~L_4I0{A#cyYKF!?QceHP)PqQ2!7&>y?GYHxr^c6{P*v-e9?dy64G}{=B z%*b#mt5Ov|xv`hPhgC3o1%3+p7SKx|ubROh@?qVHrOi)9jb*oufO2j-L8UT%%keTc zLiS7sU2zI=j-rxh*uTQh;x9Jx>U>CS4$W|x6M-v?SMC~dgs zy8(UO4bi&2==yHBI>a71s7VJYn1}6Qi=*D3CFx)j9oo#D06wNag|`XcHRkX2D{!w{ z7WrX-91Y^&;uiLa<%;@O3%>-+*KEl;HPdX&GMS1{b!HPkg=a)N$gW;+I^!%i#EGv# zg@1sb!tIjV;MQ(LUsvPJOkb-n@Hmq1MXC?OXRU72)#fnDg;$_5&vykx{{Kf=c zbdh1>u%X?62RI>Xs3>9_Gy;mq>9sgb5_kZxg_wZ~#bGha51sLzd3T+lh0RP08}D}X zot5EQMebv9Zoc7x`8arN!wFrTx&2Y(fK_|{w<+}X(F#*6;6o0euR>3nDHtA=&(brH z=POf$IW(Ks@fB&ia&myo=heC|6oG31N_PfJM4`JR;CI+6R|!PR)w@Sdb6N< z)dbJ?@&>}(KO@8xM>x9A;3s||Z5aV}4#Q%$8xu=8Wf+E2E=F+i?w*5G_5;2B64%I- zU8KpnlmG^Hit3CYnKZ{;#Aq%-W}_P{>Bnm#xacXKD%{_W*B-w=x(3*MeEMv1)B6T| zRYAavBFIwU5ms3||L6)!ubk%3DdvZ&Ea;RL;u<{e)0t&3&9oXcCSdm7Uw{b%2Ygjz z(3Ij zK{$iaFCz7QvGvruVM~cn`cs6E%O&OCKR92wRJG%J$&Q=ut(Uf3+;T-+a(BckJEG1G zQ231hE{SMTFQKeu%j)f+Nrr@X=8^@&m`m*T)?4HY72NAxs>Tj7w>VlSc*a#d6S+**X z%}w*_rEgyR=2c;-yfaqZdEW9-X%)CSOB-T^4N+^usz^$@J}PXuqo5W2EqAx@L!s07 zw}supPlbKPpP9OaUkKd-8#dfQS{E5|B={E2r5+=c)Qpe0G4jXwh|#a$mvnF*`W>7X zHQ;#>*P*-tRtvx{8P>yopWHY0D?x8^7WSCw$^repGUUe)(_JTne3^s0U&JS6Hskvt z{RZE^0|9dYzC9f9^?m`s$94mK9s9?%(eEg5haYp?XOTJy^KeM?yBOhS%W(Ljyb?bL zen`6&g`6~#&yn2&fx4eT!~cL^8mN;H)JZz1lMvKN2WSv)Gu6q5fM?pkYX38&jP9mHY42h z`;4<>12hCi&1a*b&q6;BigsYf3b(++MCcDNx&)Dug-Mv!(|W%UF?Be?=y({u@o6>~ zsjPpq`;G3)bxW14QD-Z{iq^}KtJCj1`^$4nHAeu3xEklDZ@5}wu8u`l$Cbe)*WqZ< zVXldg5$KO`&5@h%4n{R}Ad3p!BXpGAm3@d`>77@(+Lv+r+a-~cAX zkcaO;_vt90#69o4RCBTBihHTJ10X31NuDSmna~ORB zzoh2wOKNT|D0weft$7Q(KY~}3$EM*vH(XJss3hoFj5;xT4kAtTp9xTuo)no=D-1+J z_%9LoPYDc64{3pEV}QOzJTRL7$FU`y!6Yl=pkiy zE7`RbcG${XQw)``31-b)v+m<}th?#2p)GD@<)0v05d}f`h&=pnr1oRt_-Fhp_${gX zEou8#QvNZ?ziBIq*(yG?Rm|;OvenO;QFm0$J@Mwq8zXbaFQ2?J{qq;!e(^@jp=i~i z8zqOMq-eRgVy^GaV{aUrd+c)GTb>0^w6gO?ao23&vZEyGte=lWox5*19-hrxGdqQX z3xPEP$yzJs2lf0Gp?uD_Mj%-`AmD>1@z5zWU5Km^NN&%-8^Bo*-Ns5%9I{-C{WlG@ BVn_f0 literal 0 HcmV?d00001 diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/option.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/option.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..460fa966c74f1dc9aa87893991ae3392e51f7d31 GIT binary patch literal 15584 zcmcIrYiu0Xb)MN5m%B?Y$z75XNs&YGA+7k(!?NW_vLlCs9Re=+c*J=q9}^`PyZAJx+aZ~o~nS7x(JH)2MLN$ z(f;Xo?w!{@NXm9{LEgD@@16TN=iKwUX9w!*0s_*+KmTK9xknKGonFl3;{|c^zfqVM z;({i;B*ew@;+RWwby3-M-aY2gJY!zXJLc1TV>Mb$mvF^%z!)K2BM2ST&wbuMR;$&r zZ#?G%V?iy5el^`f+9wAq3zO(%2dY$kV2n#wDZB2Q)Il$I=Hq*OjFOV{L_tR$)Pa3FALI-^S0 z^XZwaEESae>zTByQlTI#_9*!&DL$iW2ULkqa{AJfY#vq0ZNpoFDK$&@ye%u25(voo?f9Egc}FqzBcHMS}> z=F#geef`4O#K_p$k@52rqq_U4+^k+RN(;}V^qNc9<7867XVFnv8_6s3#niNXJvm0( zmZ?6NLS;f_wYqpIWdmLi3|xtulc=2+t_Ye4N^!ju(cE!S^Tb_%t((Et8~32>Wn~}7 zG%MG{8BST*@4#JcJfsEUb-+ixUY~g0+&L|G?q?U}9N;5oIfe)^7HAAW5Huagav&5i z;+Rt8f+DLJNtLu|SyBNpS-LSTE3%Z7rZRFiE!{|}5 z^1u&aNq(b{&7?9~c2-hljp`@zIr%VQYB-Q0N;jyTK@Bu3Zgw!JO$sl$9{+toNTaSp zcut%a<6_)(SnLt*xc`$NtosyMn^AJQTh)|10&wEPp06i0l}6mJKYw^Se_cL&RmmiC zhtu-whwYs^ibDlPT|>$YfQRm?l5(^r%<4R&{o%r_9!ew(N|F-^y}c9(!_G!JjB12! z=7Au3+czj%>|u{hR10kTRG>tQ##U=LiN_FY!A3>B*21yUhr8 za&%&;%D$C7XkpVR42IOj*lbNA0c>NhEfsrZ^)$EAN!jP$7J|ke0J9@ zOX%v@ax?9Y<>$32H#AUQAFyY9{7^eYN|%iy5&QHe-!C(QStT_u#w3qoYhcdRptN-Q3SUylk#pm=rHt{Y?2shhie;(gPValLK?grDP?D@9wyic07~;WGa2t zZxD zc{Jk)r}HT=ErO)dO&MuN$`Q&=AOo&&$RVjyiKM0}nX5CJtfD_rAD^Fq#Wu(?dQ*u$ zzbS0EJYN4+2z++SXJpM(I{E+^2P_|fXeNb!D-l?c#7!UQ&mpsixy-)eeFW0Sl-pTR z^IfU2Ww)h|`LER4QrxNypw^P-R&5ZqmR4rfhEQwiXI5>ULr<%B=xJexp4JeLVtvg_ zXK0MKpxnyJP4PV_?`7pkyba}cR*uFyP~OMN&GAl@yI8p;E@`dtZV=Iay&-O?c3fFV z{u1E1z_m9^RbWb$w4DxTt8k`{k;*1jRg!b5WI>(DLc!p=hBmFp&=K>hnz;&Pk*OZ) z$-t0g$-tA+xvCln`jA%PY_8NhNaaAsi%<#eX3_0wXupM`)>HV)ex zSO0cd;_+iK)&qO}oQheD3r^k3z&p41lJq9S3m&E1cPEyp?<!bi4OLmbz+fZQKmDP}SL^b|N??vGmA+3--FzF+iK`H$Te}74ETEB(bNf&0QwPp-l zCg`(t!EcuAC;HYndN2=w-AX0&@H={hN?VN{&RIx!mL=PAA9k55i~Hg=Ck$A|{U;3K z?GYSvZL?l;1kg$C++)mkC1dTvY&r>BCM8WCgEqWb2Rr+gv{Ni?Fz_>_nXUNcksV1hm3} zvB89c;1h}A)7g9~nN^=GVHeL~6)I_l#4g;mog0)bJ+e-Z;=md9Y9CbeW69d^X}q2m zom$qUa8WdsQHunDK9D5%$wd)l;?Tnwe}OVKjB#Qv1{2+#%Bq~X%yR=S4BnGT19b_` z+4XaubK_;>u)TL-=KnFY+oi~AxNkY!x7ONmEA&aE<<`viP8LJ^?ERaJ%G$q#uOAZO zdWf%{b5i93zT}nz4Ym`W6}HxBXghi@=RSY7N(B=s+rP zm1Sp#Cm=0}Ec8%DO<0Z^bE_7gw8bZ_sz#pI7# z7oPc~egD$QmG>z055p^w z3&qd{`^cKCg^nKBJGjP022a=A;5P7dm^`+RctSagG0Wkn*8oyS&;r-^FJt9p!n!qT+XB z#qhvtc(fQE{lN1#!Jh^{JYGC9TJ(>80lXNtCpU%srscUS|M){%9yyQ*Q9<(2BfIqm zd)TW%J4>Xdi>TyRErED4qsqqDlXNY1R#EcGN$EV;nlejQ zHMpBercyFoGi*w_^>N&;4F~29jIf)J(q3@;IHqIQB)|pZZvlHA&I-%9;8y?`y`|y= zv+2KyHkI?~^{5bPSPgdIuNdsO+tg9qcW$L=v=|y)3rC187X4r3R>Mg;N-d_{m1@3E zYcr{)j;IFNA`UqoJ5bGc@!7ARYPO{}%fw{#=ELM=34Fml_b1Qih>#qzZ4h^abg{;0 z0(8cy0hFYGgs2j}GI$>H%C1C79d;l)j9pEd8iWjj>of>%hA*+4&gS-(wlnhQBgQ<8 z1eIBAS$T~zCX34mQ1|hX_0|d+zrS5pNMKC#mDWHI#QS}^?9>9+JCwd*jqf^4m-#l^Bns!?`Q9)@^T5!BQg0BhLM}g2ISbaT=47lCdv~&pidbn=?71 z<)rj9-?~AG;8VuO<*befU{|7~$?0m_7#+a@E@cLLWfX!kyGNQwMTrNnmJk@eT$!MlYN$)*`L%oO=6IG1R#hZds_eIfSVJJS;)5D>}o$qI<|3(*5vxWRvih zb7T7q=H8VqKA_E+PLZH@h$vxb(NA^8(3mAI8YpVg1uJKAW;URL9+XH zr9li2w;ZQDCyT?kluSCZ1Sm%4ZoJDx>nzz`ShF`{X@7k#lf|ALLQ}e$q_`KvMhBGr&x}?m=M0c;sG8e~HiH|ftQ)*7xQV8Zb0L+l`}9p zkIm?mGuR)qO-+{fZB&$yoo|Y5vWjrz4Ge_?_^O2XesF#%{obp$UtR4uw%lct_2zXSImIoh!0BSdX z2Za)kZF^<4h|dAXsPeL!P|o$MTU!^VMAG2ls^jh6#YGwNTOK* zoQLq*Jc6FPBIsYx$gXq<%{Uu!2--chE@2YMcllf*n_Cn>I8ez6+$HAF}kVr%(a&bsDsa& z@rkjy3M20z3BlN0W5q|h7&Gk0?e%sRI#Ts2mIu5s;Bm1C<=nCyKZzV!t80Ag@>`b| zE`JgkxYyjjq`i0Z_RZV*51uPVP835YY{>qG(5eGJ4zz+b`M{bG8;6HIIY%m^dQSP| z%=-1C)fRI=ug{#+e%dDqGJ@Qgx`$!Su&tO`)qv{iXRDh&sC3Vn0eomx`GGD)QKth% zdq2e`mG;ifw{NaQdWxYh#F%<%p}R?rU(%{f!`|gRMsB-f6vv0hw&>Z}9prG-!68VF zy3eHF;--LXajqOdizL<75dYkHrztbq^sHe$nL1@3ZI%g*GK-gmT2(zcJeZIHfPyIJ zg?sR=y!ov+SHnk(;iK<*mM*>b;_Vk#q@zXuQ3eX;n4O62QNBczouup(Wv3~7f-)i* zWfU2rr77g+x{N^Xw34A3KMw)dX1SftXo;!AU!jkFo3d|Ewm{i;D5LYt7wcrI$ExeG>c-gTtmBwy)WVBs^h9Z^4Su1mP8i=?Z7{JY8`x@t7P1w9 z+}rYjrEfKW0X%3hNsjM?)?aZE52n1U^Wohr4^?ztk;8`T98qM7T!3HcS^gUXW=tgwqP`O4Ww3qm>`HKd(ep+8{5VPV7>@gsE2P(p#0Pf=+d8c`%2tJI z0C7LTX@9Yv_=#vN4vkhaqa?#W@j2$B~Bwj>)+ zPp<^Kiynv4^_k_K6Hxrv?ZjjW7+d&vK;-~I<3KUOh|0LxLJuohP?1pORR8RYI)|VV zozSrzhMca3A;->O6waASS%wY|4_rd@LlWgL(1)$k0@M%BuLS#x9!ET`2`CTxKFpac zaprk&p`Fw{Fr77SGw%ko|HCYnNz*SjZ3xJgJnQs$AJ=ktRGz;YzBKRVD=vcEVWB`5 z59Y$rXr|*vp+Pt+p2IP}f&NO5Lr%Fb(>7VE2!4UAfeGZUra+jQfV z#vKO}A3q~FWuyCYfX@g^9qXZFj+btr@h%f~SekU36kv=dmyJY6nWc)6encY;3kA=l zyFobj9YH8~9sBm~uy5E_*pqk1ed9h9eLNQky=4hsR)L1Ok1k;xhT`}$CHwI101?RS z?PhYo$@*=XV;<<1+pW;i>n)hZLZ|S;Q&kpL6kcGsFyXkV)x8-_ zzOJ%}AT=!(*@zi~ElbB1#e9B)@U;J>2T$H-|Re6@l zR6Ptp(#@ZoPOy1&4}18~o5!{ApZNTY=A?|VqfHdx`q?AYH_V^A*V6XRD{sH@PWD@Y z1$Vi_Vb5x$4}Zl--@VSBA7_7%z2*B}aKkG^`|taN`aO%@A8M<0y~}mIpSB(Tz`N4+ z*uuGQkKe6pwHxkrN(;~a>z;kLJa;4e7SkX19$$?-x*U0Qt-WiteGq@e_QAD12UhnC zf3#=#eeEYV@7(Locp=0RNW_Ui|O|Lc&EH@9_i}tKW4}BCp^zp!%52Gss=YAd? zwd&qK{`2UOjYeT_C!F`~hi*OcN8|U}y6CYnB((OdA3-e5{MT$gYjVhhXgI>u;8uWCsiF= zQgFi!^L!slg08uvEDY1L#b2W{(`aa$p zTdg^?TytnG99<1}e-!R6`n%VH4c|Xs4DKs>cnsr2tc4jK^lOx<8JJD@Wr{)@Q(mTw z6bT-Y>ZKA9H_Q+tn3M%l>viTUi!Ej0Xk2v;(id#WXXrB@*C&|j$#?Cmg6A4aKl~E)hl|r1zlXNk4 zWcH4BBo~2z6s-dUt}H0V_o&Cp{}&J<-$%NVku z!W^UU?Ze@0bd)#wv)ZCr^NgY?R85*SmZe!-Yd;3a!R34K>-`{ibUnBrJ1D6%*!C#nBU}8%`io4 zP$HR0DNDh5!^plG8@9%qHTFcNdp4bs4bx+-{NIp8=A5G$fcX;+r%BWnTVsd^>L6im zs}m~AWP-fp8u$qzDQIgYKjh}QI2U)t`M3~w$31;K$f@REs9UDjnT~?e6Vne|QX>KD zD>Q@+9;z5Qs!_Zg9}#x8Oc*+@e8`;ao6jsLeKS;*wZ4>crH@(~C1=%&>ai?Su46Q( z;mmzHO;+?KoMwlWSa#72BoemzDT##Hw&O@+mHjQii*D`w0r9#0o0zRP9^T-wJUPJ1 zyT0a4H+*jaF-h9$h;>o}Kll!AU4aS;uboVAW7t!bpw+&Rl^s)p^EFngIV}X{a+Gw! z)yp8p>YIQgIc3wsak!R_pQDOwDAJCtN^qMNP*IsSz@4>jbu22-0L(>$nC-)CKV(t9 z+-eFaZoI9@v`)iF(g2x`oA2uCqD@emL7cv%Rc2(z`mt>Uh&VcKX_;*LNp1c5L8*AK zw{Wm`J=|IhcNW5(cj_B&4E}QPSEp|_e^%eK-qe22=dSf{5Vy}yTVWt=glshGGrfs~ zCNJRm`V)zTOe&YgI-L9~IXP|j>`NqORjM0lRa3MKbk`&jsZ0_o&{F|W&>%8w0-T%A zq^JaIm<@>p-a0jzkPU;XGdV-i6A8Ay#R&?4sW!_{;q?=c{ful1yxY6sCv^>LLU=vc zye2fS2ll`I+kj*T{Lr~wx>VbGI)c3P`FkT1s zdR7m`!^XaN1L)xaQ#_kh9UWWx^CXqCS%ordq34oGMb~F@X$dWcb6s`7%rTm|qNc#A zD0D8PWfs(=Br{^k$Vf98W1hhy5P-Rm)9R9vlCH?>4{_l#Bv>wjQbTd{d!i4E{?5L$S2e3^T&43w1t&Vc^ zAQTojvg<|hzL*CqWV#KxVn}@mvSspsxZH;}FwHlOGnv^uhG=RGT=gN&nU8X0&c4GPx&Mp8O1YJqb(qk}=GH$kk16)y6Qw_LX z;q6up=Gjupyf>wF8j|z7NeEc$!3(>!t4Ka)~S!{ARqBe;uOWoa7r4cf&(!!@s!p#;98HR6NKZpnDMeJR z?Mmn9>?x$I6y$4fyq5PqR%ZVj3zDK-_7vWexb6;BlfSd7jhs!ZvgMCkn24VF4jes_ z(-lPCtMiJ+z%(l_g0q;CR9%t*2a`rLMu%`8RgyFX^xMtaN`=IhGf0bj`VNAt)W9WQ zTGfpo=?0zNQn^;k12Z&hmLe6gO0OZRg23GP1T$YQGtZT|SYrM;N zajH_Bb3&+YyC((LwUtb`#@tn;@VWaOW9VF0r7>Ss1AHP5U~&Sx2-%Z6*ADKU`o`Q< z_>|WAgp461SEWbf82w0=c9+EzMhPtK;QZ(}=KTL7Lw*M*3FKsa*At$?`^(bq`y1Ou zn$CIFk{9@#D@Jmzi-!rx@)P_Rdec=YE;#fhje|Kshg->|4$wA!)O87n ze54KL%<|4S&>Qq6Seil)m8HqLUZ)DBL+g}TVG4sFmL^IZbilk3Hn$1^pX`UrVmoS5 zGP97S3Sfz@UIBl~agQau!wA`kK{JYBfa?d*E6wOx@U!400DQgid4L>6o0m242Bnen z7bH1nWRBsCX$5ImIGj>ua&vPy)yyK;1j?$Vb#y-qYD%7A1vp7pZI{yts;zI^VTASL zEF#s1{1T*RfnO;zE6G=6HO&J2@)}m)#MY>slYuOR<>1>OY=UnSfZ#((L!hCgQ#yD@ z2^L8}hbxf)h%5O<^c)BnTqcM?(u#&5MluCj5`ic_(50y1Cl*UJ? zW%5;+G(B-W2#!l*({=HVShv!DZMJ>e<9LejGQe*&K4sV3z3U!k>T5c5gd77 zC3WNSTbJMOFN#NQiAQ#<)>nx1twkQc9XL_Bj#w0XZ;8DnYUpe4ym|hEOYdDOb`BOg z2X9M5TWgCv4QXgvIsdsdw28F$ z_?lqoUKrZmsb8J`?6HBhropxF&~+coUVC6gUE3$+z0!ZaY64ol4ut(FX}Q?w{j^oU z{ICb|Z9$0uB!CFqmIRfrbB*!grVk(W+*Uv$pvF-g%6valn8{?)dm7y|(Ce1t`+x}U zhE2?F)^A|(A;cI^Shly)j@tYM?Pt3^E!s|d3l^o7OxEsZoe>W^;PDi8#xFg7UP&u+ z_yS_zq6K(}l#=sG@-jTdWth*i9SZ1kF#clHMMqH*=wCw}tuO@(Ky=)O{m8*6tD~^; zWo429M1}+SM@hA9HC?Z7eE0O*rwjF6`9Rm_`@&`S#Bn{ooxd(3pAU%{S#(2j9~caw zzb?2ZIXtCFZnfSj%e(*yOZGcpaO+R-xxBXnvh%oLwN^4!a*lR4laATxAX7E=%5aQR zC4>I(QM(!006c`8D4D={E-EbbmJ|ZOb`G8p9;yqMfRCkG>&+Dnf&nkmQuk7*TLKuC zw2TCk9EnCfWo0pWXfl2HbbW!+429P+sM13)QMC_EarSDAWF~-}5Mp|z>iCM{(Ocrt zJM{-vj2qY9y0%u|kq>m-2{q=MkN&p*cfudU--~NKXNo-+3OyI{M=yS&Z%R#A^p}q~J*vyUFEpf@e zU}sdVX~CixyCuc|q|h9%>Yq89w%Y#A`J3SnTHb3}YduzMeWK9%M84%z{?zzGH0@gf z8Mq|i;_L-vui;jm*qO%{ddOBgSW#AaAYuv68C2f46^9D`-v(!F^=!+BTyT=y?&rVT zQ#??+PPmz|sjCq35#}&Gx#a7WtT%}#O)d&<9~uaZHzN2+AecM4Zb2ELQk z%61%ufy?A>NV1ONy?q}pejNTw+aKGCgU=TRpU)4B=f_{j2PQUnm;E>ny1|}9aPiS- zt%XKtnrJ6xhcWBI?0b-z-Ym@kWEqQ9J}R9;5;TttxhN_YMW~|45j!m=b?b?;2iq{~ zhM%rN_EWOy65QVV0eFVo@Dfkxo(rDU@VPs*fwfXwTdA$B)K)=v-wSd5{Rs|Si~9jY z5-WcYa8$tJ0@sd)*uLn F{{s|#LDv8P literal 0 HcmV?d00001 diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/streaming.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/streaming.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e29640c37363fae4c034ddc24e8693cf1211d62f GIT binary patch literal 22278 zcmd6P32XGr}&{bAy7IvD$aZnR`n0AWD} zaE^sohCR(fLZ8rU$QbGfHuQ-Z5m&L#*lWs|c$u-!+-u2LdaW6&TE~{LJuQSxefC~Q z#(^>+WbSkJx-zcbqD)b*JLBeMmOf9fH{rvLckZ^|I=ap^>$E zCOQshq9~}LjwB}Hkz|U78i^%_GI-z}l%iw!W+`(ho{7ey znJ5ZfyqCUAT#9Cr5(;d4qUrddWGp^1q)q_8h{}zy@IL^YW5-xV0GSw`F3*S|A!7^~ zfNrszjd(JqW9E<%cP6^qs`inwpwx^~%aT$nO06ihEh)93)Q(cel2SWL`9v=%b%d%z ze5$E*M94TpH6btB`qXqTUywektzD)O&ZR9CsCTm+^!u0atO@8}es-ArFYA zR`%*d6H;krqUnefO{L-zrkLz81_6&o zGiiEbgZyOsaB?)>ejLOw)*g#L+b$`j9Ze+`fg4hs$~Q>kV;K-!ds-S=^faOuYo8cQ zot2%Dh`JEsk%(No3_HQa&#N$)v>(|yc9)5!nt94D)#m6j-FcATF5od6Qb~+pMjwxR z+d>7_i-vr(3Ra~i+{-n~5xS^V9W|l(I>&Nm<|%pk`4^whx?5)4Ez{PP{D)|B z{z;K4HK6MWm$G_#ZgGxNnvgD+C5WpuP)d7>z!Qwn5Y*oLLc*8_hH*MBqnGJ(yQ`q@A!UNAn zN51xJF`Fvp8L~@ue#wtVL#hz~pPkG6Yy6*pmE3=RQbJhJ zWj-fuibpNlOT&w1ktDeQJ8IRQ9p!Q@-EA?LSqwB#&FWYUWY$KOV4Y$OO9-vvM6)*Y z2jgQWGs8>fK9D#ONMWZ1VFV|NG%^_B75iJw%9cTtAQ7&lMr5)*OjM)DYBr)KRZ!zB zP&O-#)5NXT29zB}>o}r3lLN~autqXU4Pw>l{m6)DjJAro(#ng+E*#62uA3=cmn{v> zlm@5UADJzEbn>zH8d|=&<@~eX=$v+Lz8pjL(JfEaxBI5uYws|@Rv{Oc=R{mTPSbYs zLfbC(efuul^yJ)@6rg)VA?@^V8_%}epya% zD#LdzggGWw-nlw;(m9DQBmzJ^YFUs5hb6f?x92gUu>^GqKBy$A$QJgY;qkFkku>xIPQc2(s3;Md`2W=Lvzd7M*s2pq zAE(Q7HdA1pA-mk2qsw&Xhu`8Zbro;_U@ofc68P^1OUl;CyF= z$sEvmhSrL)JohMKZt#U?(Bm25oOsY=2dShCVZ%1#8Fo&nV+Xv9S=d2mkIT;n*?=wI zhX!d1%|7Y}?^pVroyMiMiJVgfmFb8FlFvfH&=dfOU3}*XMAHF2O#wck z>EOqW-CP%N-ZP2Q`sElEkWia%1MtPlTFH- zXdc$8%uMR02P+76i~8bJ@(k+z1~Yxz;ePqymmi*d_?EABx~^x|w|CmPH)k~30&{hZ z3cc@~soQzA>SkTfT_(7ybCjKr&z1SV<(L-%&(!rmJ}fT3xct>yGADv&L z-`;T6{eIyHUiU)n9=q_GzpIV?z}V$BTw_9)%Y01`2{zhLe9a{g>=p?27NhpHH9}Xj z@miCG;I@)I7V$b0_K4Q&f|+28i1Pj={LzdT0U^S|8URGd_tNG%N(>Ck|oW$qJ;cN~sI@)mELf2RF)MvnvaPs!Ba5 zZ8hc>nnZiOv=>?0hzzQ!A~{GT2+P&WHTH|q}F zYqcF(b+t+K*3Y&oq&{@9>V7kbN;-uX5rre;6i!#7a9lZs<9Z(o|KopN8;=+^G~>%C z#UNNh;MF&ru$UKXwN;|m^-dqlyFu#5t#U_})!?a0*vPs>` zVsSD{th~--BX75Kp^;JK-n$xaz-jSMQ18Ag&4PWcw&B&$S4Ok7J7#KWrPX%dWky$B zju?Vq=y@=R@a z&bi9QmsU2uZibC-PXji-Jto@t_K39c5o~+}#n(jv@O6_wu%#HauU83sYK+(Y7J?f} z_Usm~Zx{AFWWBz_Oz>_I<)3g^eo-pJ9`>x}o2QM;%(H`SP|!JRv0>09V0E zU)QtV59>Vr+p6yTb!-rG6JYC^##K&2RIg?UxO-|K%F;iop{UPLx1o?L2`V-;VbZX; zJIInUgNv94AUGGML0xIDW5amYQSdD#p%1J(MNJ>pmGmVX!Z>l|aP--@s(_JqMw5SI z2?-9Gk+XqJG7t?ARR!(#F6m^t!yZ7=$*dzV0AdTA9*#?Ks+*?nNV%gLylP$}>IfW$ zUKB{4P`7WY55+Imep-TTY`2HFT~>WV|M=)}2L)J zf2%#u!enDI6(3XNXcK>pEJE#pcgtIPK5?le>s@=(yY_PZTw`;#am!5OmMi;jHa-FiwRdBVvZOaMR5 zxzOnM>9667UI=u1h3}N?sbYWQ+haCevl+WO%%m6Wv|lR{3HCNq`A&i04uRlZR#d-k zG@#{mvtv)W?Yh@UC8fNiTqL;4-CZPJU+3Mk%W%C@Ab6Lf+irT(VgUT6O(58AB)CXK zKTB9E>B?B159}^b7-tBrR^^`HetC{hcmrVSk@Jnz;JrQq13)jN`0r3A)QC}i= z02P{&4j!sYM*1jq9?MnnMYZc#BXPZI{8<8@LXBU-hs25Q5EwxqIx?bjAlO!ufzkMA zQaT$9JOK~#=>!#smj%G{yy&Ldz1l z1f#JC##sK z$4Y8{f4Qd3?UFClcI_5ktLds^|4Hcb8~?Ki=$fGzh1W`jt{U^TG84gmfy!$Hg6m4U zI>c*Rgs$z@Yg^3(cZewebPM5i#c#$Jf^2*sR|H9Jy6w?OD*@S5j9-?o1W=W-5?%uE zAS>Zy8<)*jwms@H13FXFB8nFl%K&6df@@Q&#$B7_-ULm%RWnglH(4ZCGFJxs2N#QGeU1!U0)1(=^u(8W1{FTsUF#fd%kTxE2$#O-wRrn1=0=Q(P6pH#=i^%~y z79AyzvON+RO~%F{E=I`L{H5{ei2B4G!Nw(}GbD+RCGpr2iNumak%&aT71^4Su&GL! zv)u0}K~7=PM#{+8s%*X81RbP|WPORYI4MC{4>Gwl5+ToIVki>LWTeFLahOBVIk{pv zaVRcWl654?%JG-Jfb6U6U1R%)M!2+dc4jWRV}L7mK?IZ|2>Q5E)})s;>17Y;We=%k z@V=;JfN~zS?GC-(j=NTyDR8$8)||UlPEFc2?c4!Hm$`U0>eBShxLHj=oHX|BUBQ}ybRL^|_SL9~%xv|Rjf)&t=#5mO;NmtYQ__)vF{1{D&2bOaJ@UmdeM{ln1sSDzqOBq%q%22u zBTd+J6m68GsjHgm7emk0Y|xal95RPZaXt>Z%PVXHC0g73wf-J1wn4+7xcsZyS=d6% zWrsRq;3GeF5qC?*-fEJC_Ws8P;kEc9ypfZw!p@1@WY3A@$Vl>ZM2aiQV7k?T*clLR zBBj(P%~^~r>#~+>na!w zEf3zQMD#7&X*t8hAw@^iL>_C`uA!tFarq8aa}N?$!izZhej6=e!!2Qz^{={LabFf^ zE7~TFFS%|7wqE%{cH7?RZF}F?JR5jy(sEK+TX|m@Z zoHZz{s-4__%UwCO=DUupyX}U%?RHK51^b-0^oF+{;CcHm{ei5%?S{Wil>_H0>hS+n z*Ocqh=DE_k+x1O%T$bvh$)1-EVo}s99p|Maji5iB;&PUdcc0}h{YzB%JN&7kEU;6X zO6Dn>ZrIMR`H`R&Pc)LR(4r*%smW`Nj3lPlg??opUyDbJf@w(Fh=Ks%0gK3W_n027 z0v`@-q9hj0xr-+qzvZU-7ev!i5mx06!a@rw--mx2u6!~60_2Q|2HJY{hZ(9AoO_KrZg_1hqUkf$HiRjKw(8i^L*Aevez$gzc#3|y8It%_mS!oNT>9m9YNlg_W3{$NT5-zT_Q zVdZLtVIr7UE5^rQJRdnr#y1}Sr*KM&kvI)o+37KOoP!i>If;QvWL3G3rr}?4?i6P; zM;A<$nzEX8ROA1&qnh-MwhL`pU(<}QY1Y@AbvEB{HqVR9S@W*5S)J33yP;=v8vok1 z8xgPy^ObGSq$%zhAgDd*;(hlD0C z2O$@&n=d9%A!j0CO2jxg>!UD_zr}8PKXP_LL?F&2S`mVNZ}%AXx1IX z_mBoCsJI}7Y#P2&o{&9k3pr@xge8t*j|egu5o$0uy^H=YBN%3c}x`_YFfF) z09bZm3VTCEA-6UM%lkS?2H8=+w$t~1ixAwBBr&+8z>5rrvc!yFyXDc z3A?F^!D1c1Sb0#>idX&4f_EO>rS(4WumRGTQj!8vK=uku{KwZlcaOC*py{tTSFcKhBl(b3dMTygDw@rz$nPAl;@ zDi~K>FIeAhC>x}6z>TL;3r_}j>*u1hDM@k7^6{cPseHEab7PyVH(ez*sycL zgVSi*X~K5ub;8-b=%fSeD3>rMStLUsNvE%tBlW?b4bs6f1+$6s zkZ^DmQD~Ee4j9cnthJHbTM+J!8i|x_B%`N9OjkAzC2>^D&gmu+8y`){<|KD(OMgL+ zP4KIare(`;G)<;<>EH4~st2Dp4~&d+l|ptMA5VO3#rBNAsFcCSl3vL zpMsNJC!{11fO4`^@d6A}i(`~w7i5x!GBS)S%F2s?WRG^%QggjaHY)b<-nca=qFQrh zXGozgC4Lr?7+Is}rAoCpo#bq-RIEjp@Kl1(sNhukGlKq{GA`#6vN4sJsFdNo%Wjo$ zBkEexkq6VPf;8cjEIcdQK@!mseyWqBO?sVrvZ$@)VwEc6v4~D=+~uO2hqLn`D!P$N zfmKqFed;uiozzh%3-L4whX^9zrYxfRB}qNnuypCkja|eJ4{PgMG4>X$&$rQSnoOvq zuICykjy}6}?{_ywG#L>sCeGCE-$Mwxaz;Mf;VmEBy#3 zKyZWbb>q9$!JLV?%Hb}oDq3(dSHW&3B!_P@Pjw(Ria zzPaF|laEjJ&p6j(Fy;P>BNs-pWgBP8HqMp9a#v0{S=?ZXX62g}n7O>@#eJ|jH?~bX z>!{-u>X)`GsXw_7hPjf8No&rq-sZdQF3!4@Lq+Xbcl)%veXhPKTfcp#etWk5;hFk} zubzI}_+OmwIA`mh$oikSV1;+YoaGv$yj0y3OAYz8;)i*O6V*asJS) z@~Wxbv*oRqpSoGT^SzyWFFpCaW3L_iZshH)Q}#PnR^FT~+j^sH>y;<3o_V`!wrp_P zGkC|$8n#^7dG*QJ`p2f7wK;>)wRx_rW!BR|sB6uZwa=8b&z5bQj@{%E?arJ#r3{nA~MbvMnp zo9-~tw(UK4`CM7;#pH$LY*};G(>&v8Mxc7ux9Ns&)0O&J-_~j8*5BQtCiOFJyh5~X zxmT0+8@~1{!mMvIPT`g=@uK0xs7}{C#fo z^{r;gJG!=@=&hiCzmxsY-b(ovp|8~V!>vt#|GrY_D>wdqRS@uxY{h+k_M>W{uhRIV z8b84g`H;WuSc9i;Z#4A<+1uNS0l#Av`r3@|*o*|btmyxpQi0%do}*7cd&lqSYZc#F zYoPKLf#6nNKUlKgCjQtU>^E6|ESd?niKz2qXX&8|@yGT41ITv?`yVm?csId6sVGDF zPuc~_H~J4Yi$8S;2aC)sFb( z*SvaVeWH<;vRYlIl!6LH5xH;%y z_U3snflKW$KnqT!06k=fxePH@x5MD=g()N)DGr-Lh8;%b38EN99>u8pY4-`CB@v1# zGb|?PwJ@bDh>o;|jIceJ1}!0TIR7IK7!fp33-muRWDUdIow6;7qBOwXp!T>z6r~;S zqm8>Dg^il#vSJja1GX31$O}@~p|yf_#=0nqQZHW;MQJ_qV#vsCANtpv~3ld+>N zt@9&aYg=R&3fZ-|q2l{TV;&NfSj<72rtu!y0WFfu zm^?uz1EK11nbwpOahc8m-IAo$V{A~55m)0fOSET;b=|x+r0J{_Kbnsq-G|>QSatwP zjVWFJOw(bPN12B7C{wO=IigoV20gGY!$*ywyDENo0Cp4XFq6p7Mb)4GsF2CdQQC zcz}YXs3IGbAXF{Fa-F6lFi1BF2IzDk+4oP4k$Jy` z1lxe7M;zqGVHGWB1F1e7_fQeFSwQ5?5FBav5tKm7#^A;cn}Qo#`GHE_Kku6NtBygF z(iiD}A?+twK9%~XVT;GMwluWUoTe4!FF27%kt#Sslg)3qBB*}^9}-PcN`kiCa-u;a zz<4b1Wv$jz%}XL}n~y!O;JzWR`N<-5PQ)~kipBShe(5+s*|7-WJW7e6MWcyO*%v8`B5QRi$_L-r@_QQJ&iGD7 zt6iF=j1SGFeI9=P0<<+m5B5?<-KL4XDY8Fd2T76lT}yB+H>@b`FR8Paw!O!ZacTci z0YYoGcht{(bS~C;na4&nvb}x$vHjeZr;WOvU#1 z{A*w7ytT7)F0kR}fzGRk7evEDwNr;KubZvjHopPGoUcV+Gw4`kW$W=y{GTpe_i?U* zm9M$!Y5eGy#nlK`c9nhLsYKAFw{ote>|)=AzNy5`5)y8`WfZPlQOD(0`19vH2v;G| z72(RRvXAdRq~Rowoji(upC&cxh5Efd;X6XNX#K7T=zEPl+f3ISCEe?d*Xn%TKHIfT z#%_!K+BTuvRCH~-Nbo~JlwWTvNB*WLpwXKq0p)L61S+xF(DqHAqr1WNW{r#BbprZ) zbG^H#&hlobx5s6E%P9bU%jM|t+uo`$5L_h?>^BlzC!+pa4G#4D)&`+xqw%evh2U-G zy>8oEokGvUMQ`o01OB1KK)KC^r%S{;(yg)2K9CEYi+9|GZdJs(KSE>0BWKDaPa&+{ zdWTyXf#MJTgvgdGwIr?COg#dfZSE0xND%>;Klsut9JI3HvYd^Bc4n`g zcM!N#E<;BU0vLm&;8Mj__=k^ePIi%uwf%0eV=X@!r~sm2sb)@$e^74c`Z2|;#(5A8hFSmRg=P$&e0>bm!6(Sde_MwN_*1hlc zo!>d*?tZQPO4Dq^&S`h|)yHr%BAALCznm$^*%NeyJ2c5nshATZ5Bkd>8H=4=Gn zS!rF)K@d)SmE~Ln6%jGH0V$}UF=&aTTTV;lP&r3GxTesOc?m6<>)DY;$jVqvlt4`; zotn0)|>?QtcEmYAYls>o|UYjlz|&&%g6-vH0Sau!5CF_#!xMmYZsW5Q{{JmLHr1=4?|jMEG~Pn(f}1L-Wt zt*{pAFhXyV*W8Bz>9sBsa_i9*2*<~4YgG2L|Fzc3y|WFEOuP5Lv37=9`bvXjq^^5(v@urD~}{%vP%Wi@ge*!m~2YJq8|VB%;-PTHxKY{ zzRP^XjF541!WGm+RtJKt1lb6(vkHICL6DPqs&X!Ziip141i|)DJMRUgpok_$OSGI; zVoR1K)MX*+IVtI*fuL_M3efNbC=M!Q^eB)tN;`IX9w5gPq!RhJRq z0)~x9&pZMCPZUW1i?SSL^OSK?q?&4o=VD^4<;0jII^3+rl|~kgP2O^E+Pr6@|3K5W z1@8l?mNDCQjmMci_V>MQbDqjeqmW2_ML82nFlFx2c?UtvtTH+{cfLjgpQMcM@|^I# zid+03mhH(6;Nu&>$orMhJfHL>swh#GrYu9*IAwK|ou}*~Wj&P9o}y?fHv!2G?xj+^ zo6;?M_DjnCJ7sq$J55=^c?vFxQT9#zrTzF|I#1D=Gg1h)mDR7+g0|NMwV>^-JGG$g zP204f?Y50~DQNq{g92hiKQtqn@k28L?tl|>WzN9kmh7x`gC675wo#99YH8DBoYn>Z ziN`q6aSN^483pDhH>C>>I+?#tx5=R$x5=sPc!h%oX7=7OkQ_+G-W&&WWdQ%lfDK(O zq)on-*Cb}G7IGF|!E0iT@xnU>ZM8{+t=1YoEfm0d04Gy1M!xw~i*`vQ=4IePaFW9>GSknj0`72iQ9_yK5J@2vIzhJGuV9mc4J-;w+_?5BY Yu6aTbaH@;)yAxu@DA*Sm<@{y;7ggnyG5`Po literal 0 HcmV?d00001 diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/testing.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/testing.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..478359ee0fed5876cf0b7fe54ba0db97e1b8cd5b GIT binary patch literal 21658 zcmdUXdvF`andb~%#FGG@5MLtr5J^ZRsQ1&BEz7n@%c5yW3ptTwEChfeVhUsiL))a2 znDOqVnAGlC&Tg>=yTZ-91yARGHb_-6~aAIoVrR=e@eCBTUMGXO)V!;;X&XJ&Fva z(9s`P_xrkM1_Ou`r6hY-*Ccv+db)eM`|JMRJv+)hP61)yKmGgEHxCKI&*(-AHl7ey zWl<2Ogs>nBFA8C?U+go z!WCgtxH4STYYtcAX^meP@r{_|dRD#`Iexu-1IycjygEIvv4KWV-`~`?Rc>aZZ0Ha4 zwa6{aLbwqno2WgxHEe1V0>Xthn~-qPsPS|wo;LHRO_}!Q^`zVXjBS>lS3oPxO{A|KQK5U509n;@sU(AEoVYOQE|o6=}|c*r$*D6 z0o+>#WAbp&ta#3RVeqNw@xG^ypX?tvp_q@QCzP@?6JyCpObVJ5$Fa;rI(}+2{*vN2 z6}yyTNmO?{5z8b`jV6*KDCFgZQi;S!@|BpBRLW0NCH)>nT*t;z;bdkEZ%--}XQWsf zX-Phnlw*mQ98<(IaX#%lR$(Bn9>x8Xa6ynotTfY$HL^J@%9gMRvtwqnV+~u7wz9M> zY(u(?rOU!tYhg#55OgY)$77jHQkIj2E=~TjkYm)A88&okQd4IDsVwP)-CADfC1hnFz?k(&+f5VO*2O7sQ8SsdRVX za_lAQo!)CF^_u#8F&2L*kV(cak0di0HWrypHo%gWL(Vwu4t0kJG|Si*;%XzC<%sa2 z>EQ1RLIQb>!t>&=7#72(Ua?KMYW_KuRlIR^BBOj|DdolEyDDI5*svBa$K(vXrB#Xa z4v$_=_Fj}yv2<@D`EswsS7~f4Wk~jnu?5>Bji==lif5#_;b~OM#l z1>_cx?STBS-0#cKPBXwL!a0i zC4xi|j0oQ{7`3xv>%%B)4qL+3u&vjO^=XOl9FPRlJdBezFV$U;Tu+}MT0?6^5eq6$_6Rb;a;jo6rcyZgKL7# z+PXqf-rv4#rt7Z9+4YvgzhcEbA0x)32TJ4TQRh2iY7ru$hQ~1?@$MepLv17Kn?qZV zg^kdwZGsT%^;NUfg4U%Din=j#t$>-=}2AB7eU^?y|H(SiSR*wE zD_f$d2ER-LqHhQ*CacwcryL~vjtvB4%?IqoP#dpDrQ`VNLB&w_aF54-E$-3JxZ8Wz z!sJs0X5(R4$XGECSw!ur=fF^#b7T^+CikNUO8W-gF5-)xrdDW@IWaJzcC{-TF+tK+ zsznP$3Lr8vKMe3nVB`05=7+tTh!uY~v5WMh@ar-?1yagrz2akiFmN~zNJ|INhkpDF zJWUtzG+ioB)0N+KjCh(Zm8a?ALm<{d3zYsn;%P!iv_hf-JuTvEPC#n@5=y-)PMM#z zI>A?#3C~*gnIYksq#jfn;9G<07cnhtODS77nqJPfu-+3V`g6P(j7x3v%qxpEojGsk zg1s~A?fg~7jfZczYs5bit1NF?Ys8{;_*(z~;or#$&dBh-G7;z@An-hmoEFHGuttnb z2{-fD18_480?SxdDg+*$qdD*(98D=K|G(vM{;!YL!0`}Yvp&aT-jL(57&#v7pC9Ab z&-Rd2+KZJlAnije?WYK16QqL_9Ya(?{W*#1+-OskkbSl?{~oQ-?pl}dH?_Tc?wxaU z{>7$UIsdNTKJDMOUr?dqu>YagZ2hFQMxLH1QN2$1g*Y<2Qs) zEzjMts8qeHl&VwNIDUH2sd@xi2A$Bz!%%hTha5~lWapYemUe{QvNP;~q*<;wN!P^% zugMdXR+VUs!mIiR@X;|DN}0>4c!ud`7$Z9rizfr4LxD@lG`LzB%rlqfGNB^W`oJU} zqALmV3}Gskfl;(dbGm^XuJ{WbFCy`ysFR_F2#cDm`&THMX=j%L<;8OrbgJKq+bN+J z0#{mnBnTn8(`YnPg)lCFG=Sg^<1ZChYsJGf3{hyuXH_;!gL2*LBe^2s-iw~ zwt)4QD_-)wyQVEm_Qw34ebbgt?Dd82YMrp4RnSmzHGl+3tm|p8NITLC4QkNJH6s?{ zTorRhmN+pYIpBU%D@9QtLqF1W&@@`C+gB)>H80a;&dlz3_ta&IlB{c7pnjQEJnJLI zqBI=BU=kqJjly{hg$Kf26xJ7aBVxyWo^?|%)j-OV$<{E_>I7l|0uo!uvGhcM3r+#j z1cktI#85@DBSM;hB@H1mvUQ3p8odO4Etq$3`L#u$)AQLh?Ly5d;g-vr^Y6&|cPzPf z+zjsiUc>a0T>P1>&bmAD-m09pE$eNYee#AkxL^<73*3ihLawT+FBcyglU<}sG?phQ zVsK{4lo#ptKAVX_d;*0sG!q=+L4t8`jzK&)pCP~pugNTvcU=b_s?e)&?^zAA`sV>+ z9wMf&ctE`yGoRhLo;HPp_dK=1!dWq5)+`mU4A4q8Pi{Y*gsjaWstLIqw1Lc6GM*Yr z#Z?H0u8NAAEB2xnL%RNyO$dD!Qf#M>Q!o$11bO+oh0 zXe^{@=fn$p&}0oRv@#-Qz!)gNg4#9D>VDi3Iam+h4jMPAT2aHd3}3dNz}6zOi%PwS zr~^qF5hhG(Cg~z7E0*}^*n|{E(m>r59}r>@1ymXg(_Q+Ijgpk>K$?UWTe9AkoVO$E z?O617EvP$0eIWz%K+q+fKzXT;B9ir_XDB*JQ7c6$ie!ptFG^pd=vj&g>oJ&eb;~)r zrHFP=rVSCXWzXNSfJwMx2W`9K2A*Tlnj3S^0Kn^0EyYDDo$*XG4pX2~Hk^zlU>j3x zFycUqcj?dGq41-}iWnf$umS|)YBv)1quFH92*ZvSc7&b1R)EIE>9>_(F{vEYr71*; z8T^;@b)+V13JVOY>_Xrx0me7IL8YuiBcm~yk^ISWgE{itnftFp;#I$eU*-`+v=03u zlmUqHF88t-S19KyYnIC>Wf#iZmK~IG3ZBYk7p2^St$M|SRADQjA({e6{OoF7{U1n7 zaYMQ=W-0Ii5zC+jk4i$=q>~Wq*_t%9!~#ka0WS$H!Wq*Mu~W^xgwkYS?iDmuam1R| zNlioyn-7Bd;wHeb<&+q<;yEE?7S4OMR78we2MLrVA!3dIYzNd{kJ-*wXa&yNG*v!8 zSvJ{mTuOpV4yZKD01zXq9fGM1T4SPUS3n*V({m>kE7SZ2Ee!Y!?h*sATZ)mAm@AHh z4#mop4~*0)_OP1IS4>$SU#YCN;z3U`qv`0_umr2NL`rzcjR>Z+->38xMYO)yd!#=^ zO7ReJ)ZeDq!E!K5c7|Zu(ca!3(DcexaW>E>ES`FK>5oy0Eh^%!r-W6XV6C`q6Kb~3 z?tAa(caJVr@18o95A0a7H02vx-aYkar{+4}@0shF4=*+zoI15+smpKQcg?)C{m6IQ zulp&Z`7`K>tDEz_rkrnE*0(M1t;yH4-ga1hwyD0`<$~LPWqi@qxnSw!%Mh>CgSvpk z)gL3vAX)u|Dp_qQ*xN@$*?PfNu(@l9Q!YcUZhhBt?P0qvabXuD?P3y_Gt4|NSlV^L z9cG>vbf?$!AlHZT6-Bw_;Y#FHv3lNuM~3VR*UA-PKNePpk{Vb2b89%a z>}N{s`efJ8jLSvH>Y-T?&HU=oOq0n4Bv--~^)@5Fwrm7AxAOZFzt5wCxYvKzGxg-*B>}KgTOJoz@=} z`mrWhNh^(L_KVAOnIB+x_nFowQJZ+4`%mlrSX9`-`LwsJGws?2;S;aewRj6brAmYrH_ZDo&Uq?XbR2xb} zn8K#OIISycXe`zdF)EIm#?4VdqiEzwEkZLBpQVjJT{xa4ALK!P(2LIle?eAGAVcg7}0QGNE*GOAL1%^^1 z$q+341#>=J49hq&wqhramV)+vIEX6{LP%%RclKuq-rJ`p=98xUg49FLx z%05ZoM+v2=1SJ$Nfx>#eI`I30=idRfbhB`t_6-Z`i_~GWwhq@_>AFy|p1=SfT?<+ze!C)`r$WvVmiqBdIA|{|(Yy;i@XzJQ?&=N7hPX$tEaz%2o>(CT`i?IeUH9UZ1nKWbG|E7<}!W z^OkEeOutL^CqMI4Txri$wr4BbXX81~_9f5ux!6s&@6G;i_1~&)oqaOb{#dsCv3zyY z%=og^Tu}+BwxTlc-*U%O<|$t@3*|dd3;!Q`w%=uD+c8)M#Rv40EzpF`Udqp zv*Ayc7X*3I6g{A#p4grn_~~qq+uBL{rE_lUGF`46XLt9~XSJiARm*+oLRdWbiY^)h zTVmC&v!4ojTRhisGCHLOjV2uYw`dEi9%_Gw_6++7@24;f_IbV9>%Y^e@*gurgd^g5 zJ$q5?Cec<6KJGutKXdb=H$!^S?{(5`?kUu9(ppR|4hBvYywF{HB2Cs zekNX2>-B$9C;2PagsoQR3PsG}imp44 zE}L;>nhacduL%ceffxw3fb$r~MhjSHe^Ig#4p?p6ot9u%62fK!A{W;~#Tu#(TM7sq zjw;TQhH$HwwBq?XjE>f;#8&Fn`eg=n&1<23t{&IeH0Wx@Udxy{?0~r7E0oewMg25w z(ofTR{oK3{Vdr_`SXls3afV$QqlTUln^&zpEnElvg|wCmyCdeXCjzs*Hg{nB0Igv8 zWOtY;hv0x*q{G8;5!F-KKqNu~(qm{+dYq!KBT~xZqmWY4@?Gn=Jk)cLPDx<5#goLj zCCQ;UBTZ4^D^yrLHb9Fx=w`@@H+P9jJWeGn#HMi7@F#R{OQ3VmI!)0{8AuLURvDA0 z*kWUlfD#~jEqKWH3bjnOS?1RqWe1_4i{|5Cx20Z6N2o$e$wue2)~NhqTj}pnmU$=n zs&n1|{ujJ~Pu;}Ld1|g)dOQ7AI`6LdlRZ~nAs6MvscZW*qv?cUiA0i{>rO4e`nU;ne&IT{?Obj*CrPHp+$dx-rew>v$HSEy?))a z*mQi^VXbpcdzQ-uhbL!m%i7y=_U&2w_FFi2@kriRKXVEUsi*vxW~)QR0EDyXN5O(0 z!&?C)?uWNZxlM^SAU6!v6rX(23`m=i3J?0goRvvdYqeIdP&9XWnJx>D{|>w5D9eay zNPECg*0+)S;3x|S!q^HLp)h88P=v+26Lp!4*QVGfJS9F&E#bUG*kt4f$6y2sn~gaU z)4>-6fg6)f;usU27jcjgv*CFUp5uIyu|5n#x<=!?juO}N|AR3}1@Kr|1ol8XFubclokx2cnz zSlL#Bq}M;*!tjP4>sz(_H|M;~3*KguLFxkUZhdF#botHNx|z;*cf7M>v9@E{1?=4z z$TjT0(XfB|WWIU(+@TxI`xe}dw|s%wEjN7I=hC0}9?4g?&;HJh>K${heNufGd~-|p z+%q=<2d;Qv!D!k3{qgs|cJ*sZfumPE`R+s4dTw<0UGXgWf;YQ*-uL{KXa4f_{u}!T z7Q3FK+->=;ee}y}?5gHGy>;%8haAwfPL_{tulERP?RA$IwIz}94J`=3Gze9xLijP3) z%^}Rp3`}BW+C}Masm=dLP_x6)cPuH%6P((!rARbaBA80gQdCP(BSrApQ%x~7Nc{zV znMp+CK=I_71?INpYQa`<+XQ>dsu`(eN@0wY2V;Snht!>N(pujshhpzeBh(bjje@QG zwh7`Il__7Q6adfjy7auRJ9cowYmbW>!QtJa&cyN414s-7k=giSSZdmFY8<6DhfO$6 zjib~NVUI{=-4Qzuq+97gHJNjfwp}QrBh_TcHJE4Z$b};(JZT?PPJwbGY-LAd zZK?xkOuCd|?tqHzB^+4C%>#)kN@K}*iY&4FFgD%2%xi615fIJ5y$qK*xR>EF58)9P z&IzEn9*7eF1#qnX0*OaN@B*em<8!rO79be^F>DA*oO<1FUy z`UHXOQJ@f}CqxVBSaH%aAe`6fBECxyB+;Z$LyKRoPo9>Elp7_|^IFnd# z_skA0xqCjp>D_W$usGV*=p^5Jwwu11x5~1<0C3+g%tA}&xA!iW;pyEBaSA{19Wx6b zm@AL%H-AuDM)B5iiuZ|#i%bqQ8f@87qxu?Df~Cu5!=h~RwxMa&J{8Eh z0t>DHI}h5Db+_c)y;*nfC+=NjZTbyQmRk&n&H!oJ1_lRcB4Qiq4hh_+2;5z)$7^sX zIYM3~M{fCBmf=Nm1a!TscDamFcERacaUgXs@Cl`X#rLfCv1ZOA=3zZx8jPLhv%ABp ze><6mV9GT2!s~z#6F_X8++S+;W`{8}w;l~r+)7!1d5E7zwqJyUR}_35Kbdy8x0h&7 zXk-*#@LV5g;?5PMbAyN3d${mfWD`i*3)Qu@TeZ>DYRbAO*+mPhqoZ_ntY7X~n&@3< z7VahGLPIcDzbjk6Yrbc({_$yVzI_j5c9?KJ^;TxRhZh=q7rck(_fyh-xIjeE1PjE8 zGGxF3xA9>J)v?mni(~NMgiDZu3GH#O`G;IIFVI+aqZ1?qZ?W#A^LjhkqQO;NG?cQ_ z@^MhgNz2ED6dw#auLphkd;_h*F-d>0$?~y8%Ii8TLDs)Ao+%paNaMY~O#!|S#T}yY!Y!=R*=9}*9@vw~~H}X({owY22 z@4rOM>gIDy?%iPXk-L`unSl~?8&aHw59AOjracH!%m|s*9|HXzB4m#v!4GSm5uV0= z8^ecxpzzSj8LnhJcvYCf2c}K}ooPZVKR~Nk*-1V~223n~3D*?b37q&PavQy zA46Ha+4|mj&tm=2X)m^UZR6WteCvy|?zxMLHM^#rkU8B|SN6=fU{d?o)&73f_o`q) z>2ciw#}x;Go=)wVl-K@l2hJAAEovGtj(yZN)$z4Ot<)~6QS z&A058IeT5!UN_US(6n>OzAN7xoc;>VnCPhU9|(2!&h#yKd*^IOE!cY*veBsjFEJ1( zcTdpV5v5w!oBn^(ga1yEnE+Bn5eb7h=EfPzcyeSU8pUe6i`)zz3y*UK^M6q#ib(Rw zJc`8Us(c7JfXM`R+QB;k6OvR2LaIuIL|nP_2<*u6ereM1Bx?@}Yw{_D2lXX<{|k5J zr;{-$K75+zP5j1eqT(X!-3TAwU9Sx8`kemJFK&>ZtSf$}@%jBYj5!jP-k*~oggK)j&XkD@5TA*<#$O7RB{H&`_AVIQhSX5gtAq@%RHiLp^=vNEt@sxv#Go~Rm}NW}1ADx9dIDJeeBX~By?K_89oh-R_aaGApa4qW)W>hpvI&1(aVf{;H6 zpr^(41ki|X%W4z&*-tDy-YFc)NWp@U#KvNytD|lZu2p3%#dUE!HG)sP&=e}$HyMzj zEE^Buw$JgEtg5ZKs-A3B&)m>r74%-*qnXfqMpkUBQU)EMcS`}S14AmSRWLUA&ceh=wbWQEBBiE~8!F6`MEYSi4N@ni2(z*c z%qWave*`-UALcnK_2Mc1h0Ko;Et^GA{8ZTgUxn7639g?ATYf5pvO);)&jj~Bntea9 zwEm-T;HSdgf3UcwkN@7YQ{rvg4zYG->umv-+vmj&+>G89a9InB4I&T+qUA^EL=*J7 z(A-kW4qb|N-l=BG8l87q+k4U^!T?6`+Ih=S5pn>cSB6zf1=XrS&C)br|Or+mR_^uGKkV#RuS(@MrSgwrSvW8Ns<))lpN9BY} z2q*}5Wq$*zwgPGaPsOf&v;;`ARjAuFEK|$Z7Nt0NRhYp1_~BGeV!ZoL49o6k5L zMl&Y}_%vY0hehi=<FOlRYxa@VVF{q9P3%62PMaA?I4iSrGEylk3Ucb8skKp-EfOCI&llSyD`9 zku%q^jf&AYJ~(M!XqwXdfnN~Z PE-s_^@#FubUR?G+Zz^zH literal 0 HcmV?d00001 diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index be31b5bd..b9100651 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -828,12 +828,10 @@ fn render_struct_with_flattened_internal_enum( "\nclass {struct_name}(RootModel):\n root: Annotated[\n Union[\n {union_type},\n ],\n Field(discriminator=\"{sanitized_tag}\"),\n ]\n" )); - // Rebuild per-variant models to resolve forward references - output.push_str("\ntry:\n"); - for variant_name in &union_variant_names { - output.push_str(&format!(" {variant_name}.model_rebuild()\n")); - } - output.push_str("except AttributeError:\n pass\n"); + // Note: model_rebuild() for per-variant classes is handled by the global + // rebuild section after namespace classes are defined. Inline rebuild here + // would fail because dotted namespace references (used in type annotations) + // cannot be resolved until namespace classes exist. Ok(output) } From b2f81e35f8ef0d3f822ce77207aa9e29c05c28a9 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 22:52:57 +1300 Subject: [PATCH 33/47] fix: pin mdbook 0.4.x in CI to fix doc build failures mdbook 0.5.x changed the preprocessor JSON protocol, breaking mdbook-keeper compatibility. Pin both tools to compatible versions: - mdbook ~0.4 (0.4.x series) - mdbook-keeper ~0.5 This fixes doc builds that have been failing on main since Jan 2026. Applied to docs.yml, docs-preview.yml workflows. Also: add __pycache__/*.pyc to .gitignore, remove accidentally committed pycache files. --- .github/workflows/docs-preview.yml | 7 ++----- .github/workflows/docs.yml | 19 ++++++++----------- .gitignore | 2 ++ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 4ec85ebe..776f7eef 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -28,16 +28,13 @@ jobs: - name: Install mdBook and mdbook-keeper run: | - # Only install if not already cached if ! command -v mdbook &> /dev/null; then - cargo install mdbook + cargo install mdbook --version "~0.4" fi - if ! command -v mdbook-keeper &> /dev/null; then - cargo install mdbook-keeper + cargo install mdbook-keeper --version "~0.5" fi - - name: Build mdBook documentation run: | cd docs diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 60767139..cff585b9 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -36,19 +36,18 @@ jobs: - name: Install mdBook and mdbook-keeper run: | - # Only install if not already cached + # Pin to mdbook 0.4.x (0.5.x changed preprocessor JSON format, + # breaking mdbook-keeper compatibility) if ! command -v mdbook &> /dev/null; then - cargo install mdbook + cargo install mdbook --version "~0.4" fi - if ! command -v mdbook-keeper &> /dev/null; then - cargo install mdbook-keeper + cargo install mdbook-keeper --version "~0.5" fi - + - name: Test mdBook examples run: | cd docs - # mdbook-keeper runs doctests during build with real dependencies mdbook build # Build and deploy documentation site @@ -75,15 +74,13 @@ jobs: - name: Install mdBook and mdbook-keeper run: | - # Only install if not already cached if ! command -v mdbook &> /dev/null; then - cargo install mdbook + cargo install mdbook --version "~0.4" fi - if ! command -v mdbook-keeper &> /dev/null; then - cargo install mdbook-keeper + cargo install mdbook-keeper --version "~0.5" fi - + - name: Build mdBook documentation run: | cd docs diff --git a/.gitignore b/.gitignore index f08aa97a..b83ae0e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /target docs/book .vscode/settings.json +*.pyc +__pycache__/ From aba10061e3b9151070d43b3ca15e62fbe7b0cb25 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 23:23:25 +1300 Subject: [PATCH 34/47] docs: remove aspirational design doc (implementation took a different approach) --- docs/design/python-namespace-classes.md | 976 ------------------------ 1 file changed, 976 deletions(-) delete mode 100644 docs/design/python-namespace-classes.md diff --git a/docs/design/python-namespace-classes.md b/docs/design/python-namespace-classes.md deleted file mode 100644 index bcb4c06d..00000000 --- a/docs/design/python-namespace-classes.md +++ /dev/null @@ -1,976 +0,0 @@ -# Design: Python Namespace Classes for Module-Structured Types - -## Problem Statement - -Rust types like `myapp::orders::v2::OrderStatus` currently produce Python class names -like `MyappOrdersV2OrderStatus` via the `improve_class_name` function, which -concatenates all `::` segments into PascalCase. This is unreadable and produces poor -developer experience. Meanwhile, the TypeScript codegen already emits nested -`namespace` blocks mirroring the Rust module structure, giving users -`myapp.orders.v2.OrderStatus`. - -## Goal - -Emit Python namespace classes that mirror the Rust module hierarchy: - -```python -class orders: - class v2: - class OrderStatus(BaseModel): - ... -``` - -Users write `orders.v2.OrderStatus` instead of `MyappOrdersV2OrderStatus`. - ---- - -## Current Architecture (Key Code Paths) - -### 1. `improve_class_name` (line ~3786) - -The single bottleneck where Rust qualified names become Python class names. -For `myapp::orders::v2::OrderStatus` it splits on `::`, PascalCases each segment, -and concatenates: `MyappOrdersV2OrderStatus`. - -### 2. `type_ref_to_python_type` (line ~4167) - -Resolves a `TypeReference` to a Python type string. For user-defined types (step 3, -line ~4259), it calls `improve_class_name(&type_ref.name)` to produce the class name -used in annotations. This is where `MyappOrdersV2OrderStatus` appears in field type -annotations. - -### 3. `generate` function (line ~1095) - -The main orchestrator. Key flow: -1. `schema.consolidate_types()` returns `Vec` of all qualified type names. -2. For each type, calls `improve_class_name(type_def.name())` to get the Python name. -3. `rendered_types: BTreeMap` maps Python class name -> rendered code. -4. Types are emitted top-level, then `model_rebuild()` calls, then factory classes. - -### 4. `rendered_types: BTreeMap` (line ~1248) - -Maps the flat Python class name (e.g., `MyappOrdersV2OrderStatus`) to its rendered -class definition string. Used for `model_rebuild()` calls and the testing module's -type list. - -### 5. TypeScript precedent (`modules_from_rendered_types`, typescript.rs:800) - -TypeScript already does exactly what we want: it splits qualified names on `::`, pops -the last segment as the type name, and walks the remaining segments to build a tree of -`Module { name, types, submodules }`. Rendering emits nested `export namespace` blocks. -Type references join `::` segments with `.` (typescript.rs:988). - ---- - -## Design - -### A. Namespace Extraction: `qualified_name_to_python` - -#### Core function signature - -```rust -/// Split a Rust qualified name into (namespace_path, leaf_name). -/// -/// After stripping `strip_prefix` (if it matches), the remaining `::` segments -/// become the namespace path, and the final segment is the leaf type name. -fn qualified_name_to_python( - name: &str, - strip_prefix: &str, -) -> (Vec, String) { - let working_name = if !strip_prefix.is_empty() { - let prefix_with_sep = if strip_prefix.ends_with("::") { - strip_prefix.to_string() - } else { - format!("{}::", strip_prefix) - }; - name.strip_prefix(&prefix_with_sep).unwrap_or(name) - } else { - name - }; - - let parts: Vec<&str> = working_name.split("::").collect(); - if parts.len() <= 1 { - // No module path -- top-level type - return (vec![], parts[0].to_string()); - } - - let leaf = parts.last().unwrap().to_string(); - let namespace: Vec = parts[..parts.len() - 1] - .iter() - .map(|s| s.to_string()) // keep original casing -- these become Python identifiers - .collect(); - - (namespace, leaf) -} -``` - -#### How `strip_prefix` is determined - -The demo app calls `builder.rename_types("reflectapi_demo::", "myapi::")`, which -transforms `reflectapi_demo::model::Pet` to `myapp::model::Pet`. After -`consolidate_types`, the qualified names already have the user's chosen prefix. - -The **common prefix** is the longest shared `::` prefix across all user-defined types. -For the demo, that's `myapi::`. We should compute this automatically: - -```rust -fn compute_common_prefix(type_names: &[String]) -> String { - // Filter to only user-defined types (exclude std::, reflectapi::, chrono::, etc.) - let user_types: Vec<&str> = type_names.iter() - .map(|s| s.as_str()) - .filter(|n| !is_implemented_or_runtime_type(n)) - .collect(); - - if user_types.is_empty() { - return String::new(); - } - - // Split each into :: segments, find common prefix segments - let first_parts: Vec<&str> = user_types[0].split("::").collect(); - let mut common_len = first_parts.len().saturating_sub(1); // never include last (the type name itself) - - for name in &user_types[1..] { - let parts: Vec<&str> = name.split("::").collect(); - let max = parts.len().saturating_sub(1); - common_len = common_len.min(max); - for i in 0..common_len { - if parts[i] != first_parts[i] { - common_len = i; - break; - } - } - } - - if common_len == 0 { - return String::new(); - } - - first_parts[..common_len].join("::") -} -``` - -The `Config` should also accept an optional explicit `strip_prefix` override, since -the auto-detection can be surprising when a schema has types from many different crate -roots: - -```rust -pub struct Config { - // ... existing fields ... - /// Prefix to strip from Rust module paths when generating Python namespaces. - /// If None, the common prefix is auto-detected. - /// If Some(""), no prefix is stripped (all module segments become namespaces). - pub namespace_strip_prefix: Option, -} -``` - -#### Examples - -| Rust qualified name | strip_prefix | namespace_path | leaf_name | -|---|---|---|---| -| `myapp::orders::v2::OrderStatus` | `myapp` | `["orders", "v2"]` | `OrderStatus` | -| `myapp::model::Pet` | `myapp` | `["model"]` | `Pet` | -| `myapp::model::input::Pet` | `myapp` | `["model", "input"]` | `Pet` | -| `myapp::proto::PetsListRequest` | `myapp` | `["proto"]` | `PetsListRequest` | -| `OrderStatus` | `""` | `[]` | `OrderStatus` | -| `std::string::String` | `myapp` | (handled by implemented_types, never reaches this) | - | - -### B. Type Name Mapping: Replace `improve_class_name` - -#### New data structure: `TypeNameMapping` - -```rust -/// Pre-computed mapping from Rust qualified names to Python namespace + leaf names. -struct TypeNameMapping { - /// For each original Rust type name, the Python namespace path and leaf class name. - /// E.g., "myapp::orders::v2::OrderStatus" -> (["orders", "v2"], "OrderStatus") - entries: BTreeMap, String)>, - - /// The dotted Python reference string for each Rust type name. - /// E.g., "myapp::orders::v2::OrderStatus" -> "orders.v2.OrderStatus" - python_refs: BTreeMap, -} - -impl TypeNameMapping { - fn new( - all_type_names: &[String], - implemented_types: &BTreeMap, - strip_prefix: &str, - ) -> Self { - let mut entries = BTreeMap::new(); - let mut python_refs = BTreeMap::new(); - - for name in all_type_names { - if implemented_types.contains_key(name) { - continue; - } - - let (ns_path, leaf) = qualified_name_to_python(name, strip_prefix); - let dotted = if ns_path.is_empty() { - leaf.clone() - } else { - format!("{}.{}", ns_path.join("."), leaf) - }; - - entries.insert(name.clone(), (ns_path, leaf)); - python_refs.insert(name.clone(), dotted); - } - - Self { entries, python_refs } - } - - /// Get the Python reference string for use in type annotations. - /// Returns the dotted path like "orders.v2.OrderStatus". - fn python_ref(&self, rust_name: &str) -> Option<&str> { - self.python_refs.get(rust_name).map(|s| s.as_str()) - } - - /// Get the leaf class name (the name used in the class definition itself). - fn leaf_name(&self, rust_name: &str) -> Option<&str> { - self.entries.get(rust_name).map(|(_, leaf)| leaf.as_str()) - } - - /// Get the namespace path segments. - fn namespace_path(&self, rust_name: &str) -> Option<&[String]> { - self.entries.get(rust_name).map(|(ns, _)| ns.as_slice()) - } -} -``` - -#### Replace `improve_class_name` calls - -`improve_class_name` is called in ~15 places. It must be replaced by lookups into -`TypeNameMapping`: - -- **In class definitions** (the `class Foo(BaseModel):` line): use `leaf_name()`. - The class is *defined* inside its namespace wrapper, so only the leaf is needed. - -- **In type annotations** (field types, union members, function params/returns): use - `python_ref()`. This gives the fully-qualified dotted path like - `orders.v2.OrderStatus`. - -- **In variant class names** (e.g., `MyapiModelBehaviorAggressiveVariant`): these are - derived names. Since the enum itself has a namespace + leaf, the variant class should - live in the same namespace with name `{EnumLeaf}{VariantName}Variant`. E.g., - `BehaviorAggressiveVariant` inside namespace `model`. - -Concretely, every call site for `improve_class_name` must receive the `TypeNameMapping` -(or at least the original Rust qualified name) and choose between `leaf_name` and -`python_ref` depending on context. - -### C. Output Structure: Namespace Module Tree - -#### Data structure (mirroring TypeScript) - -```rust -/// A node in the Python namespace tree. -struct NamespaceNode { - name: String, - /// Rendered type definitions (class bodies) that belong directly to this namespace. - types: Vec, - /// Child namespaces. - children: BTreeMap, -} -``` - -#### Building the tree - -Identical to `modules_from_rendered_types` in TypeScript/Rust codegens: - -```rust -fn build_namespace_tree( - type_names: &[String], // original Rust qualified names - rendered_types: &mut BTreeMap, // leaf_name -> rendered code - mapping: &TypeNameMapping, -) -> NamespaceNode { - let mut root = NamespaceNode { - name: String::new(), - types: vec![], - children: BTreeMap::new(), - }; - - for rust_name in type_names { - if let Some((ns_path, _leaf)) = mapping.entries.get(rust_name) { - let mut node = &mut root; - for segment in ns_path { - node = node.children - .entry(segment.clone()) - .or_insert_with(|| NamespaceNode { - name: segment.clone(), - types: vec![], - children: BTreeMap::new(), - }); - } - // The key in rendered_types needs to be whatever we used when inserting. - // We'll use the dotted python ref as the key. - let python_ref = mapping.python_ref(rust_name).unwrap(); - if let Some(rendered) = rendered_types.remove(python_ref) { - node.types.push(rendered); - } - } - } - - root -} -``` - -#### Rendering the tree to Python - -```rust -impl NamespaceNode { - fn render(&self, indent: usize) -> String { - let pad = " ".repeat(indent); - let mut out = String::new(); - - if !self.name.is_empty() { - // Emit a namespace wrapper class - writeln!(out, "{}class {}:", pad, self.name).unwrap(); - writeln!(out, "{} \"\"\"Namespace for {} types.\"\"\"", pad, self.name).unwrap(); - writeln!(out).unwrap(); - } - - let inner_indent = if self.name.is_empty() { indent } else { indent + 1 }; - let inner_pad = " ".repeat(inner_indent); - - // Emit child namespaces first (they need to be defined before types that - // reference them, though with `from __future__ import annotations` this - // is less critical) - for child in self.children.values() { - out.push_str(&child.render(inner_indent)); - out.push('\n'); - } - - // Emit types in this namespace - for type_code in &self.types { - // Re-indent the rendered type code to sit inside the namespace class - for line in type_code.lines() { - if line.trim().is_empty() { - writeln!(out).unwrap(); - } else { - writeln!(out, "{}{}", inner_pad, line).unwrap(); - } - } - out.push('\n'); - } - - out - } -} -``` - -**Key insight about indentation**: Each type is currently rendered with zero -indentation (top-level class). When nesting inside namespace classes, we must -re-indent every line. This is a simple prepend of `" " * depth` to each -non-empty line. - -#### `from __future__ import annotations` - -The generated file already emits this at the top (line ~8 of generated.py): -```python -from __future__ import annotations -``` - -This means all annotations are strings, so forward references work without quotes. -A type defined later in the file can be referenced by an earlier type. This is -critical -- it means we don't need topological ordering between namespaces. - -#### `model_rebuild()` and namespace classes - -Currently `model_rebuild` calls look like: -```python -MyappOrdersV2OrderStatus.model_rebuild() -``` - -With namespaces, they become: -```python -orders.v2.OrderStatus.model_rebuild() -``` - -This works in Python because `orders.v2.OrderStatus` is a real class object -accessible via attribute lookup. Pydantic's `model_rebuild()` resolves forward -references in the class's module globals. The key requirement: the namespace classes -must be defined **before** `model_rebuild()` is called (which is already the case -- -model rebuilds happen after all type definitions). - -**Verified experimentally (Pydantic 2.12.5)**: Because the generated file uses -`from __future__ import annotations`, all annotations are stored as strings and -only evaluated when `model_rebuild()` is called. At that point, Pydantic evaluates -annotations in the module's global namespace, where all namespace classes are already -defined. This means: - -1. Forward references work even when a namespace class is referenced before its - definition in source order. -2. Cross-namespace references like `payments.PaymentInfo` resolve correctly because - `payments` is a module-global name. -3. `model_rebuild()` works **without** `_types_namespace` in the common case. - -For extra safety (e.g., if the generated file is imported piecemeal or types are -used in unusual evaluation contexts), we can optionally pass `_types_namespace`: - -```python -_ns = { - "orders": orders, - "payments": payments, - "OrderStatus": OrderStatus, # top-level types too - "ReflectapiOption": ReflectapiOption, - "ReflectapiEmpty": ReflectapiEmpty, -} -orders.v2.OrderStatus.model_rebuild(_types_namespace=_ns) -``` - -**Recommended approach**: Start with plain `model_rebuild()` (no `_types_namespace`). -If edge cases surface, add the namespace dict as a follow-up. The simpler generation -is preferred since it produces cleaner output and the experimental validation confirms -it works. - -### D. Reference Format: Changes to `type_ref_to_python_type` - -#### Current behavior - -At line ~4275: -```rust -let base_type = improve_class_name(&type_ref.name); -``` - -This produces `MyappOrdersV2OrderStatus`. - -#### New behavior - -Replace with a lookup into `TypeNameMapping`: - -```rust -// In type_ref_to_python_type, step 3 (user-defined type found in schema): -let base_type = mapping - .python_ref(&type_ref.name) - .unwrap_or_else(|| improve_class_name(&type_ref.name)); -// improve_class_name kept as fallback for unexpected types -``` - -This produces `orders.v2.OrderStatus` -- the dotted path. - -#### Cross-namespace references - -When type A in namespace `orders` references type B in namespace `payments`: - -```python -class orders: - class v2: - class OrderStatus(BaseModel): - payment: payments.PaymentInfo # cross-namespace ref -``` - -Because `from __future__ import annotations` is active, `payments.PaymentInfo` is a -string at class-definition time and only resolved during `model_rebuild()`. As long as -the `_types_namespace` dict contains `"payments": payments`, this resolves correctly. - -#### Same-namespace references - -When type A references type B in the same namespace: - -```python -class model: - class Pet(BaseModel): - kind: model.Kind # same-namespace, still use full dotted path -``` - -We always use the full dotted path from root, never relative paths. This is simpler -and avoids ambiguity. The alternative (using just `Kind` for same-namespace -references) would require tracking "current namespace" context through -`type_ref_to_python_type`, which is fragile and unnecessary given -`from __future__ import annotations`. - -### E. Client Methods - -#### Current behavior - -```python -class PetsClient: - async def list(self, ...) -> ApiResponse[MyapiProtoPaginated[MyapiModelOutputPet]]: - ... -``` - -#### New behavior - -```python -class PetsClient: - async def list(self, ...) -> ApiResponse[proto.Paginated[model.output.Pet]]: - ... -``` - -The change flows naturally through `render_function` -> `type_ref_to_python_type`, -which now returns dotted paths. No special handling needed for the client class itself. - -The client class is defined at top level (not inside a namespace), so it references -types using their full dotted paths from the module root. - -### F. Collision Handling - -#### Same leaf name, different namespaces (the happy path) - -``` -myapp::orders::OrderStatus -> orders.OrderStatus -myapp::payments::OrderStatus -> payments.OrderStatus -``` - -No collision. This is the entire point of namespacing. - -#### Same leaf name, same namespace - -This can happen if `consolidate_types` inserts `input`/`output` discriminators: - -``` -myapp::model::input::Pet -> model.input.Pet -myapp::model::output::Pet -> model.output.Pet -``` - -These end up in different sub-namespaces (`input` vs `output`), so no collision. - -#### True collision: same namespace, same leaf name - -This would require two types with identical Rust qualified names after stripping, -which `consolidate_types` prevents. But as a safety net: - -```rust -impl TypeNameMapping { - fn new(...) -> Self { - // ... build entries ... - - // Detect collisions: same (namespace_path, leaf_name) for different Rust names - let mut seen: BTreeMap<(Vec, String), String> = BTreeMap::new(); - for (rust_name, (ns_path, leaf)) in &entries { - let key = (ns_path.clone(), leaf.clone()); - if let Some(existing_rust_name) = seen.get(&key) { - // Collision! Disambiguate by prepending the distinguishing - // module segment to the leaf name. - // This is a fallback -- should rarely trigger. - // Strategy: use the full PascalCase concatenation for the - // colliding types (falling back to current behavior). - warn!("Python namespace collision: {} and {} both map to {}.{}", - existing_rust_name, rust_name, ns_path.join("."), leaf); - } - seen.insert(key, rust_name.clone()); - } - } -} -``` - -For the fallback, we can use the current `improve_class_name` behavior (PascalCase -concatenation) and place the type at the root level, or we can add a distinguishing -segment from the Rust name. This should be rare enough that a simple fallback suffices. - -#### Python keyword collisions in namespace names - -Namespace segments like `import`, `class`, `type` are Python keywords and can't be -class names. Apply `safe_python_identifier` to each namespace segment: - -```rust -let namespace: Vec = parts[..parts.len() - 1] - .iter() - .map(|s| safe_python_identifier(s)) - .collect(); -``` - -This might produce `type_` for a module named `type`. Acceptable trade-off. - ---- - -## Changes Required (Function by Function) - -### 1. `Config` struct (line ~19) - -Add: -```rust -pub namespace_strip_prefix: Option, -``` - -### 2. New: `TypeNameMapping` struct and `qualified_name_to_python` function - -As described above. Add these near `improve_class_name`. - -### 3. `generate` function (line ~1095) - -After `consolidate_types()`, before the rendering loop: - -```rust -let strip_prefix = config.namespace_strip_prefix.clone() - .unwrap_or_else(|| compute_common_prefix(&all_type_names)); -let type_mapping = TypeNameMapping::new(&all_type_names, &implemented_types, &strip_prefix); -``` - -Thread `type_mapping` through to all render functions and `type_ref_to_python_type`. - -Change `rendered_types` key from `improve_class_name(type_def.name())` to -`type_mapping.python_ref(original_type_name)`. - -Replace the current "Generate nested class structure" block (line ~1350-1355) with -the new namespace tree build + render. - -Change `model_rebuild()` emission to use dotted paths and pass `_types_namespace`. - -### 4. `improve_class_name` (line ~3786) - -Keep as a fallback for types not in the mapping (shouldn't happen, but defensive). -All call sites that currently use `improve_class_name` switch to `TypeNameMapping` -lookups: - -| Call site context | Use `leaf_name()` or `python_ref()`? | -|---|---| -| Class definition name (`class Foo(BaseModel)`) | `leaf_name()` | -| Type annotation in field | `python_ref()` | -| Union member name | `python_ref()` | -| Variant class name derivation | `leaf_name()` of parent + variant suffix | -| Factory class name | `python_ref()` of parent + `Factory` suffix | -| `model_rebuild()` call | `python_ref()` | -| Client return type | `python_ref()` | -| Testing module type list | `python_ref()` | - -### 5. `type_ref_to_python_type` (line ~4167) - -Add `type_mapping: &TypeNameMapping` parameter. At line ~4275: - -```rust -// Old: -let base_type = improve_class_name(&type_ref.name); -// New: -let base_type = type_mapping - .python_ref(&type_ref.name) - .map(|s| s.to_string()) - .unwrap_or_else(|| improve_class_name(&type_ref.name)); -``` - -### 6. `render_struct`, `render_enum_without_factory`, and all variant renderers - -These all call `improve_class_name(&def.name)` for the class name in the `class` -statement. Change to `type_mapping.leaf_name(&def.name)` since the class definition -lives inside its namespace wrapper. - -For variant class names derived from the parent enum, use: -```rust -let variant_class_name = format!( - "{}{}Variant", - type_mapping.leaf_name(&enum_def.name).unwrap(), - to_pascal_case(variant.name()), -); -``` - -### 7. `generate_nested_class_structure` and related functions (line ~3886) - -**Remove entirely**. This ad-hoc namespace grouping (hardcoded `MyapiModel` prefix -detection, manual `Pet` and `Kind` grouping) is replaced by the systematic namespace -tree. - -### 8. Templates: `DataClass`, `EnumClass`, etc. - -No changes needed to template structs themselves. They already take a `name: String` -field. We just pass the leaf name instead of the concatenated name. - ---- - -## Concrete Example - -### Input schema (after consolidate_types) - -Type names: -- `myapp::model::Pet` (struct, used as both input and output, so consolidate_types - will have split it) -- `myapp::model::input::Pet` (input variant) -- `myapp::model::output::Pet` (output variant) -- `myapp::model::Kind` (internally tagged enum) -- `myapp::model::KindDog` (variant struct) -- `myapp::model::KindCat` (variant struct) -- `myapp::proto::PetsListRequest` (struct) -- `myapp::proto::Paginated` (generic struct) -- `myapp::HealthCheckFail` (struct, shallow path) - -### Config - -```rust -namespace_strip_prefix: None // auto-detects "myapp" -``` - -### Computed mapping (strip_prefix = "myapp") - -| Rust name | namespace_path | leaf_name | python_ref | -|---|---|---|---| -| `myapp::model::input::Pet` | `["model", "input"]` | `Pet` | `model.input.Pet` | -| `myapp::model::output::Pet` | `["model", "output"]` | `Pet` | `model.output.Pet` | -| `myapp::model::Kind` | `["model"]` | `Kind` | `model.Kind` | -| `myapp::model::KindDog` | `["model"]` | `KindDog` | `model.KindDog` | -| `myapp::model::KindCat` | `["model"]` | `KindCat` | `model.KindCat` | -| `myapp::proto::PetsListRequest` | `["proto"]` | `PetsListRequest` | `proto.PetsListRequest` | -| `myapp::proto::Paginated` | `["proto"]` | `Paginated` | `proto.Paginated` | -| `myapp::HealthCheckFail` | `[]` | `HealthCheckFail` | `HealthCheckFail` | - -### Generated output (simplified) - -```python -from __future__ import annotations -# ... imports ... - - -class HealthCheckFail(BaseModel): - """Generated data model.""" - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class model: - """Namespace for model types.""" - - class input: - """Namespace for input types.""" - - class Pet(BaseModel): - """Input pet model.""" - model_config = ConfigDict(extra="ignore", populate_by_name=True) - name: str - kind: model.Kind - age: int | None = None - - class output: - """Namespace for output types.""" - - class Pet(BaseModel): - """Output pet model.""" - model_config = ConfigDict(extra="ignore", populate_by_name=True) - name: str - kind: model.Kind - age: int | None = None - - class KindDog(BaseModel): - """Dog variant""" - model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["dog"] = "dog" - breed: str - - class KindCat(BaseModel): - """Cat variant""" - model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["cat"] = "cat" - lives: int - - Kind = Union[model.KindDog, model.KindCat] - - -class proto: - """Namespace for proto types.""" - - class PetsListRequest(BaseModel): - """Generated data model.""" - model_config = ConfigDict(extra="ignore", populate_by_name=True) - cursor: str | None = None - limit: int | None = None - - class Paginated(BaseModel, Generic[T]): - """Generated data model.""" - model_config = ConfigDict(extra="ignore", populate_by_name=True) - items: list[T] - cursor: str | None = None - - -# Client classes -class AsyncPetsClient: - async def list(self, request: proto.PetsListRequest, ...) -> ApiResponse[proto.Paginated[model.output.Pet]]: - ... - - -# Rebuild models to resolve forward references -try: - HealthCheckFail.model_rebuild() - model.input.Pet.model_rebuild() - model.output.Pet.model_rebuild() - model.KindDog.model_rebuild() - model.KindCat.model_rebuild() - proto.PetsListRequest.model_rebuild() - proto.Paginated.model_rebuild() -except AttributeError: - pass -``` - ---- - -## Edge Cases - -### 1. Types with no module path - -`HealthCheckFail` (after stripping `myapp::`) has no `::` separators. It goes to the -root level with no namespace wrapper. This matches current behavior. - -### 2. Generic types across namespaces - -`proto.Paginated[model.output.Pet]` -- the generic parameter uses the full dotted path. -This works because `type_ref_to_python_type` recursively resolves arguments, and each -argument lookup produces a dotted path. - -### 3. Variant classes derived from enums - -Variant structs like `KindDog` already exist as separate types in the schema (after -consolidation). They get their own mapping entries and land in the same namespace as -their parent enum. Their names are already unique within the namespace because the -Rust names include the enum prefix. - -For *generated* variant classes (those created during `render_enum_without_factory` for -variants with fields), the naming uses `format!("{}{}Variant", leaf_name, variant)`. -These are emitted inline in the same rendered code block as the parent enum, so they -automatically land in the same namespace. - -### 4. Factory classes - -Factory classes are currently emitted after `model_rebuild()`. Their names should use -the dotted path: `model.KindFactory`. However, factories are generated as standalone -classes, not inside namespace wrappers. Two options: - -**Option A** (simpler): Keep factories at top level with dotted-path-derived names: -```python -class model_KindFactory: - ... -``` - -**Option B** (consistent): Generate factory classes inside the namespace tree too. -This requires either a second rendering pass or collecting factory code into the -namespace tree before rendering. - -**Recommendation**: Option B. Add factory code to the namespace node during the -factory generation phase, then render the full tree (including factories) at the end. -This keeps the API surface clean: `model.KindFactory`. - -### 5. `from __future__ import annotations` and namespace self-reference - -Inside `class model`, a type annotation `model.Kind` refers to the *enclosing class* -before it's fully defined. With `from __future__ import annotations`, this is fine -because the annotation is never evaluated at class-definition time. - -### 6. Empty namespace segments - -If `strip_prefix` removes all segments except the leaf, there's no namespace: -``` -strip_prefix = "myapp::model" -name = "myapp::model::Pet" -result = ([], "Pet") # top-level -``` - -This is correct behavior. - -### 7. Deeply nested namespaces - -``` -myapp::services::orders::v2::internal::OrderStatus -strip_prefix = "myapp" -result = (["services", "orders", "v2", "internal"], "OrderStatus") -``` - -Produces: -```python -class services: - class orders: - class v2: - class internal: - class OrderStatus(BaseModel): ... -``` - -This mirrors the Rust module structure faithfully. Users who want flatter namespaces -can use `rename_types` on the builder to collapse modules before codegen. - -### 8. Testing module - -The testing module currently lists type names for `MockClient`. Change from: -```python -types = ["MyappOrdersV2OrderStatus", ...] -``` -To: -```python -types = ["orders.v2.OrderStatus", ...] -``` - -The testing utilities need to be able to look up types by dotted path. This may -require the testing module to receive the `_ns` dict or use `eval()` on dotted paths. -Alternatively, build a flat lookup dict: - -```python -_all_types = { - "orders.v2.OrderStatus": orders.v2.OrderStatus, - "model.Pet": model.Pet, - ... -} -``` - ---- - -## Migration and Backwards Compatibility - -This is a **breaking change** to the generated Python API surface. Users referencing -`MyappModelPet` must change to `model.Pet`. - -**Mitigation options**: - -1. **Feature flag**: Add `pub use_namespaces: bool` to `Config` (default `false` - initially, flip to `true` in a major version). - -2. **Compatibility aliases**: After the namespace tree, emit: - ```python - # Backwards compatibility aliases - MyappModelPet = model.Pet - MyappModelKind = model.Kind - ``` - These can be gated behind a `Config` flag and deprecated. - -3. **Major version bump**: Since this is a new feature branch, ship it as part of - a major version release. - -**Recommendation**: Feature flag with default `true` for new users, but provide -the compatibility aliases for one major version cycle. - ---- - -## Key Architectural Decision: Render-then-Indent vs. Indent-Aware Rendering - -Two approaches for handling indentation inside namespace classes: - -**Approach 1: Render-then-Indent (recommended)** - -Types are rendered as top-level classes (zero indentation), same as today. The -namespace tree's `render()` method re-indents each line by prepending spaces. This -is how the TypeScript codegen works (namespace blocks wrap already-rendered types). - -Pros: -- Minimal changes to existing render functions. -- Template structs unchanged. -- Easy to reason about -- rendering and namespacing are separate concerns. - -Cons: -- Re-indentation is a string operation that happens after rendering. -- If any rendered code contains string literals with significant whitespace, the - re-indentation could corrupt them. In practice, Pydantic models don't have this. - -**Approach 2: Indent-Aware Rendering** - -Pass an `indent_level: usize` through all render functions and templates, so each -template emits code at the correct indentation depth from the start. - -Pros: -- No post-hoc string manipulation. -- Theoretically "cleaner" output. - -Cons: -- Massive refactor: every template's `render()` needs an indent parameter. -- Much larger diff for a marginal benefit. - -**Decision**: Approach 1. The TypeScript/Rust codegens both use this pattern -successfully. The re-indentation is trivial and well-contained in one function. - ---- - -## Implementation Order - -1. Add `qualified_name_to_python` and `compute_common_prefix` (pure functions, easy - to unit test). -2. Add `TypeNameMapping` struct. -3. Thread `TypeNameMapping` through `type_ref_to_python_type` (biggest refactor -- - touches many function signatures). -4. Build `NamespaceNode` tree and render function. -5. Wire into `generate`: replace `rendered_types` keying, replace - `generate_nested_class_structure`, update `model_rebuild` emission. -6. Update factory class generation to use namespace tree. -7. Update testing module. -8. Remove `generate_nested_class_structure`, `extract_namespace_from_type_name`, - `generate_namespace_class` (the old ad-hoc code). -9. Add `Config` fields and feature flag. -10. Update snapshot tests / demo generated.py. From 61f8a95d601d2f1703a1ca98df20e52cb34b9768 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 23:26:53 +1300 Subject: [PATCH 35/47] docs: fix inaccuracies in architecture doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TypeScript no longer uses askama (removed in #122), uses std::fmt::Write - Python is no longer experimental — validated against production API - Python section updated to document namespace classes, alias handling, docstring escaping, factory type annotations - Python flatten example updated to show actual type_ alias pattern - Limitations section references #127 for remaining DX improvements --- docs/architecture.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 4b587c9e..fa379efd 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -318,7 +318,7 @@ All backends live in `reflectapi/src/codegen/`. Each reads the `Schema` directly ### TypeScript -Uses the `askama` template engine. Key design decisions: +Uses `std::fmt::Write` for code generation. Key design decisions: - **Interfaces** for struct types with named fields. - **Type aliases** for tuple structs and transparent wrappers. @@ -336,17 +336,20 @@ Mirrors the source Rust types, re-emitting struct/enum definitions with appropri - Generates a client module with async functions for each endpoint. - Output is formatted with `rustfmt`. -### Python (experimental) +### Python -Generates Pydantic v2 models. Key features: +Generates Pydantic v2 models with namespace classes mirroring the Rust module structure. Key features: -- **BaseModel classes** for structs. +- **BaseModel classes** for structs, with `ConfigDict(extra="ignore", populate_by_name=True)`. +- **Namespace alias classes** mirror the Rust module hierarchy for dotted access (e.g., `auth.UsersSignInRequest`). Type definitions are at module top-level with flat PascalCase names; namespace classes provide aliases. - **Discriminated unions** (`Union[..., Field(discriminator="tag")]`) for internally-tagged enums. -- **RootModel** wrappers for union types and single-field tuple structs. +- **RootModel** wrappers with `model_validator`/`model_serializer` for externally-tagged and adjacently-tagged enums. - **Per-variant model expansion** for `#[serde(flatten)]` with internally-tagged enums (see Section 6). -- **Field aliases** for serde-renamed fields. -- **Literal types** for discriminator fields. -- Python reserved words are sanitized in field names with alias mapping. +- **Field aliases** via `Field(serialization_alias=..., validation_alias=...)` for serde-renamed fields and underscore-prefixed fields. +- **Literal types** for discriminator fields, with alias handling for Python reserved words (e.g., `type` becomes `type_`). +- **Factory classes** with type-annotated parameters for ergonomic enum variant construction. +- **Docstring escaping** for descriptions containing backslashes or triple-quotes. +- Python reserved words are sanitized in field names, method names, and parameters. - Output is formatted with `ruff`. ### OpenAPI @@ -419,19 +422,19 @@ When a struct flattens an internally-tagged enum, per-variant models are generat class RequestCreate(BaseModel): """'Create' variant of Request""" id: str - type: Literal['Create'] = "Create" + type_: Literal['Create'] = Field(default="Create", serialization_alias='type', validation_alias='type') name: str class RequestDelete(BaseModel): """'Delete' variant of Request""" id: str - type: Literal['Delete'] = "Delete" + type_: Literal['Delete'] = Field(default="Delete", serialization_alias='type', validation_alias='type') reason: str | None = None class Request(RootModel): root: Annotated[ Union[RequestCreate, RequestDelete], - Field(discriminator="type"), + Field(discriminator="type_"), ] ``` @@ -484,4 +487,4 @@ Cycle detection uses Tarjan's SCC algorithm. The `Boxing` strategy is a no-op be ### Python codegen coverage -Marked experimental. Generics and complex nested flatten scenarios have incomplete coverage. +Validated against a production 284-endpoint API (Partly's core-server). DX improvements tracked in #127: field descriptions, namespace reduction, compact error types, typed error returns. From 0f4f58a916deb3fcd28cfb9ba942cfb53a782a16 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 23:37:18 +1300 Subject: [PATCH 36/47] docs: remove issue reference, state facts not future work --- docs/architecture.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture.md b/docs/architecture.md index fa379efd..441910be 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -487,4 +487,4 @@ Cycle detection uses Tarjan's SCC algorithm. The `Boxing` strategy is a no-op be ### Python codegen coverage -Validated against a production 284-endpoint API (Partly's core-server). DX improvements tracked in #127: field descriptions, namespace reduction, compact error types, typed error returns. +Validated against a production 284-endpoint API (57K-line generated client, 284 endpoints). Remaining gaps: field descriptions not propagated to Pydantic `Field(description=...)`, externally-tagged enums generate more boilerplate than TypeScript equivalents, error types not included in client method return signatures. From 0de854336ab50f49ecc45b8aa2c86715756a4cd2 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sat, 28 Mar 2026 23:44:10 +1300 Subject: [PATCH 37/47] feat(python): propagate field descriptions and typed error returns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Field descriptions: - Schema field descriptions now emitted as Field(description="...") in generated Pydantic models. Descriptions appear in IDE hover, model_json_schema(), and help() output. - Added sanitize_for_string_literal() to escape newlines, quotes, and backslashes in description strings. - Flattened-field internal descriptions (prefixed "(flattened") are filtered out as they're implementation details. Typed error returns: - Client methods now return ApiResponse[OutputType, ErrorType] instead of ApiResponse[Any], making the error type visible in the signature and IDE autocompletion. - ApiResponse runtime class updated to Generic[T, E] (backward compatible — ApiResponse[T] still works). - Docstring return section shows both success and error types. Validated against Partly's core-server (284 endpoints): - All field descriptions preserved including multi-line ones - All error types visible in method signatures - Generated 57K-line client passes py_compile --- reflectapi-demo/clients/python/generated.py | 134 ++++++++++-------- ...__basic__reflectapi_enum_documented-4.snap | 4 +- ...basic__reflectapi_struct_documented-4.snap | 2 +- ...lly_tagged_enum_with_tuple_variants-5.snap | 4 +- ...ally_tagged_enum_with_unit_variants-5.snap | 6 +- ...adj_repr_enum_with_untagged_variant-5.snap | 10 +- ...e__empty_variants_internally_tagged-5.snap | 6 +- ...xed_variant_types_internally_tagged-5.snap | 6 +- ...ectapi_demo__tests__serde__enum_tag-5.snap | 8 +- ...sts__serde__enum_with_many_variants-5.snap | 26 ++-- ...sts__serde__enum_with_variant_other-5.snap | 8 +- ...latten_enum_with_unit_variants_only-5.snap | 24 +++- ...s__serde__flatten_internally_tagged-5.snap | 2 +- ...latten_internally_tagged_enum_field-5.snap | 14 +- ...ten_optional_internally_tagged_enum-5.snap | 8 +- ...n_struct_and_internal_enum_combined-5.snap | 14 +- ...rde__nested_internally_tagged_enums-5.snap | 16 +-- ...ted_internally_tagged_enums_minimal-5.snap | 6 +- ..._newtype_variants_internally_tagged-5.snap | 4 +- .../src/reflectapi_runtime/response.py | 12 +- reflectapi/src/codegen/python.rs | 85 +++++++---- 21 files changed, 250 insertions(+), 149 deletions(-) diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index efa92485..29d34b9d 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -56,7 +56,7 @@ class MyapiProtoHeaders(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - authorization: str + authorization: str = Field(description="Authorization header") class MyapiProtoInternalError(BaseModel): @@ -128,7 +128,7 @@ class MyapiProtoPetsRemoveRequest(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - name: str + name: str = Field(description="identity") class MyapiProtoValidationA(BaseModel): @@ -144,8 +144,8 @@ class MyapiProtoPaginated(BaseModel, Generic[T]): model_config = ConfigDict(extra="ignore", populate_by_name=True) - items: list[T] - cursor: str | None = None + items: list[T] = Field(description="slice of a collection") + cursor: str | None = Field(default=None, description="cursor for getting next page") class MyapiProtoPetsListRequest(BaseModel): @@ -162,7 +162,9 @@ class MyapiProtoPetsListErrorInvalidCursor(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - kind: Literal["InvalidCursor"] = "InvalidCursor" + kind: Literal["InvalidCursor"] = Field( + default="InvalidCursor", description="Discriminator field" + ) class MyapiProtoPetsListErrorUnauthorized(BaseModel): @@ -170,7 +172,9 @@ class MyapiProtoPetsListErrorUnauthorized(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - kind: Literal["Unauthorized"] = "Unauthorized" + kind: Literal["Unauthorized"] = Field( + default="Unauthorized", description="Discriminator field" + ) class MyapiProtoPetsListErrorInternal(BaseModel): @@ -178,7 +182,9 @@ class MyapiProtoPetsListErrorInternal(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - kind: Literal["Internal"] = "Internal" + kind: Literal["Internal"] = Field( + default="Internal", description="Discriminator field" + ) message: str @@ -242,10 +248,16 @@ class MyapiProtoPetsUpdateRequest(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - name: str - kind: myapi.model.Kind | None = None - age: ReflectapiOption[int] = None - behaviors: ReflectapiOption[list[myapi.model.Behavior]] = None + name: str = Field(description="identity") + kind: myapi.model.Kind | None = Field( + default=None, description="kind of pet, non nullable in the model" + ) + age: ReflectapiOption[int] = Field( + default=None, description="age of the pet, nullable in the model" + ) + behaviors: ReflectapiOption[list[myapi.model.Behavior]] = Field( + default=None, description="behaviors of the pet, nullable in the model" + ) class MyapiProtoPetsUpdateErrorValidationVariant(BaseModel): @@ -309,8 +321,8 @@ class MyapiModelBehaviorAggressiveVariant(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_0: float - field_1: str + field_0: float = Field(description="aggressiveness level") + field_1: str = Field(description="some notes") class MyapiModelBehaviorOtherVariant(BaseModel): @@ -318,8 +330,10 @@ class MyapiModelBehaviorOtherVariant(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - description: str - notes: str | None = None + description: str = Field(description="Custom provided description of a behavior") + notes: str | None = Field( + default=None, description="Additional notes\nUp to a user to put free text here" + ) # Externally tagged enum using RootModel @@ -380,8 +394,8 @@ class MyapiModelKindDog(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["dog"] = "dog" - breed: str + type: Literal["dog"] = Field(default="dog", description="Discriminator field") + breed: str = Field(description="breed of the dog") class MyapiModelKindCat(BaseModel): @@ -389,8 +403,8 @@ class MyapiModelKindCat(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["cat"] = "cat" - lives: int + type: Literal["cat"] = Field(default="cat", description="Discriminator field") + lives: int = Field(description="lives left") class MyapiModelKindBird(BaseModel): @@ -398,7 +412,7 @@ class MyapiModelKindBird(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["bird"] = "bird" + type: Literal["bird"] = Field(default="bird", description="Discriminator field") class MyapiModelKind(RootModel): @@ -413,11 +427,13 @@ class MyapiModelInputPet(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - name: str - kind: myapi.model.Kind - age: int | None = None + name: str = Field(description="identity") + kind: myapi.model.Kind = Field(description="kind of pet") + age: int | None = Field(default=None, description="age of the pet") updated_at: datetime | None = None - behaviors: list[myapi.model.Behavior] | None = None + behaviors: list[myapi.model.Behavior] | None = Field( + default=None, description="behaviors of the pet" + ) class MyapiModelOutputPet(BaseModel): @@ -425,11 +441,13 @@ class MyapiModelOutputPet(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - name: str - kind: myapi.model.Kind - age: int | None = None + name: str = Field(description="identity") + kind: myapi.model.Kind = Field(description="kind of pet") + age: int | None = Field(default=None, description="age of the pet") updated_at: datetime - behaviors: list[myapi.model.Behavior] | None = None + behaviors: list[myapi.model.Behavior] | None = Field( + default=None, description="behaviors of the pet" + ) # Namespace classes for dotted access to types @@ -492,11 +510,11 @@ def __init__(self, client: AsyncClientBase) -> None: async def check( self, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.HealthCheckFail]: """Check the health of the service Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.HealthCheckFail]: Success=Any, Error=myapi.HealthCheckFail """ path = "/health.check" @@ -519,14 +537,14 @@ async def create( self, data: Optional[myapi.model.input.Pet] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsCreateError]: """Create a new pet Args: data: Request data for the create operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsCreateError]: Success=Any, Error=myapi.proto.PetsCreateError """ path = "/pets.create" @@ -544,14 +562,14 @@ async def delete( self, data: Optional[myapi.proto.PetsRemoveRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsRemoveError]: """Remove an existing pet Args: data: Request data for the delete operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsRemoveError]: Success=Any, Error=myapi.proto.PetsRemoveError .. deprecated:: Use pets.remove instead @@ -578,11 +596,11 @@ async def delete( async def get_first( self, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[myapi.model.output.Pet | None]: + ) -> ApiResponse[myapi.model.output.Pet | None, None]: """Fetch first pet, if any exists Returns: - ApiResponse[myapi.model.output.Pet | None]: Response containing myapi.model.output.Pet | None data + ApiResponse[myapi.model.output.Pet | None, None]: Success=myapi.model.output.Pet | None, Error=None """ path = "/pets.get-first" @@ -599,14 +617,16 @@ async def list( self, data: Optional[myapi.proto.PetsListRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: + ) -> ApiResponse[ + myapi.proto.Paginated[myapi.model.output.Pet], myapi.proto.PetsListError + ]: """List available pets Args: data: Request data for the list operation. Returns: - ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: Response containing myapi.proto.Paginated[myapi.model.output.Pet] data + ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet], myapi.proto.PetsListError]: Success=myapi.proto.Paginated[myapi.model.output.Pet], Error=myapi.proto.PetsListError """ path = "/pets.list" @@ -624,14 +644,14 @@ async def remove( self, data: Optional[myapi.proto.PetsRemoveRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsRemoveError]: """Remove an existing pet Args: data: Request data for the remove operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsRemoveError]: Success=Any, Error=myapi.proto.PetsRemoveError """ path = "/pets.remove" @@ -649,14 +669,14 @@ async def update( self, data: Optional[myapi.proto.PetsUpdateRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsUpdateError]: """Update an existing pet Args: data: Request data for the update operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsUpdateError]: Success=Any, Error=myapi.proto.PetsUpdateError """ path = "/pets.update" @@ -694,11 +714,11 @@ def __init__(self, client: ClientBase) -> None: def check( self, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.HealthCheckFail]: """Check the health of the service Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.HealthCheckFail]: Success=Any, Error=myapi.HealthCheckFail """ path = "/health.check" @@ -721,14 +741,14 @@ def create( self, data: Optional[myapi.model.input.Pet] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsCreateError]: """Create a new pet Args: data: Request data for the create operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsCreateError]: Success=Any, Error=myapi.proto.PetsCreateError """ path = "/pets.create" @@ -746,14 +766,14 @@ def delete( self, data: Optional[myapi.proto.PetsRemoveRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsRemoveError]: """Remove an existing pet Args: data: Request data for the delete operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsRemoveError]: Success=Any, Error=myapi.proto.PetsRemoveError .. deprecated:: Use pets.remove instead @@ -780,11 +800,11 @@ def delete( def get_first( self, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[myapi.model.output.Pet | None]: + ) -> ApiResponse[myapi.model.output.Pet | None, None]: """Fetch first pet, if any exists Returns: - ApiResponse[myapi.model.output.Pet | None]: Response containing myapi.model.output.Pet | None data + ApiResponse[myapi.model.output.Pet | None, None]: Success=myapi.model.output.Pet | None, Error=None """ path = "/pets.get-first" @@ -801,14 +821,16 @@ def list( self, data: Optional[myapi.proto.PetsListRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: + ) -> ApiResponse[ + myapi.proto.Paginated[myapi.model.output.Pet], myapi.proto.PetsListError + ]: """List available pets Args: data: Request data for the list operation. Returns: - ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet]]: Response containing myapi.proto.Paginated[myapi.model.output.Pet] data + ApiResponse[myapi.proto.Paginated[myapi.model.output.Pet], myapi.proto.PetsListError]: Success=myapi.proto.Paginated[myapi.model.output.Pet], Error=myapi.proto.PetsListError """ path = "/pets.list" @@ -826,14 +848,14 @@ def remove( self, data: Optional[myapi.proto.PetsRemoveRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsRemoveError]: """Remove an existing pet Args: data: Request data for the remove operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsRemoveError]: Success=Any, Error=myapi.proto.PetsRemoveError """ path = "/pets.remove" @@ -851,14 +873,14 @@ def update( self, data: Optional[myapi.proto.PetsUpdateRequest] = None, headers: Optional[myapi.proto.Headers] = None, - ) -> ApiResponse[Any]: + ) -> ApiResponse[Any, myapi.proto.PetsUpdateError]: """Update an existing pet Args: data: Request data for the update operation. Returns: - ApiResponse[Any]: Response containing Any data + ApiResponse[Any, myapi.proto.PetsUpdateError]: Success=Any, Error=myapi.proto.PetsUpdateError """ path = "/pets.update" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap index 5c65b944..0918fc08 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap @@ -47,7 +47,7 @@ class ReflectapiDemoTestsBasicTestEnumDocumentedVariant1Variant(BaseModel, Gener model_config = ConfigDict(extra="ignore", populate_by_name=True) - field_0: T + field_0: T = Field(description="variant1 field docs") class ReflectapiDemoTestsBasicTestEnumDocumentedVariant2Variant(BaseModel, Generic[T]): @@ -55,7 +55,7 @@ class ReflectapiDemoTestsBasicTestEnumDocumentedVariant2Variant(BaseModel, Gener model_config = ConfigDict(extra="ignore", populate_by_name=True) - named_field: T + named_field: T = Field(description="named field variant2 field docs") # Externally tagged enum using RootModel diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap index 23d14461..7b88f33f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap @@ -32,7 +32,7 @@ class ReflectapiDemoTestsBasicTestStructDocumented(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: int + f: int = Field(description="field docs\nmultiline") # Namespace classes for dotted access to types diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap index e2ccd104..f8482871 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap @@ -38,8 +38,8 @@ class ReflectapiDemoTestsEnumsEA(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["a"] = "a" - value: reflectapi_demo.tests.enums.A + type: Literal["a"] = Field(default="a", description="Discriminator field") + value: reflectapi_demo.tests.enums.A = Field(description="Tuple variant value") class ReflectapiDemoTestsEnumsE(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap index 6707964e..efa7d1d5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsEnumsAX(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["X"] = "X" + type: Literal["X"] = Field(default="X", description="Discriminator field") class ReflectapiDemoTestsEnumsAY(BaseModel): @@ -39,8 +39,8 @@ class ReflectapiDemoTestsEnumsAY(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Y"] = "Y" - value: None + type: Literal["Y"] = Field(default="Y", description="Discriminator field") + value: None = Field(description="Tuple variant value") class ReflectapiDemoTestsEnumsA(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap index 902ac5e4..f9c4677c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap @@ -31,7 +31,9 @@ class ReflectapiDemoTestsSerdeTestVariant1(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Variant1"] = "Variant1" + type: Literal["Variant1"] = Field( + default="Variant1", description="Discriminator field" + ) field_name: int @@ -40,8 +42,10 @@ class ReflectapiDemoTestsSerdeTestVariant2(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Variant2"] = "Variant2" - value: str + type: Literal["Variant2"] = Field( + default="Variant2", description="Discriminator field" + ) + value: str = Field(description="Tuple variant value") class ReflectapiDemoTestsSerdeTest(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap index 29c2abbd..216aaa1c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Empty"] = "Empty" + type: Literal["Empty"] = Field(default="Empty", description="Discriminator field") class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct(BaseModel): @@ -39,7 +39,9 @@ class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct(BaseMo model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["EmptyStruct"] = "EmptyStruct" + type: Literal["EmptyStruct"] = Field( + default="EmptyStruct", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap index 9b4899c5..e061a5aa 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeMixedUnit(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Unit"] = "Unit" + type: Literal["Unit"] = Field(default="Unit", description="Discriminator field") class ReflectapiDemoTestsSerdeMixedWrap(BaseModel): @@ -39,7 +39,7 @@ class ReflectapiDemoTestsSerdeMixedWrap(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Wrap"] = "Wrap" + type: Literal["Wrap"] = Field(default="Wrap", description="Discriminator field") value: str @@ -48,7 +48,7 @@ class ReflectapiDemoTestsSerdeMixedFull(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Full"] = "Full" + type: Literal["Full"] = Field(default="Full", description="Discriminator field") x: int y: int diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap index 9ebde453..ec1b2f99 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap @@ -31,7 +31,9 @@ class ReflectapiDemoTestsSerdeTestEnumTagVariant1(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Variant1"] = "Variant1" + type: Literal["Variant1"] = Field( + default="Variant1", description="Discriminator field" + ) field_name: int @@ -40,7 +42,9 @@ class ReflectapiDemoTestsSerdeTestEnumTagVariant2(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Variant2"] = "Variant2" + type: Literal["Variant2"] = Field( + default="Variant2", description="Discriminator field" + ) field_name: int diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap index 50bd7ce9..c773821c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeLargeEnumAlpha(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Alpha"] = "Alpha" + type: Literal["Alpha"] = Field(default="Alpha", description="Discriminator field") class ReflectapiDemoTestsSerdeLargeEnumBeta(BaseModel): @@ -39,7 +39,7 @@ class ReflectapiDemoTestsSerdeLargeEnumBeta(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Beta"] = "Beta" + type: Literal["Beta"] = Field(default="Beta", description="Discriminator field") class ReflectapiDemoTestsSerdeLargeEnumGamma(BaseModel): @@ -47,7 +47,7 @@ class ReflectapiDemoTestsSerdeLargeEnumGamma(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Gamma"] = "Gamma" + type: Literal["Gamma"] = Field(default="Gamma", description="Discriminator field") x: int @@ -56,7 +56,7 @@ class ReflectapiDemoTestsSerdeLargeEnumDelta(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Delta"] = "Delta" + type: Literal["Delta"] = Field(default="Delta", description="Discriminator field") value: str @@ -65,7 +65,9 @@ class ReflectapiDemoTestsSerdeLargeEnumEpsilon(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Epsilon"] = "Epsilon" + type: Literal["Epsilon"] = Field( + default="Epsilon", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeLargeEnumZeta(BaseModel): @@ -73,7 +75,7 @@ class ReflectapiDemoTestsSerdeLargeEnumZeta(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Zeta"] = "Zeta" + type: Literal["Zeta"] = Field(default="Zeta", description="Discriminator field") y: bool @@ -82,7 +84,7 @@ class ReflectapiDemoTestsSerdeLargeEnumEta(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Eta"] = "Eta" + type: Literal["Eta"] = Field(default="Eta", description="Discriminator field") class ReflectapiDemoTestsSerdeLargeEnumTheta(BaseModel): @@ -90,7 +92,7 @@ class ReflectapiDemoTestsSerdeLargeEnumTheta(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Theta"] = "Theta" + type: Literal["Theta"] = Field(default="Theta", description="Discriminator field") value: int @@ -99,7 +101,7 @@ class ReflectapiDemoTestsSerdeLargeEnumIota(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Iota"] = "Iota" + type: Literal["Iota"] = Field(default="Iota", description="Discriminator field") class ReflectapiDemoTestsSerdeLargeEnumKappa(BaseModel): @@ -107,7 +109,7 @@ class ReflectapiDemoTestsSerdeLargeEnumKappa(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Kappa"] = "Kappa" + type: Literal["Kappa"] = Field(default="Kappa", description="Discriminator field") z: float @@ -116,7 +118,7 @@ class ReflectapiDemoTestsSerdeLargeEnumLambda(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Lambda"] = "Lambda" + type: Literal["Lambda"] = Field(default="Lambda", description="Discriminator field") class ReflectapiDemoTestsSerdeLargeEnumMu(BaseModel): @@ -124,7 +126,7 @@ class ReflectapiDemoTestsSerdeLargeEnumMu(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Mu"] = "Mu" + type: Literal["Mu"] = Field(default="Mu", description="Discriminator field") w: str v: int diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap index 9a98e8a6..14172da6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["V0"] = "V0" + type: Literal["V0"] = Field(default="V0", description="Discriminator field") class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther(RootModel): @@ -46,7 +46,7 @@ class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["V0"] = "V0" + type: Literal["V0"] = Field(default="V0", description="Discriminator field") class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1(BaseModel): @@ -54,7 +54,9 @@ class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Variant1"] = "Variant1" + type: Literal["Variant1"] = Field( + default="Variant1", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap index 1d63ce48..ecce85d8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap @@ -31,7 +31,9 @@ class ReflectapiDemoTestsSerdeStatusActive(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - status: Literal["Active"] = "Active" + status: Literal["Active"] = Field( + default="Active", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeStatusInactive(BaseModel): @@ -39,7 +41,9 @@ class ReflectapiDemoTestsSerdeStatusInactive(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - status: Literal["Inactive"] = "Inactive" + status: Literal["Inactive"] = Field( + default="Inactive", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeStatusPending(BaseModel): @@ -47,7 +51,9 @@ class ReflectapiDemoTestsSerdeStatusPending(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - status: Literal["Pending"] = "Pending" + status: Literal["Pending"] = Field( + default="Pending", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeStatus(RootModel): @@ -67,7 +73,9 @@ class ReflectapiDemoTestsSerdeItemActive(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) name: str - status: Literal["Active"] = "Active" + status: Literal["Active"] = Field( + default="Active", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeItemInactive(BaseModel): @@ -76,7 +84,9 @@ class ReflectapiDemoTestsSerdeItemInactive(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) name: str - status: Literal["Inactive"] = "Inactive" + status: Literal["Inactive"] = Field( + default="Inactive", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeItemPending(BaseModel): @@ -85,7 +95,9 @@ class ReflectapiDemoTestsSerdeItemPending(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) name: str - status: Literal["Pending"] = "Pending" + status: Literal["Pending"] = Field( + default="Pending", description="Discriminator field" + ) class ReflectapiDemoTestsSerdeItem(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap index 7b558ed7..6f70da0a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap @@ -61,7 +61,7 @@ class ReflectapiDemoTestsSerdeTestS(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["S"] = "S" + type: Literal["S"] = Field(default="S", description="Discriminator field") payload: Annotated[Any, "External type: Payload"] additional: Annotated[Any, "External type: Additional"] diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index cdd09378..e27b790d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeOfferKindSingle(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Single"] = "Single" + type: Literal["Single"] = Field(default="Single", description="Discriminator field") business: str @@ -40,7 +40,7 @@ class ReflectapiDemoTestsSerdeOfferKindGroup(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Group"] = "Group" + type: Literal["Group"] = Field(default="Group", description="Discriminator field") count: int @@ -61,7 +61,10 @@ class ReflectapiDemoTestsSerdeOfferSingle(BaseModel): id: str type_: Literal["Single"] = Field( - default="Single", serialization_alias="type", validation_alias="type" + default="Single", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", ) business: str @@ -73,7 +76,10 @@ class ReflectapiDemoTestsSerdeOfferGroup(BaseModel): id: str type_: Literal["Group"] = Field( - default="Group", serialization_alias="type", validation_alias="type" + default="Group", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", ) count: int diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap index e575c9be..bf8eb0df 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdePriorityHigh(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - kind: Literal["High"] = "High" + kind: Literal["High"] = Field(default="High", description="Discriminator field") deadline: str @@ -40,7 +40,7 @@ class ReflectapiDemoTestsSerdePriorityLow(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - kind: Literal["Low"] = "Low" + kind: Literal["Low"] = Field(default="Low", description="Discriminator field") class ReflectapiDemoTestsSerdePriority(RootModel): @@ -58,7 +58,7 @@ class ReflectapiDemoTestsSerdeTaskHigh(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) title: str - kind: Literal["High"] = "High" + kind: Literal["High"] = Field(default="High", description="Discriminator field") deadline: str @@ -68,7 +68,7 @@ class ReflectapiDemoTestsSerdeTaskLow(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) title: str - kind: Literal["Low"] = "Low" + kind: Literal["Low"] = Field(default="Low", description="Discriminator field") class ReflectapiDemoTestsSerdeTask(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap index 12b50d35..87b0d42c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap @@ -39,7 +39,7 @@ class ReflectapiDemoTestsSerdeContentText(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Text"] = "Text" + type: Literal["Text"] = Field(default="Text", description="Discriminator field") body: str @@ -48,7 +48,7 @@ class ReflectapiDemoTestsSerdeContentImage(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["Image"] = "Image" + type: Literal["Image"] = Field(default="Image", description="Discriminator field") url: str width: int @@ -70,7 +70,10 @@ class ReflectapiDemoTestsSerdePostText(BaseModel): id: str modified_by: str type_: Literal["Text"] = Field( - default="Text", serialization_alias="type", validation_alias="type" + default="Text", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", ) body: str @@ -83,7 +86,10 @@ class ReflectapiDemoTestsSerdePostImage(BaseModel): id: str modified_by: str type_: Literal["Image"] = Field( - default="Image", serialization_alias="type", validation_alias="type" + default="Image", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", ) url: str width: int diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap index b464b664..3a7a4225 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeV2C(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["C"] = "C" + type: Literal["C"] = Field(default="C", description="Discriminator field") c: int @@ -40,7 +40,7 @@ class ReflectapiDemoTestsSerdeV2D(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["D"] = "D" + type: Literal["D"] = Field(default="D", description="Discriminator field") d: int @@ -56,7 +56,7 @@ class ReflectapiDemoTestsSerdeV1A(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["A"] = "A" + type: Literal["A"] = Field(default="A", description="Discriminator field") a: int @@ -65,7 +65,7 @@ class ReflectapiDemoTestsSerdeV1B(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["B"] = "B" + type: Literal["B"] = Field(default="B", description="Discriminator field") b: int @@ -81,8 +81,8 @@ class ReflectapiDemoTestsSerdeTestV1(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - version: Literal["v1"] = "v1" - value: reflectapi_demo.tests.serde.V1 + version: Literal["v1"] = Field(default="v1", description="Discriminator field") + value: reflectapi_demo.tests.serde.V1 = Field(description="Tuple variant value") class ReflectapiDemoTestsSerdeTestV2(BaseModel): @@ -90,8 +90,8 @@ class ReflectapiDemoTestsSerdeTestV2(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - version: Literal["v2"] = "v2" - value: reflectapi_demo.tests.serde.V2 + version: Literal["v2"] = Field(default="v2", description="Discriminator field") + value: reflectapi_demo.tests.serde.V2 = Field(description="Tuple variant value") class ReflectapiDemoTestsSerdeTest(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap index a14892b1..7c068a22 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap @@ -31,7 +31,7 @@ class ReflectapiDemoTestsSerdeV1A(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["A"] = "A" + type: Literal["A"] = Field(default="A", description="Discriminator field") a: int @@ -44,8 +44,8 @@ class ReflectapiDemoTestsSerdeTestV1(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - version: Literal["v1"] = "v1" - value: reflectapi_demo.tests.serde.V1 + version: Literal["v1"] = Field(default="v1", description="Discriminator field") + value: reflectapi_demo.tests.serde.V1 = Field(description="Tuple variant value") class ReflectapiDemoTestsSerdeTest(RootModel): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap index 6d2708f3..1bbae92c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap @@ -49,7 +49,7 @@ class ReflectapiDemoTestsSerdeEnumA(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["a"] = "a" + type: Literal["a"] = Field(default="a", description="Discriminator field") a: int b: int @@ -59,7 +59,7 @@ class ReflectapiDemoTestsSerdeEnumB(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) - type: Literal["b"] = "b" + type: Literal["b"] = Field(default="b", description="Discriminator field") c: int d: int diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/response.py b/reflectapi-python-runtime/src/reflectapi_runtime/response.py index 9338f5ec..ef3e2b5e 100644 --- a/reflectapi-python-runtime/src/reflectapi_runtime/response.py +++ b/reflectapi-python-runtime/src/reflectapi_runtime/response.py @@ -9,6 +9,7 @@ import httpx # noqa: TC002 T = TypeVar("T") +E = TypeVar("E") @dataclass(frozen=True) @@ -36,11 +37,16 @@ def from_response( ) -class ApiResponse(Generic[T]): - """Wrapper for successful API responses. +class ApiResponse(Generic[T, E]): + """Wrapper for API responses with typed success and error values. + + Type parameters: + T: The success response type. + E: The error response type (defaults to Any when not specified). Provides ergonomic access to both the deserialized value and transport metadata. - The deserialized value can be accessed directly via attribute access. + Supports `ApiResponse[OutputType]` (backward compatible) and + `ApiResponse[OutputType, ErrorType]` (with typed errors). """ def __init__(self, value: T, metadata: TransportMetadata) -> None: diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index b9100651..aeab313d 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -10,6 +10,15 @@ fn sanitize_for_docstring(text: &str) -> String { text.replace('\\', "\\\\").replace("\"\"\"", "\\\"\\\"\\\"") } +/// Sanitize text for inclusion in a Python double-quoted string literal. +/// Escapes backslashes, double quotes, and replaces newlines with \n. +fn sanitize_for_string_literal(text: &str) -> String { + text.replace('\\', "\\\\") + .replace('"', "\\\"") + .replace('\n', "\\n") + .replace('\r', "\\r") +} + /// Information needed to generate a factory class later #[derive(Clone, Debug)] struct FactoryInfo { @@ -5236,27 +5245,35 @@ pub mod templates { writeln!(s).unwrap(); for field in &self.fields { write!(s, " {}: {}", field.name, field.type_annotation).unwrap(); - if let Some(alias) = &field.alias { - write!(s, " = Field").unwrap(); + + // Build Field() kwargs: description, alias, default + let desc = field + .description + .as_ref() + .filter(|d| !d.is_empty() && !d.starts_with("(flattened")) + .map(|d| super::sanitize_for_string_literal(d)); + let has_field_args = desc.is_some() + || field.alias.is_some() + || (field.optional && field.alias.is_none()); + + if has_field_args && (desc.is_some() || field.alias.is_some()) { + // Need Field() with named arguments + write!(s, " = Field(").unwrap(); + let mut args = Vec::new(); if let Some(default) = &field.default_value { - write!( - s, - "(default={default}, serialization_alias='{alias}', validation_alias='{alias}')" - ) - .unwrap(); + args.push(format!("default={default}")); } else if field.optional { - write!( - s, - "(default=None, serialization_alias='{alias}', validation_alias='{alias}')" - ) - .unwrap(); - } else { - write!( - s, - "(serialization_alias='{alias}', validation_alias='{alias}')" - ) - .unwrap(); + args.push("default=None".to_string()); + } + if let Some(alias) = &field.alias { + args.push(format!("serialization_alias='{alias}'")); + args.push(format!("validation_alias='{alias}'")); } + if let Some(ref d) = desc { + args.push(format!("description=\"{d}\"")); + } + write!(s, "{}", args.join(", ")).unwrap(); + write!(s, ")").unwrap(); } else if field.optional { write!(s, " = None").unwrap(); } else if let Some(default) = &field.default_value { @@ -5616,7 +5633,16 @@ pub mod templates { if let Some(headers_type) = &function.headers_type { writeln!(s, " headers: Optional[{headers_type}] = None,").unwrap(); } - writeln!(s, " ) -> ApiResponse[{}]:", function.output_type).unwrap(); + if let Some(error_type) = &function.error_type { + writeln!( + s, + " ) -> ApiResponse[{}, {}]:", + function.output_type, error_type + ) + .unwrap(); + } else { + writeln!(s, " ) -> ApiResponse[{}]:", function.output_type).unwrap(); + } // Docstring let desc = super::sanitize_for_docstring(function.description.as_deref().unwrap_or("")); @@ -5645,12 +5671,21 @@ pub mod templates { writeln!(s).unwrap(); } writeln!(s, " Returns:").unwrap(); - writeln!( - s, - " ApiResponse[{}]: Response containing {} data", - function.output_type, function.output_type - ) - .unwrap(); + if let Some(error_type) = &function.error_type { + writeln!( + s, + " ApiResponse[{}, {}]: Success={}, Error={}", + function.output_type, error_type, function.output_type, error_type + ) + .unwrap(); + } else { + writeln!( + s, + " ApiResponse[{}]: Response containing {} data", + function.output_type, function.output_type + ) + .unwrap(); + } if let Some(dep_note) = &function.deprecation_note { let dep_note = super::sanitize_for_docstring(dep_note); writeln!(s).unwrap(); From 025d1439833802c12f63f7dc130dd88f2ccf965f Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 09:24:45 +1300 Subject: [PATCH 38/47] refactor(python): remove factory classes and testing utilities Factory classes (371 in core-server output) consumed ~13K lines (19% of file) and provided no value over direct type construction: # Before (factory): myapi_proto_PetsCreateErrorFactory.conflict() # After (direct, already works): myapi.proto.PetsCreateError("Conflict") Removed: - FactoryInfo struct and 5 factory generation functions - generate_factory_method_params/args helpers - render_*_without_factory naming (renamed to render_*/render_enum) - sanitize_field_name (only used by factory code) - HybridEnumClass and FactoryMethod template structs - Default generate_testing changed to false 697 lines removed from python.rs (6595 -> 5898). Core-server output: 58K lines (down from 68K, -13%). Validated: imports, constructs types, authenticates against live API. --- reflectapi-demo/clients/python/generated.py | 255 ------ ...tests__basic__reflectapi_deprecated-5.snap | 17 - ...__basic__reflectapi_enum_documented-4.snap | 43 - ...__reflectapi_enum_with_skip_variant-5.snap | 24 - ...basic__reflectapi_struct_documented-4.snap | 17 - ...sts__basic__reflectapi_struct_empty-5.snap | 17 - ...s__basic__reflectapi_struct_newtype-5.snap | 10 - ...i_struct_one_basic_field_static_str-4.snap | 17 - ...ctapi_struct_one_basic_field_string-4.snap | 17 - ..._basic_field_string_reflectapi_both-5.snap | 17 - ...ield_string_reflectapi_both_equally-5.snap | 19 - ...eld_string_reflectapi_both_equally2-4.snap | 19 - ...ing_reflectapi_both_with_attributes-5.snap | 28 - ...flectapi_struct_one_basic_field_u32-4.snap | 17 - ...ts__basic__reflectapi_struct_option-5.snap | 17 - ...sts__basic__reflectapi_struct_tuple-5.snap | 15 - ..._basic__reflectapi_struct_unit_type-5.snap | 10 - ...tapi_struct_with_additional_derives-5.snap | 31 - ...ruct_with_all_primitive_type_fields-5.snap | 17 - ...__basic__reflectapi_struct_with_arc-5.snap | 17 - ...ectapi_struct_with_arc_pointer_only-5.snap | 17 - ...__reflectapi_struct_with_attributes-5.snap | 10 - ...i_struct_with_attributes_input_only-5.snap | 17 - ..._struct_with_attributes_output_only-5.snap | 17 - ...pi_struct_with_attributes_type_only-5.snap | 10 - ...with_external_generic_type_fallback-5.snap | 17 - ...ectapi_struct_with_fixed_size_array-5.snap | 17 - ...sic__reflectapi_struct_with_hashmap-5.snap | 17 - ...eflectapi_struct_with_hashset_field-5.snap | 17 - ...i_struct_with_hashset_field_generic-5.snap | 17 - ...asic__reflectapi_struct_with_nested-5.snap | 24 - ...lectapi_struct_with_nested_external-5.snap | 24 - ...reflectapi_struct_with_self_via_arc-5.snap | 17 - ...__reflectapi_struct_with_skip_field-5.snap | 17 - ...ectapi_struct_with_skip_field_input-5.snap | 24 - ...ctapi_struct_with_skip_field_output-5.snap | 24 - ...lectapi_struct_with_transform_array-5.snap | 17 - ...flectapi_struct_with_transform_both-5.snap | 17 - ...tapi_struct_with_transform_fallback-5.snap | 17 - ...ruct_with_transform_fallback_nested-5.snap | 17 - ...lectapi_struct_with_transform_input-5.snap | 24 - ...ectapi_struct_with_transform_output-5.snap | 24 - ...basic__reflectapi_struct_with_tuple-5.snap | 17 - ...sic__reflectapi_struct_with_tuple12-5.snap | 17 - ...__basic__reflectapi_struct_with_vec-5.snap | 17 - ...reflectapi_struct_with_vec_external-5.snap | 24 - ...__reflectapi_struct_with_vec_nested-5.snap | 24 - ...sic__reflectapi_struct_with_vec_two-5.snap | 17 - ...reflectapi_demo__tests__enums__enum-4.snap | 17 - ...tapi_demo__tests__enums__enum_empty-4.snap | 17 - ...demo__tests__enums__enum_rename_num-5.snap | 17 - ...variant_and_fields_and_named_fields-4.snap | 59 -- ...num_with_discriminant_ignored_input-4.snap | 17 - ...um_with_discriminant_ignored_output-4.snap | 17 - ...enums__enum_with_discriminant_input-4.snap | 17 - ...nums__enum_with_discriminant_output-4.snap | 17 - ..._enum_with_empty_variant_and_fields-4.snap | 40 - ...emo__tests__enums__enum_with_fields-4.snap | 44 - ...o__tests__enums__enum_with_generics-4.snap | 44 - ...nums__enum_with_generics_and_fields-4.snap | 46 -- ...enerics_and_fields_and_named_fields-4.snap | 59 -- ...lly_tagged_enum_with_tuple_variants-5.snap | 36 - ...ally_tagged_enum_with_unit_variants-5.snap | 31 - ...ics__struct_with_circular_reference-4.snap | 17 - ...uct_with_circular_reference_generic-4.snap | 17 - ...h_circular_reference_generic_parent-4.snap | 26 - ...cular_reference_generic_without_box-4.snap | 19 - ...eference_generic_without_box_parent-4.snap | 28 - ...generic_without_box_parent_specific-4.snap | 28 - ...__struct_with_nested_generic_struct-4.snap | 24 - ...ct_with_nested_generic_struct_twice-4.snap | 24 - ...enerics__struct_with_simple_generic-4.snap | 17 - ...__generics__struct_with_vec_generic-4.snap | 17 - ...cs__struct_with_vec_generic_generic-4.snap | 24 - ...ct_with_vec_generic_generic_generic-4.snap | 24 - ...adj_repr_enum_with_untagged_variant-5.snap | 34 - ..._tests__serde__box_field_unwrapping-5.snap | 17 - ...ectapi_demo__tests__serde__datetime-5.snap | 24 - ...tapi_demo__tests__serde__empty_enum-5.snap | 17 - ...e__empty_variants_adjacently_tagged-5.snap | 45 - ...e__empty_variants_externally_tagged-5.snap | 43 - ...e__empty_variants_internally_tagged-5.snap | 33 - ...sts__serde__empty_variants_untagged-5.snap | 17 - ...xed_variant_types_internally_tagged-5.snap | 36 - ...api_demo__tests__serde__enum_rename-5.snap | 17 - ...demo__tests__serde__enum_rename_all-5.snap | 17 - ...__serde__enum_rename_all_on_variant-5.snap | 46 -- ...s__serde__enum_rename_variant_field-5.snap | 35 - ...ectapi_demo__tests__serde__enum_tag-5.snap | 34 - ...emo__tests__serde__enum_tag_content-5.snap | 42 - ..._serde__enum_tag_content_rename_all-5.snap | 46 -- ...i_demo__tests__serde__enum_untagged-5.snap | 17 - ..._tests__serde__enum_with_field_skip-5.snap | 31 - ...sts__serde__enum_with_many_variants-5.snap | 61 -- ...__enum_with_rename_to_invalid_chars-5.snap | 35 - ..._enum_with_serde_rename_on_variants-5.snap | 38 - ...sts__serde__enum_with_variant_other-5.snap | 43 - ...ests__serde__enum_with_variant_skip-5.snap | 17 - ..._enum_with_variant_skip_deserialize-5.snap | 24 - ...e__enum_with_variant_skip_serialize-5.snap | 24 - ...__serde__enum_with_variant_untagged-5.snap | 35 - ..._demo__tests__serde__external_impls-5.snap | 17 - ...s__serde__field_all_python_keywords-5.snap | 17 - ...rde__field_names_with_special_chars-5.snap | 17 - ...latten_adjacently_tagged_enum_field-5.snap | 45 - ...latten_enum_with_unit_variants_only-5.snap | 35 - ...latten_externally_tagged_enum_field-5.snap | 45 - ...s__serde__flatten_internally_tagged-5.snap | 54 -- ...latten_internally_tagged_enum_field-5.snap | 41 - ...ts__serde__flatten_multiple_structs-5.snap | 31 - ...ten_optional_internally_tagged_enum-5.snap | 38 - ...n_struct_and_internal_enum_combined-5.snap | 48 -- ..._flatten_struct_with_nested_flatten-5.snap | 31 - ...pi_demo__tests__serde__flatten_unit-5.snap | 24 - ..._serde__flatten_untagged_enum_field-5.snap | 24 - ...rde__generic_adjacently_tagged_enum-5.snap | 31 - ...rde__generic_externally_tagged_enum-5.snap | 31 - ...de__generic_struct_repr_transparent-5.snap | 10 - ..._repr_transparent_partially_generic-5.snap | 10 - ...tapi_demo__tests__serde__kebab_case-5.snap | 17 - ...__multiple_underscore_prefix_fields-5.snap | 17 - ...de__namespace_deeply_nested_modules-5.snap | 17 - ...erde__namespace_single_segment_type-5.snap | 17 - ...serde__namespace_with_numeric_start-5.snap | 17 - ...s__serde__nested_generic_containers-5.snap | 17 - ...rde__nested_internally_tagged_enums-5.snap | 86 -- ...ted_internally_tagged_enums_minimal-5.snap | 50 -- ..._newtype_variants_adjacently_tagged-5.snap | 64 -- ..._newtype_variants_externally_tagged-5.snap | 62 -- ..._newtype_variants_internally_tagged-5.snap | 52 -- ...emo__tests__serde__option_of_option-5.snap | 17 - ...sts__serde__self_referential_struct-5.snap | 17 - ...api_demo__tests__serde__struct_from-5.snap | 24 - ...api_demo__tests__serde__struct_into-5.snap | 24 - ...i_demo__tests__serde__struct_rename-5.snap | 17 - ...mo__tests__serde__struct_rename_all-5.snap | 17 - ...erde__struct_rename_all_differently-5.snap | 24 - ...erde__struct_rename_all_pascal_case-5.snap | 17 - ...s__serde__struct_rename_differently-5.snap | 24 - ...__tests__serde__struct_rename_field-5.snap | 24 - ...repr_transparent_generic_inner_type-5.snap | 17 - ...demo__tests__serde__struct_try_from-5.snap | 24 - ...__tests__serde__struct_with_flatten-5.snap | 24 - ...serde__struct_with_flatten_optional-5.snap | 24 - ..._with_flatten_optional_and_required-5.snap | 31 - ...struct_with_rename_to_invalid_chars-5.snap | 17 - ...e__struct_with_rename_to_kebab_case-5.snap | 17 - ...s__serde__struct_with_serde_default-5.snap | 24 - ...ests__serde__struct_with_serde_skip-5.snap | 17 - ..._struct_with_serde_skip_deserialize-5.snap | 24 - ...e__struct_with_serde_skip_serialize-5.snap | 24 - ...struct_with_serde_skip_serialize_if-5.snap | 24 - ...erde__struct_with_serde_transparent-5.snap | 10 - ...ectapi_demo__tests__serde__timezone-5.snap | 17 - ...api_demo__tests__serde__unit_struct-5.snap | 10 - ...mo__tests__serde__unit_tuple_struct-5.snap | 10 - .../__pycache__/__init__.cpython-314.pyc | Bin 2775 -> 0 bytes .../__pycache__/auth.cpython-314.pyc | Bin 29921 -> 0 bytes .../__pycache__/batch.cpython-314.pyc | Bin 11387 -> 0 bytes .../__pycache__/client.cpython-314.pyc | Bin 36233 -> 0 bytes .../__pycache__/exceptions.cpython-314.pyc | Bin 7211 -> 0 bytes .../hypothesis_strategies.cpython-314.pyc | Bin 10815 -> 0 bytes .../__pycache__/middleware.cpython-314.pyc | Bin 13459 -> 0 bytes .../__pycache__/option.cpython-314.pyc | Bin 15584 -> 0 bytes .../__pycache__/response.cpython-314.pyc | Bin 7772 -> 0 bytes .../__pycache__/streaming.cpython-314.pyc | Bin 22278 -> 0 bytes .../__pycache__/testing.cpython-314.pyc | Bin 21658 -> 0 bytes .../__pycache__/types.cpython-314.pyc | Bin 1380 -> 0 bytes reflectapi/src/codegen/python.rs | 778 +----------------- 169 files changed, 25 insertions(+), 4950 deletions(-) delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/__init__.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/auth.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/batch.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/client.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/exceptions.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/hypothesis_strategies.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/middleware.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/option.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/response.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/streaming.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/testing.cpython-314.pyc delete mode 100644 reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/types.cpython-314.pyc diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index 29d34b9d..2d471b95 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -29,7 +29,6 @@ from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiOption from reflectapi_runtime import ReflectapiEmpty -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -938,257 +937,3 @@ def __init__( except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class myapi_model_BehaviorFactory: - """Factory class for creating myapi.model.Behavior variants with ergonomic syntax. - - myapi.model.Behavior variants - """ - - @staticmethod - def calm() -> myapi.model.Behavior: - """Creates the 'Calm' variant of the myapi.model.Behavior enum.""" - return myapi.model.Behavior("Calm") - - @staticmethod - def aggressive(field_0: float, field_1: str) -> myapi.model.Behavior: - """Creates the 'Aggressive' variant of the myapi.model.Behavior enum.""" - return myapi.model.Behavior( - myapi.model.BehaviorAggressiveVariant(field_0=field_0, field_1=field_1) - ) - - @staticmethod - def other(description: str, notes: str | None = None) -> myapi.model.Behavior: - """Creates the 'Other' variant of the myapi.model.Behavior enum.""" - return myapi.model.Behavior( - myapi.model.BehaviorOtherVariant(description=description, notes=notes) - ) - - -class myapi_proto_PetsCreateErrorFactory: - """Factory class for creating myapi.proto.PetsCreateError variants with ergonomic syntax. - - myapi.proto.PetsCreateError variants - """ - - @staticmethod - def conflict() -> myapi.proto.PetsCreateError: - """Creates the 'Conflict' variant of the myapi.proto.PetsCreateError enum.""" - return myapi.proto.PetsCreateError("Conflict") - - @staticmethod - def not_authorized() -> myapi.proto.PetsCreateError: - """Creates the 'NotAuthorized' variant of the myapi.proto.PetsCreateError enum.""" - return myapi.proto.PetsCreateError("NotAuthorized") - - @staticmethod - def invalid_identity(message: str) -> myapi.proto.PetsCreateError: - """Creates the 'InvalidIdentity' variant of the myapi.proto.PetsCreateError enum.""" - return myapi.proto.PetsCreateError( - myapi.proto.PetsCreateErrorInvalidIdentityVariant(message=message) - ) - - -class myapi_model_KindFactory: - """Factory class for creating myapi.model.Kind variants with ergonomic syntax. - - myapi.model.Kind variants - """ - - BIRD = myapi.model.KindBird() - - @staticmethod - def dog(breed: str) -> myapi.model.KindDog: - """Creates the 'dog' variant of the myapi.model.Kind enum.""" - return myapi.model.KindDog(breed=breed) - - @staticmethod - def cat(lives: int) -> myapi.model.KindCat: - """Creates the 'cat' variant of the myapi.model.Kind enum.""" - return myapi.model.KindCat(lives=lives) - - -class myapi_proto_PetsListErrorFactory: - """Factory class for creating myapi.proto.PetsListError variants with ergonomic syntax. - - myapi.proto.PetsListError variants - """ - - INVALIDCURSOR = myapi.proto.PetsListErrorInvalidCursor() - UNAUTHORIZED = myapi.proto.PetsListErrorUnauthorized() - - @staticmethod - def internal( - field_0: myapi.proto.InternalError, - ) -> myapi.proto.PetsListErrorInternal: - """Creates the 'Internal' variant of the myapi.proto.PetsListError enum.""" - return myapi.proto.PetsListErrorInternal(field_0=field_0) - - -class myapi_proto_ValidationErrorFactory: - """Factory class for creating myapi.proto.ValidationError variants with ergonomic syntax. - - myapi.proto.ValidationError variants - """ - - @staticmethod - def validation_a(field_0: myapi.proto.ValidationA) -> myapi.proto.ValidationError: - """Creates the 'ValidationA' variant of the myapi.proto.ValidationError enum.""" - return myapi.proto.ValidationError( - myapi.proto.ValidationErrorValidationAVariant(field_0=field_0) - ) - - -class myapi_proto_PetsUpdateErrorFactory: - """Factory class for creating myapi.proto.PetsUpdateError variants with ergonomic syntax. - - myapi.proto.PetsUpdateError variants - """ - - @staticmethod - def not_found() -> myapi.proto.PetsUpdateError: - """Creates the 'NotFound' variant of the myapi.proto.PetsUpdateError enum.""" - return myapi.proto.PetsUpdateError("NotFound") - - @staticmethod - def not_authorized() -> myapi.proto.PetsUpdateError: - """Creates the 'NotAuthorized' variant of the myapi.proto.PetsUpdateError enum.""" - return myapi.proto.PetsUpdateError("NotAuthorized") - - @staticmethod - def validation( - field_0: list[myapi.proto.ValidationError], - ) -> myapi.proto.PetsUpdateError: - """Creates the 'Validation' variant of the myapi.proto.PetsUpdateError enum.""" - return myapi.proto.PetsUpdateError( - myapi.proto.PetsUpdateErrorValidationVariant(field_0=field_0) - ) - - -# Testing utilities - - -def create_myapi_healthcheckfail_response( - value: myapi.HealthCheckFail, -) -> ApiResponse[myapi.HealthCheckFail]: - """Create a mock ApiResponse for myapi.HealthCheckFail.""" - return create_api_response(value) - - -def create_myapi_model_behavior_response( - value: myapi.model.Behavior, -) -> ApiResponse[myapi.model.Behavior]: - """Create a mock ApiResponse for myapi.model.Behavior.""" - return create_api_response(value) - - -def create_myapi_model_kind_response( - value: myapi.model.Kind, -) -> ApiResponse[myapi.model.Kind]: - """Create a mock ApiResponse for myapi.model.Kind.""" - return create_api_response(value) - - -def create_myapi_model_input_pet_response( - value: myapi.model.input.Pet, -) -> ApiResponse[myapi.model.input.Pet]: - """Create a mock ApiResponse for myapi.model.input.Pet.""" - return create_api_response(value) - - -def create_myapi_model_output_pet_response( - value: myapi.model.output.Pet, -) -> ApiResponse[myapi.model.output.Pet]: - """Create a mock ApiResponse for myapi.model.output.Pet.""" - return create_api_response(value) - - -def create_myapi_proto_headers_response( - value: myapi.proto.Headers, -) -> ApiResponse[myapi.proto.Headers]: - """Create a mock ApiResponse for myapi.proto.Headers.""" - return create_api_response(value) - - -def create_myapi_proto_internalerror_response( - value: myapi.proto.InternalError, -) -> ApiResponse[myapi.proto.InternalError]: - """Create a mock ApiResponse for myapi.proto.InternalError.""" - return create_api_response(value) - - -def create_myapi_proto_paginated_response( - value: myapi.proto.Paginated, -) -> ApiResponse[myapi.proto.Paginated]: - """Create a mock ApiResponse for myapi.proto.Paginated.""" - return create_api_response(value) - - -def create_myapi_proto_petscreateerror_response( - value: myapi.proto.PetsCreateError, -) -> ApiResponse[myapi.proto.PetsCreateError]: - """Create a mock ApiResponse for myapi.proto.PetsCreateError.""" - return create_api_response(value) - - -def create_myapi_proto_petslisterror_response( - value: myapi.proto.PetsListError, -) -> ApiResponse[myapi.proto.PetsListError]: - """Create a mock ApiResponse for myapi.proto.PetsListError.""" - return create_api_response(value) - - -def create_myapi_proto_petslistrequest_response( - value: myapi.proto.PetsListRequest, -) -> ApiResponse[myapi.proto.PetsListRequest]: - """Create a mock ApiResponse for myapi.proto.PetsListRequest.""" - return create_api_response(value) - - -def create_myapi_proto_petsremoveerror_response( - value: myapi.proto.PetsRemoveError, -) -> ApiResponse[myapi.proto.PetsRemoveError]: - """Create a mock ApiResponse for myapi.proto.PetsRemoveError.""" - return create_api_response(value) - - -def create_myapi_proto_petsremoverequest_response( - value: myapi.proto.PetsRemoveRequest, -) -> ApiResponse[myapi.proto.PetsRemoveRequest]: - """Create a mock ApiResponse for myapi.proto.PetsRemoveRequest.""" - return create_api_response(value) - - -def create_myapi_proto_petsupdateerror_response( - value: myapi.proto.PetsUpdateError, -) -> ApiResponse[myapi.proto.PetsUpdateError]: - """Create a mock ApiResponse for myapi.proto.PetsUpdateError.""" - return create_api_response(value) - - -def create_myapi_proto_petsupdaterequest_response( - value: myapi.proto.PetsUpdateRequest, -) -> ApiResponse[myapi.proto.PetsUpdateRequest]: - """Create a mock ApiResponse for myapi.proto.PetsUpdateRequest.""" - return create_api_response(value) - - -def create_myapi_proto_validationa_response( - value: myapi.proto.ValidationA, -) -> ApiResponse[myapi.proto.ValidationA]: - """Create a mock ApiResponse for myapi.proto.ValidationA.""" - return create_api_response(value) - - -def create_myapi_proto_validationerror_response( - value: myapi.proto.ValidationError, -) -> ApiResponse[myapi.proto.ValidationError]: - """Create a mock ApiResponse for myapi.proto.ValidationError.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap index 8364088f..2b48ac12 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicStructWithDeprecatedField(BaseModel): @@ -148,19 +147,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_structwithdeprecatedfield_response( - value: reflectapi_demo.tests.basic.StructWithDeprecatedField, -) -> ApiResponse[reflectapi_demo.tests.basic.StructWithDeprecatedField]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.StructWithDeprecatedField.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap index 0918fc08..3798706e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -237,45 +236,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_basic_TestEnumDocumentedFactory: - """Factory class for creating reflectapi_demo.tests.basic.TestEnumDocumented variants with ergonomic syntax. - - Some Enum docs - more - """ - - @staticmethod - def variant1(field_0: T) -> reflectapi_demo.tests.basic.TestEnumDocumented[T]: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.basic.TestEnumDocumented enum.""" - return reflectapi_demo.tests.basic.TestEnumDocumented( - reflectapi_demo.tests.basic.TestEnumDocumentedVariant1Variant[T]( - field_0=field_0 - ) - ) - - @staticmethod - def variant2(named_field: T) -> reflectapi_demo.tests.basic.TestEnumDocumented[T]: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.basic.TestEnumDocumented enum.""" - return reflectapi_demo.tests.basic.TestEnumDocumented( - reflectapi_demo.tests.basic.TestEnumDocumentedVariant2Variant[T]( - named_field=named_field - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_testenumdocumented_response( - value: reflectapi_demo.tests.basic.TestEnumDocumented, -) -> ApiResponse[reflectapi_demo.tests.basic.TestEnumDocumented]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestEnumDocumented.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap index e898074b..a173e238 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant(str, Enum): @@ -168,26 +167,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_input_testenumwithskipvariant_response( - value: reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant, -) -> ApiResponse[reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_output_testenumwithskipvariant_response( - value: reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant, -) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap index 7b88f33f..15f5d86b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructDocumented(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructdocumented_response( - value: reflectapi_demo.tests.basic.TestStructDocumented, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructDocumented]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructDocumented.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap index 37cf89da..e56f49e5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructEmpty(BaseModel): @@ -142,19 +141,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructempty_response( - value: reflectapi_demo.tests.basic.TestStructEmpty, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructEmpty]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructEmpty.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap index f332ce80..5c7cd755 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap index 51800b93..985221de 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructOneBasicFieldStaticStr(BaseModel): @@ -136,19 +135,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructonebasicfieldstaticstr_response( - value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStaticStr.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap index 6385fcbe..5dc7f06e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructOneBasicFieldString(BaseModel): @@ -150,19 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructonebasicfieldstring_response( - value: reflectapi_demo.tests.basic.TestStructOneBasicFieldString, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldString]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldString.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap index 61f8d500..92636fb6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth(BaseModel): @@ -154,19 +153,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructonebasicfieldstringreflectboth_response( - value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap index d5034188..80344d68 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( @@ -156,21 +155,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructonebasicfieldstringreflectbothequally_response( - value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually, -) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually -]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap index 58e343c1..631e7785 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( @@ -152,21 +151,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructonebasicfieldstringreflectbothequally_response( - value: reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually, -) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually -]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap index 2c1bbc11..6aa11c0d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently( @@ -173,30 +172,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_input_teststructonebasicfieldstringreflectbothdifferently_response( - value: reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently, -) -> ApiResponse[ - reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently -]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_output_teststructonebasicfieldstringreflectbothdifferently_response( - value: reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently, -) -> ApiResponse[ - reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently -]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap index a71d467c..94886aed 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructOneBasicFieldU32(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructonebasicfieldu32_response( - value: reflectapi_demo.tests.basic.TestStructOneBasicFieldU32, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldU32]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOneBasicFieldU32.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap index 5ff0434e..b963cb4d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructOption(BaseModel): @@ -145,19 +144,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructoption_response( - value: reflectapi_demo.tests.basic.TestStructOption, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOption]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructOption.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap index fddba93f..1ddc86bf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructTuple(BaseModel): @@ -146,17 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructtuple_response(value: reflectapi_demo.tests.basic.TestStructTuple) -> ApiResponse[reflectapi_demo.tests.basic.TestStructTuple]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructTuple.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap index c6118833..9130c65f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap index b0f4c731..c74b896e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicX(BaseModel): @@ -163,33 +162,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_test_response( - value: reflectapi_demo.tests.basic.Test, -) -> ApiResponse[reflectapi_demo.tests.basic.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.Test.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_x_response( - value: reflectapi_demo.tests.basic.X, -) -> ApiResponse[reflectapi_demo.tests.basic.X]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.X.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_y_response( - value: reflectapi_demo.tests.basic.Y, -) -> ApiResponse[reflectapi_demo.tests.basic.Y]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.Y.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap index de60d3e1..2dba8821 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields(BaseModel): @@ -239,19 +238,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithallprimitivetypefields_response( - value: reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap index dfa5d819..6198c9ba 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithArc(BaseModel): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwitharc_response( - value: reflectapi_demo.tests.basic.TestStructWithArc, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArc]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithArc.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap index 032dcaca..349f3e11 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithArcPointerOnly(BaseModel): @@ -148,19 +147,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwitharcpointeronly_response( - value: reflectapi_demo.tests.basic.TestStructWithArcPointerOnly, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithArcPointerOnly]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithArcPointerOnly.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap index 406c057d..fc2178d5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap index 61248284..4df00ce6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithAttributesInputOnly(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithattributesinputonly_response( - value: reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithAttributesInputOnly.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap index f685b5ab..d272ea99 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithAttributesOutputOnly(BaseModel): @@ -150,19 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithattributesoutputonly_response( - value: reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithAttributesOutputOnly.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap index 88f5657a..d6f94aef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap index 0af5f5a7..08c1e54f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback(BaseModel): @@ -154,19 +153,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithexternalgenerictypefallback_response( - value: reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap index 558388c5..768e792d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithFixedSizeArray(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithfixedsizearray_response( - value: reflectapi_demo.tests.basic.TestStructWithFixedSizeArray, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithFixedSizeArray]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithFixedSizeArray.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap index e6a1f34d..af88c353 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithHashMap(BaseModel): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithhashmap_response( - value: reflectapi_demo.tests.basic.TestStructWithHashMap, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashMap]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithHashMap.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap index d59c7e24..2e2f5355 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithHashSetField(BaseModel): @@ -148,19 +147,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithhashsetfield_response( - value: reflectapi_demo.tests.basic.TestStructWithHashSetField, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetField]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithHashSetField.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap index 72d90627..c70a1727 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -166,19 +165,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithhashsetfieldgeneric_response( - value: reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap index 1fce7bb2..1e7da03a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructNested(BaseModel): @@ -156,26 +155,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructnested_response( - value: reflectapi_demo.tests.basic.TestStructNested, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructNested.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_teststructwithnested_response( - value: reflectapi_demo.tests.basic.TestStructWithNested, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithNested.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap index 48359eb5..d870dc9b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): @@ -162,26 +161,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithnestedexternal_response( - value: reflectapi_demo.tests.basic.TestStructWithNestedExternal, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithNestedExternal]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithNestedExternal.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_test_lib_teststructnested_response( - value: reflectapi_demo.tests.test_lib.TestStructNested, -) -> ApiResponse[reflectapi_demo.tests.test_lib.TestStructNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.test_lib.TestStructNested.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap index 11b35713..a4bfe6ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithSelfViaArc(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithselfviaarc_response( - value: reflectapi_demo.tests.basic.TestStructWithSelfViaArc, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSelfViaArc]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithSelfViaArc.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap index 97231dd1..7b3fd545 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithSkipField(BaseModel): @@ -142,19 +141,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithskipfield_response( - value: reflectapi_demo.tests.basic.TestStructWithSkipField, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithSkipField]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithSkipField.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap index 80addd5a..9d3a79c6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput(BaseModel): @@ -167,26 +166,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_input_teststructwithskipfieldinput_response( - value: reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput, -) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_output_teststructwithskipfieldinput_response( - value: reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput, -) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap index fd8a5d42..f0375847 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput(BaseModel): @@ -167,26 +166,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_input_teststructwithskipfieldoutput_response( - value: reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput, -) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_output_teststructwithskipfieldoutput_response( - value: reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput, -) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap index a646c2e0..3f9fe9e1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithTransformArray(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithtransformarray_response( - value: reflectapi_demo.tests.basic.TestStructWithTransformArray, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformArray]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformArray.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap index f49c339d..4d2e1a35 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithTransformBoth(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithtransformboth_response( - value: reflectapi_demo.tests.basic.TestStructWithTransformBoth, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformBoth]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformBoth.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap index f054e077..b78a0a63 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithTransformFallback(BaseModel): @@ -150,19 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithtransformfallback_response( - value: reflectapi_demo.tests.basic.TestStructWithTransformFallback, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformFallback.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap index fde2fe04..7105a5cb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested(BaseModel): @@ -150,19 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithtransformfallbacknested_response( - value: reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap index 793a2748..6b581971 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicInputTestStructWithTransformInput(BaseModel): @@ -169,26 +168,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_input_teststructwithtransforminput_response( - value: reflectapi_demo.tests.basic.input.TestStructWithTransformInput, -) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithTransformInput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithTransformInput.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_output_teststructwithtransforminput_response( - value: reflectapi_demo.tests.basic.output.TestStructWithTransformInput, -) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithTransformInput.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap index 7f2e71bf..eab7e5f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicInputTestStructWithTransformOutput(BaseModel): @@ -169,26 +168,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_input_teststructwithtransformoutput_response( - value: reflectapi_demo.tests.basic.input.TestStructWithTransformOutput, -) -> ApiResponse[reflectapi_demo.tests.basic.input.TestStructWithTransformOutput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.input.TestStructWithTransformOutput.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_basic_output_teststructwithtransformoutput_response( - value: reflectapi_demo.tests.basic.output.TestStructWithTransformOutput, -) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.output.TestStructWithTransformOutput.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap index 1dd108d0..efdf9c74 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithTuple(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithtuple_response( - value: reflectapi_demo.tests.basic.TestStructWithTuple, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTuple.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap index 44e10f8b..7a06506a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithTuple12(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithtuple12_response( - value: reflectapi_demo.tests.basic.TestStructWithTuple12, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTuple12]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithTuple12.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap index 1b3b07c2..6462325e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithVec(BaseModel): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithvec_response( - value: reflectapi_demo.tests.basic.TestStructWithVec, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVec]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVec.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap index e9c4a6cf..676211e9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): @@ -162,26 +161,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithvecexternal_response( - value: reflectapi_demo.tests.basic.TestStructWithVecExternal, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecExternal]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVecExternal.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_test_lib_teststructnested_response( - value: reflectapi_demo.tests.test_lib.TestStructNested, -) -> ApiResponse[reflectapi_demo.tests.test_lib.TestStructNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.test_lib.TestStructNested.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap index 31fb48ac..3cfaa45e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): @@ -160,26 +159,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithvecnested_response( - value: reflectapi_demo.tests.basic.TestStructWithVecNested, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVecNested.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_test_lib_teststructnested_response( - value: reflectapi_demo.tests.test_lib.TestStructNested, -) -> ApiResponse[reflectapi_demo.tests.test_lib.TestStructNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.test_lib.TestStructNested.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap index cd3b96af..3ab55f37 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsBasicTestStructWithVecTwo(BaseModel): @@ -145,19 +144,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_basic_teststructwithvectwo_response( - value: reflectapi_demo.tests.basic.TestStructWithVecTwo, -) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithVecTwo]: - """Create a mock ApiResponse for reflectapi_demo.tests.basic.TestStructWithVecTwo.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap index f3c16c05..2f7a16ff 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsTestEnum(str, Enum): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenum_response( - value: reflectapi_demo.tests.enums.TestEnum, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnum]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnum.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap index 0ef5cc2d..a942237b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsTestEnumEmpty(str, Enum): @@ -143,19 +142,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumempty_response( - value: reflectapi_demo.tests.enums.TestEnumEmpty, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumEmpty]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumEmpty.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap index 2b4e58df..1948e8f5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsNums(str, Enum): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_nums_response( - value: reflectapi_demo.tests.enums.Nums, -) -> ApiResponse[reflectapi_demo.tests.enums.Nums]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.Nums.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap index 77ab2b22..35c6f2c9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsTestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant( @@ -249,61 +248,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_TestEnumWithBasicVariantAndFieldsAndNamedFieldsFactory: - """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields variants with ergonomic syntax. - - reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields variants - """ - - @staticmethod - def variant0() -> ( - reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields - ): - """Creates the 'Variant0' variant of the reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" - return ( - reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields( - "Variant0" - ) - ) - - @staticmethod - def variant1( - field_0: int, field_1: str - ) -> reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields( - reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant1Variant( - field_0=field_0, field_1=field_1 - ) - ) - - @staticmethod - def variant2( - field1: int, field2: str - ) -> reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields( - reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFieldsVariant2Variant( - field1=field1, field2=field2 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithbasicvariantandfieldsandnamedfields_response( - value: reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields, -) -> ApiResponse[ - reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields -]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithBasicVariantAndFieldsAndNamedFields.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap index 0900cc4b..e619f8f6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored(str, Enum): @@ -150,19 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithdiscriminantignored_response( - value: reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap index 84963ea7..473996f6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsTestEnumWithDiscriminantIgnored(str, Enum): @@ -136,19 +135,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithdiscriminantignored_response( - value: reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminantIgnored.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap index 4c613e1a..93607b49 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response from enum import IntEnum @@ -150,19 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithdiscriminant_response( - value: reflectapi_demo.tests.enums.TestEnumWithDiscriminant, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminant.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap index c679b4e7..ce0c6143 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response from enum import IntEnum @@ -140,19 +139,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithdiscriminant_response( - value: reflectapi_demo.tests.enums.TestEnumWithDiscriminant, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithDiscriminant]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithDiscriminant.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap index 39a42269..2e80eb88 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsTestEnumWithEmptyVariantAndFieldsVariant2Variant( @@ -218,42 +217,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_TestEnumWithEmptyVariantAndFieldsFactory: - """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields variants with ergonomic syntax. - - reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields variants - """ - - @staticmethod - def variant1() -> reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields("Variant1") - - @staticmethod - def variant2( - field_0: int, - ) -> reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields( - reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFieldsVariant2Variant( - field_0=field_0 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithemptyvariantandfields_response( - value: reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithEmptyVariantAndFields.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap index 04c8519f..5faca6ec 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsTestEnumWithFieldsVariant1Variant(BaseModel): @@ -227,46 +226,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_TestEnumWithFieldsFactory: - """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithFields variants with ergonomic syntax. - - reflectapi_demo.tests.enums.TestEnumWithFields variants - """ - - @staticmethod - def variant1(field_0: int) -> reflectapi_demo.tests.enums.TestEnumWithFields: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithFields( - reflectapi_demo.tests.enums.TestEnumWithFieldsVariant1Variant( - field_0=field_0 - ) - ) - - @staticmethod - def variant2( - field_0: str, field_1: float - ) -> reflectapi_demo.tests.enums.TestEnumWithFields: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithFields( - reflectapi_demo.tests.enums.TestEnumWithFieldsVariant2Variant( - field_0=field_0, field_1=field_1 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithfields_response( - value: reflectapi_demo.tests.enums.TestEnumWithFields, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithFields]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithFields.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap index 3646d220..0075bfbc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -248,46 +247,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_TestEnumWithGenericsFactory: - """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithGenerics variants with ergonomic syntax. - - reflectapi_demo.tests.enums.TestEnumWithGenerics variants - """ - - @staticmethod - def variant1(field_0: T) -> reflectapi_demo.tests.enums.TestEnumWithGenerics[T]: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithGenerics enum.""" - return reflectapi_demo.tests.enums.TestEnumWithGenerics( - reflectapi_demo.tests.enums.TestEnumWithGenericsVariant1Variant[T]( - field_0=field_0 - ) - ) - - @staticmethod - def variant2( - field_0: T, field_1: T - ) -> reflectapi_demo.tests.enums.TestEnumWithGenerics[T]: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithGenerics enum.""" - return reflectapi_demo.tests.enums.TestEnumWithGenerics( - reflectapi_demo.tests.enums.TestEnumWithGenericsVariant2Variant[T]( - field_0=field_0, field_1=field_1 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithgenerics_response( - value: reflectapi_demo.tests.enums.TestEnumWithGenerics, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithGenerics]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithGenerics.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap index 36376305..50170443 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -256,48 +255,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_TestEnumWithGenericsAndFieldsFactory: - """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields variants with ergonomic syntax. - - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields variants - """ - - @staticmethod - def variant1( - field_0: int, - ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields[T]: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields( - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsVariant1Variant[T]( - field_0=field_0 - ) - ) - - @staticmethod - def variant2( - field_0: T, field_1: T - ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields[T]: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields( - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsVariant2Variant[T]( - field_0=field_0, field_1=field_1 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithgenericsandfields_response( - value: reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields, -) -> ApiResponse[reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithGenericsAndFields.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap index 943130aa..c2f48eff 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -290,61 +289,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_TestEnumWithGenericsAndFieldsAndNamedFieldsFactory: - """Factory class for creating reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields variants with ergonomic syntax. - - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields variants - """ - - @staticmethod - def variant1( - field_0: int, - ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[T]: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields( - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant[ - T - ](field_0=field_0) - ) - - @staticmethod - def variant2( - field_0: T, field_1: T - ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[T]: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields( - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFieldsVariant2Variant[ - T - ](field_0=field_0, field_1=field_1) - ) - - @staticmethod - def variant3( - field1: int, field2: T - ) -> reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields[T]: - """Creates the 'Variant3' variant of the reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields enum.""" - return reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields( - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFieldsVariant3Variant[ - T - ](field1=field1, field2=field2) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_testenumwithgenericsandfieldsandnamedfields_response( - value: reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields, -) -> ApiResponse[ - reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields -]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.TestEnumWithGenericsAndFieldsAndNamedFields.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap index f8482871..051d6de2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsA(str, Enum): @@ -160,38 +159,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_EFactory: - """Factory class for creating reflectapi_demo.tests.enums.E variants with ergonomic syntax. - - reflectapi_demo.tests.enums.E variants - """ - - @staticmethod - def a(field_0: reflectapi_demo.tests.enums.A) -> reflectapi_demo.tests.enums.EA: - """Creates the 'a' variant of the reflectapi_demo.tests.enums.E enum.""" - return reflectapi_demo.tests.enums.EA(field_0=field_0) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_a_response( - value: reflectapi_demo.tests.enums.A, -) -> ApiResponse[reflectapi_demo.tests.enums.A]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.A.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_enums_e_response( - value: reflectapi_demo.tests.enums.E, -) -> ApiResponse[reflectapi_demo.tests.enums.E]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.E.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap index efa7d1d5..1b463415 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsEnumsAX(BaseModel): @@ -163,33 +162,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_enums_AFactory: - """Factory class for creating reflectapi_demo.tests.enums.A variants with ergonomic syntax. - - reflectapi_demo.tests.enums.A variants - """ - - X = reflectapi_demo.tests.enums.AX() - - @staticmethod - def y(field_0: None) -> reflectapi_demo.tests.enums.AY: - """Creates the 'Y' variant of the reflectapi_demo.tests.enums.A enum.""" - return reflectapi_demo.tests.enums.AY(field_0=field_0) - - -# Testing utilities - - -def create_reflectapi_demo_tests_enums_a_response( - value: reflectapi_demo.tests.enums.A, -) -> ApiResponse[reflectapi_demo.tests.enums.A]: - """Create a mock ApiResponse for reflectapi_demo.tests.enums.A.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap index 0d64e64c..217b76a6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsGenericsTestStructWithCircularReference(BaseModel): @@ -152,19 +151,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreference_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReference, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithCircularReference]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReference.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap index 09a41dfe..336b96ad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -161,19 +160,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap index 95504931..f560b362 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -184,28 +183,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGeneric.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericparent_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent, -) -> ApiResponse[ - reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent -]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericParent.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap index 37f06abe..457b68a8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -173,21 +172,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutbox_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox, -) -> ApiResponse[ - reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox -]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap index 20c0d457..d43ced93 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -191,30 +190,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutbox_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox, -) -> ApiResponse[ - reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox -]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutboxparent_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent, -) -> ApiResponse[ - reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent -]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParent.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap index e76009b1..0337b867 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -178,30 +177,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutbox_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox, -) -> ApiResponse[ - reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox -]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBox.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_generics_teststructwithcircularreferencegenericwithoutboxparentspecific_response( - value: reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific, -) -> ApiResponse[ - reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific -]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithCircularReferenceGenericWithoutBoxParentSpecific.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap index aac6dd8a..36d1a325 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -170,26 +169,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithnestedgenericstruct_response( - value: reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithNestedGenericStruct.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap index a0d3b054..d978ef7b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -173,26 +172,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithnestedgenericstructtwice_response( - value: reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithNestedGenericStructTwice.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap index 3cc3df86..2b628e89 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -156,19 +155,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap index 125d4bca..81bff2f2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -156,19 +155,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithvecgeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithVecGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap index f2d6a746..409ed097 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -172,26 +171,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithsimplegeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithSimpleGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithSimpleGeneric.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_generics_teststructwithvecgenericgeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGenericGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap index 84fc32f0..2e286df1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -172,26 +171,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_generics_teststructwithvecgeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithVecGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGeneric.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_generics_teststructwithvecgenericgenericgeneric_response( - value: reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric, -) -> ApiResponse[reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric]: - """Create a mock ApiResponse for reflectapi_demo.tests.generics.TestStructWithVecGenericGenericGeneric.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap index f9c4677c..dc4aa178 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestVariant1(BaseModel): @@ -170,36 +169,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestFactory: - """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Test variants - """ - - @staticmethod - def variant1(field_name: int) -> reflectapi_demo.tests.serde.TestVariant1: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.Test enum.""" - return reflectapi_demo.tests.serde.TestVariant1(field_name=field_name) - - @staticmethod - def variant2(field_0: str) -> reflectapi_demo.tests.serde.TestVariant2: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.Test enum.""" - return reflectapi_demo.tests.serde.TestVariant2(field_0=field_0) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_test_response( - value: reflectapi_demo.tests.serde.Test, -) -> ApiResponse[reflectapi_demo.tests.serde.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap index d4609a90..a5d61b6b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTreeNode(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_treenode_response( - value: reflectapi_demo.tests.serde.TreeNode, -) -> ApiResponse[reflectapi_demo.tests.serde.TreeNode]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TreeNode.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap index d6b3d2d5..98b2b12d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class StdTimeDuration(BaseModel): @@ -169,26 +168,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststruct_response( - value: reflectapi_demo.tests.serde.TestStruct, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStruct.""" - return create_api_response(value) - - -def create_std_time_duration_response( - value: std.time.Duration, -) -> ApiResponse[std.time.Duration]: - """Create a mock ApiResponse for std.time.Duration.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap index 87ea3411..8a352b63 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeNever(str, Enum): @@ -143,19 +142,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_never_response( - value: reflectapi_demo.tests.serde.Never, -) -> ApiResponse[reflectapi_demo.tests.serde.Never]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Never.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index 590d977e..d63abfef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant( @@ -237,47 +236,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEmptyVariantsAdjacentlyTaggedFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged variants - """ - - @staticmethod - def empty() -> reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged: - """Creates the 'Empty' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged enum.""" - return reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged.model_validate( - {"t": "Empty"} - ) - - @staticmethod - def empty_unit() -> reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged: - """Creates the 'EmptyUnit' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged enum.""" - return reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged( - reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant() - ) - - @staticmethod - def empty_struct() -> reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged: - """Creates the 'EmptyStruct' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged enum.""" - return reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged( - reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTaggedEmptyStructVariant() - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testemptyvariantsadjacentlytagged_response( - value: reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap index ea56e7da..4d550211 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant( @@ -239,45 +238,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEmptyVariantsExternallyTaggedFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged variants - """ - - @staticmethod - def empty() -> reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged: - """Creates the 'Empty' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged enum.""" - return reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged("Empty") - - @staticmethod - def empty_unit() -> reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged: - """Creates the 'EmptyUnit' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged enum.""" - return reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged( - reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTaggedEmptyUnitVariant() - ) - - @staticmethod - def empty_struct() -> reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged: - """Creates the 'EmptyStruct' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged enum.""" - return reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged( - reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTaggedEmptyStructVariant() - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testemptyvariantsexternallytagged_response( - value: reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap index 216aaa1c..f19658fb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty(BaseModel): @@ -177,35 +176,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEmptyVariantsInterallyTaggedFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged variants - """ - - EMPTY = reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTaggedEmpty() - - @staticmethod - def empty_struct() -> ( - reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTaggedEmptyStruct - ): - """Creates the 'EmptyStruct' variant of the reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged enum.""" - return reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTaggedEmptyStruct() - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testemptyvariantsinterallytagged_response( - value: reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap index e8699d08..7d9d642c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty(BaseModel): @@ -173,19 +172,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testemptyvariantsuntagged_response( - value: reflectapi_demo.tests.serde.TestEmptyVariantsUntagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsUntagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEmptyVariantsUntagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap index e061a5aa..e1208878 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeMixedUnit(BaseModel): @@ -178,38 +177,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_MixedFactory: - """Factory class for creating reflectapi_demo.tests.serde.Mixed variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Mixed variants - """ - - UNIT = reflectapi_demo.tests.serde.MixedUnit() - - @staticmethod - def wrap(value: str) -> reflectapi_demo.tests.serde.MixedWrap: - """Creates the 'Wrap' variant of the reflectapi_demo.tests.serde.Mixed enum.""" - return reflectapi_demo.tests.serde.MixedWrap(value=value) - - @staticmethod - def full(x: int, y: int) -> reflectapi_demo.tests.serde.MixedFull: - """Creates the 'Full' variant of the reflectapi_demo.tests.serde.Mixed enum.""" - return reflectapi_demo.tests.serde.MixedFull(x=x, y=y) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_mixed_response( - value: reflectapi_demo.tests.serde.Mixed, -) -> ApiResponse[reflectapi_demo.tests.serde.Mixed]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Mixed.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap index ecac5b14..ad07a023 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeMyEnum(str, Enum): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_myenum_response( - value: reflectapi_demo.tests.serde.MyEnum, -) -> ApiResponse[reflectapi_demo.tests.serde.MyEnum]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyEnum.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap index b43b1466..3123173f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumRenameAll(str, Enum): @@ -143,19 +142,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumrenameall_response( - value: reflectapi_demo.tests.serde.TestEnumRenameAll, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAll]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumRenameAll.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap index 10d67888..69e84b15 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant(BaseModel): @@ -235,48 +234,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumRenameAllOnVariantFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant variants - """ - - @staticmethod - def variant1( - field_name: int, - ) -> reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant enum.""" - return reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant( - reflectapi_demo.tests.serde.TestEnumRenameAllOnVariantVariant1Variant( - field_name=field_name - ) - ) - - @staticmethod - def variant2( - field_0: int, - ) -> reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant enum.""" - return reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant( - reflectapi_demo.tests.serde.TestEnumRenameAllOnVariantVariant2Variant( - field_0=field_0 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumrenameallonvariant_response( - value: reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap index 34721573..4e6bce2a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant(BaseModel): @@ -207,37 +206,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumRenameVariantFieldFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumRenameVariantField variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumRenameVariantField variants - """ - - @staticmethod - def variant2( - variant2_field_name: int, - ) -> reflectapi_demo.tests.serde.TestEnumRenameVariantField: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumRenameVariantField enum.""" - return reflectapi_demo.tests.serde.TestEnumRenameVariantField( - reflectapi_demo.tests.serde.TestEnumRenameVariantFieldVariant2Variant( - variant2_field_name=variant2_field_name - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumrenamevariantfield_response( - value: reflectapi_demo.tests.serde.TestEnumRenameVariantField, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumRenameVariantField]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumRenameVariantField.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap index ec1b2f99..233b7903 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumTagVariant1(BaseModel): @@ -171,36 +170,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumTagFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumTag variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumTag variants - """ - - @staticmethod - def variant1(field_name: int) -> reflectapi_demo.tests.serde.TestEnumTagVariant1: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumTag enum.""" - return reflectapi_demo.tests.serde.TestEnumTagVariant1(field_name=field_name) - - @staticmethod - def variant2(field_name: int) -> reflectapi_demo.tests.serde.TestEnumTagVariant2: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumTag enum.""" - return reflectapi_demo.tests.serde.TestEnumTagVariant2(field_name=field_name) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumtag_response( - value: reflectapi_demo.tests.serde.TestEnumTag, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTag]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumTag.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index eeee6b29..73a06da1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant(BaseModel): @@ -229,44 +228,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumTagContentFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumTagContent variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumTagContent variants - """ - - @staticmethod - def variant1(field_name: int) -> reflectapi_demo.tests.serde.TestEnumTagContent: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumTagContent enum.""" - return reflectapi_demo.tests.serde.TestEnumTagContent( - reflectapi_demo.tests.serde.TestEnumTagContentVariant1Variant( - field_name=field_name - ) - ) - - @staticmethod - def variant2(field_0: int) -> reflectapi_demo.tests.serde.TestEnumTagContent: - """Creates the 'Variant2' variant of the reflectapi_demo.tests.serde.TestEnumTagContent enum.""" - return reflectapi_demo.tests.serde.TestEnumTagContent( - reflectapi_demo.tests.serde.TestEnumTagContentVariant2Variant( - field_0=field_0 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumtagcontent_response( - value: reflectapi_demo.tests.serde.TestEnumTagContent, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContent]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumTagContent.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index 69ee3d53..edfd1d7c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant(BaseModel): @@ -237,48 +236,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumTagContentRenameAllFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumTagContentRenameAll variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumTagContentRenameAll variants - """ - - @staticmethod - def variant1( - field_name: int, - ) -> reflectapi_demo.tests.serde.TestEnumTagContentRenameAll: - """Creates the 'variant1' variant of the reflectapi_demo.tests.serde.TestEnumTagContentRenameAll enum.""" - return reflectapi_demo.tests.serde.TestEnumTagContentRenameAll( - reflectapi_demo.tests.serde.TestEnumTagContentRenameAllVariant1Variant( - field_name=field_name - ) - ) - - @staticmethod - def variant2( - field_0: int, - ) -> reflectapi_demo.tests.serde.TestEnumTagContentRenameAll: - """Creates the 'variant2' variant of the reflectapi_demo.tests.serde.TestEnumTagContentRenameAll enum.""" - return reflectapi_demo.tests.serde.TestEnumTagContentRenameAll( - reflectapi_demo.tests.serde.TestEnumTagContentRenameAllVariant2Variant( - field_0=field_0 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumtagcontentrenameall_response( - value: reflectapi_demo.tests.serde.TestEnumTagContentRenameAll, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumTagContentRenameAll]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumTagContentRenameAll.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap index 457cd286..1cfab641 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1(BaseModel): @@ -161,19 +160,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumuntagged_response( - value: reflectapi_demo.tests.serde.TestEnumUntagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumUntagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumUntagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap index 5376249d..cc65c97b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant(BaseModel): @@ -201,33 +200,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumWithFieldSkipFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumWithFieldSkip variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumWithFieldSkip variants - """ - - @staticmethod - def variant1() -> reflectapi_demo.tests.serde.TestEnumWithFieldSkip: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithFieldSkip enum.""" - return reflectapi_demo.tests.serde.TestEnumWithFieldSkip( - reflectapi_demo.tests.serde.TestEnumWithFieldSkipVariant1Variant() - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumwithfieldskip_response( - value: reflectapi_demo.tests.serde.TestEnumWithFieldSkip, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithFieldSkip]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithFieldSkip.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap index c773821c..7563f4d0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeLargeEnumAlpha(BaseModel): @@ -274,63 +273,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_LargeEnumFactory: - """Factory class for creating reflectapi_demo.tests.serde.LargeEnum variants with ergonomic syntax. - - reflectapi_demo.tests.serde.LargeEnum variants - """ - - ALPHA = reflectapi_demo.tests.serde.LargeEnumAlpha() - BETA = reflectapi_demo.tests.serde.LargeEnumBeta() - EPSILON = reflectapi_demo.tests.serde.LargeEnumEpsilon() - ETA = reflectapi_demo.tests.serde.LargeEnumEta() - IOTA = reflectapi_demo.tests.serde.LargeEnumIota() - LAMBDA = reflectapi_demo.tests.serde.LargeEnumLambda() - - @staticmethod - def gamma(x: int) -> reflectapi_demo.tests.serde.LargeEnumGamma: - """Creates the 'Gamma' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" - return reflectapi_demo.tests.serde.LargeEnumGamma(x=x) - - @staticmethod - def delta(value: str) -> reflectapi_demo.tests.serde.LargeEnumDelta: - """Creates the 'Delta' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" - return reflectapi_demo.tests.serde.LargeEnumDelta(value=value) - - @staticmethod - def zeta(y: bool) -> reflectapi_demo.tests.serde.LargeEnumZeta: - """Creates the 'Zeta' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" - return reflectapi_demo.tests.serde.LargeEnumZeta(y=y) - - @staticmethod - def theta(value: int) -> reflectapi_demo.tests.serde.LargeEnumTheta: - """Creates the 'Theta' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" - return reflectapi_demo.tests.serde.LargeEnumTheta(value=value) - - @staticmethod - def kappa(z: float) -> reflectapi_demo.tests.serde.LargeEnumKappa: - """Creates the 'Kappa' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" - return reflectapi_demo.tests.serde.LargeEnumKappa(z=z) - - @staticmethod - def mu(w: str, v: int) -> reflectapi_demo.tests.serde.LargeEnumMu: - """Creates the 'Mu' variant of the reflectapi_demo.tests.serde.LargeEnum enum.""" - return reflectapi_demo.tests.serde.LargeEnumMu(w=w, v=v) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_largeenum_response( - value: reflectapi_demo.tests.serde.LargeEnum, -) -> ApiResponse[reflectapi_demo.tests.serde.LargeEnum]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.LargeEnum.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index c580b650..19d8b3bc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant( @@ -213,37 +212,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumWithRenameToInvalidCharsFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars variants - """ - - @staticmethod - def variant1( - field_name__: int, - ) -> reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars enum.""" - return reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars( - reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidCharsVariant1Variant( - f=field_name__ - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumwithrenametoinvalidchars_response( - value: reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap index d23c021b..aa75d7bf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeActionCreateItemVariant(BaseModel): @@ -211,40 +210,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_ActionFactory: - """Factory class for creating reflectapi_demo.tests.serde.Action variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Action variants - """ - - @staticmethod - def create_item(name: str) -> reflectapi_demo.tests.serde.Action: - """Creates the 'create_item' variant of the reflectapi_demo.tests.serde.Action enum.""" - return reflectapi_demo.tests.serde.Action( - reflectapi_demo.tests.serde.ActionCreateItemVariant(name=name) - ) - - @staticmethod - def delete_item(id: int) -> reflectapi_demo.tests.serde.Action: - """Creates the 'delete_item' variant of the reflectapi_demo.tests.serde.Action enum.""" - return reflectapi_demo.tests.serde.Action( - reflectapi_demo.tests.serde.ActionDeleteItemVariant(id=id) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_action_response( - value: reflectapi_demo.tests.serde.Action, -) -> ApiResponse[reflectapi_demo.tests.serde.Action]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Action.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap index 14172da6..a9ad367b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0(BaseModel): @@ -206,45 +205,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_input_TestEnumWithVariantOtherFactory: - """Factory class for creating reflectapi_demo.tests.serde.input.TestEnumWithVariantOther variants with ergonomic syntax. - - reflectapi_demo.tests.serde.input.TestEnumWithVariantOther variants - """ - - V0 = reflectapi_demo.tests.serde.input.TestEnumWithVariantOtherV0() - - -class reflectapi_demo_tests_serde_output_TestEnumWithVariantOtherFactory: - """Factory class for creating reflectapi_demo.tests.serde.output.TestEnumWithVariantOther variants with ergonomic syntax. - - reflectapi_demo.tests.serde.output.TestEnumWithVariantOther variants - """ - - V0 = reflectapi_demo.tests.serde.output.TestEnumWithVariantOtherV0() - VARIANT1 = reflectapi_demo.tests.serde.output.TestEnumWithVariantOtherVariant1() - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_testenumwithvariantother_response( - value: reflectapi_demo.tests.serde.input.TestEnumWithVariantOther, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestEnumWithVariantOther]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestEnumWithVariantOther.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_testenumwithvariantother_response( - value: reflectapi_demo.tests.serde.output.TestEnumWithVariantOther, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestEnumWithVariantOther.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap index 266725a6..59dff440 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumWithVariantSkip(str, Enum): @@ -143,19 +142,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumwithvariantskip_response( - value: reflectapi_demo.tests.serde.TestEnumWithVariantSkip, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantSkip]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithVariantSkip.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap index fc18dd3d..4eb469d2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize(str, Enum): @@ -170,26 +169,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_testenumwithvariantskipdeserialize_response( - value: reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_testenumwithvariantskipdeserialize_response( - value: reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap index 705ccf8c..06027402 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize(str, Enum): @@ -170,26 +169,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_testenumwithvariantskipserialize_response( - value: reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_testenumwithvariantskipserialize_response( - value: reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap index 1a3fed86..2886e42f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant(BaseModel): @@ -208,37 +207,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestEnumWithVariantUntaggedFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestEnumWithVariantUntagged variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestEnumWithVariantUntagged variants - """ - - @staticmethod - def variant1( - field_0: int, - ) -> reflectapi_demo.tests.serde.TestEnumWithVariantUntagged: - """Creates the 'Variant1' variant of the reflectapi_demo.tests.serde.TestEnumWithVariantUntagged enum.""" - return reflectapi_demo.tests.serde.TestEnumWithVariantUntagged( - reflectapi_demo.tests.serde.TestEnumWithVariantUntaggedVariant1Variant( - field_0=field_0 - ) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testenumwithvariantuntagged_response( - value: reflectapi_demo.tests.serde.TestEnumWithVariantUntagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithVariantUntagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestEnumWithVariantUntagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap index 6bcc3051..63214b5b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTest(BaseModel): @@ -147,19 +146,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_test_response( - value: reflectapi_demo.tests.serde.Test, -) -> ApiResponse[reflectapi_demo.tests.serde.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap index d977e9e1..bfa982b5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeKeywords(BaseModel): @@ -147,19 +146,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_keywords_response( - value: reflectapi_demo.tests.serde.Keywords, -) -> ApiResponse[reflectapi_demo.tests.serde.Keywords]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Keywords.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap index 728c73a7..c8998f4d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeSpecialNames(BaseModel): @@ -152,19 +151,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_specialnames_response( - value: reflectapi_demo.tests.serde.SpecialNames, -) -> ApiResponse[reflectapi_demo.tests.serde.SpecialNames]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.SpecialNames.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index 15ae860f..e80f95d1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdePayloadTextVariant(BaseModel): @@ -224,47 +223,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_PayloadFactory: - """Factory class for creating reflectapi_demo.tests.serde.Payload variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Payload variants - """ - - @staticmethod - def text(body: str) -> reflectapi_demo.tests.serde.Payload: - """Creates the 'Text' variant of the reflectapi_demo.tests.serde.Payload enum.""" - return reflectapi_demo.tests.serde.Payload( - reflectapi_demo.tests.serde.PayloadTextVariant(body=body) - ) - - @staticmethod - def binary(size: int) -> reflectapi_demo.tests.serde.Payload: - """Creates the 'Binary' variant of the reflectapi_demo.tests.serde.Payload enum.""" - return reflectapi_demo.tests.serde.Payload( - reflectapi_demo.tests.serde.PayloadBinaryVariant(size=size) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_message_response( - value: reflectapi_demo.tests.serde.Message, -) -> ApiResponse[reflectapi_demo.tests.serde.Message]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Message.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_payload_response( - value: reflectapi_demo.tests.serde.Payload, -) -> ApiResponse[reflectapi_demo.tests.serde.Payload]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Payload.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap index ecce85d8..c993000b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeStatusActive(BaseModel): @@ -230,37 +229,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_StatusFactory: - """Factory class for creating reflectapi_demo.tests.serde.Status variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Status variants - """ - - ACTIVE = reflectapi_demo.tests.serde.StatusActive() - INACTIVE = reflectapi_demo.tests.serde.StatusInactive() - PENDING = reflectapi_demo.tests.serde.StatusPending() - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_item_response( - value: reflectapi_demo.tests.serde.Item, -) -> ApiResponse[reflectapi_demo.tests.serde.Item]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Item.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_status_response( - value: reflectapi_demo.tests.serde.Status, -) -> ApiResponse[reflectapi_demo.tests.serde.Status]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Status.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap index 267ba291..2fad2b20 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeShapeCircleVariant(BaseModel): @@ -218,47 +217,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_ShapeFactory: - """Factory class for creating reflectapi_demo.tests.serde.Shape variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Shape variants - """ - - @staticmethod - def circle(radius: float) -> reflectapi_demo.tests.serde.Shape: - """Creates the 'Circle' variant of the reflectapi_demo.tests.serde.Shape enum.""" - return reflectapi_demo.tests.serde.Shape( - reflectapi_demo.tests.serde.ShapeCircleVariant(radius=radius) - ) - - @staticmethod - def rect(width: float, height: float) -> reflectapi_demo.tests.serde.Shape: - """Creates the 'Rect' variant of the reflectapi_demo.tests.serde.Shape enum.""" - return reflectapi_demo.tests.serde.Shape( - reflectapi_demo.tests.serde.ShapeRectVariant(width=width, height=height) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_drawing_response( - value: reflectapi_demo.tests.serde.Drawing, -) -> ApiResponse[reflectapi_demo.tests.serde.Drawing]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Drawing.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_shape_response( - value: reflectapi_demo.tests.serde.Shape, -) -> ApiResponse[reflectapi_demo.tests.serde.Shape]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Shape.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap index 6f70da0a..fbcba807 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -188,56 +187,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestFactory: - """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Test variants - """ - - @staticmethod - def s( - field_0: reflectapi_demo.tests.serde.S[ - reflectapi_demo.tests.serde.A, reflectapi_demo.tests.serde.B - ], - ) -> reflectapi_demo.tests.serde.TestS: - """Creates the 'S' variant of the reflectapi_demo.tests.serde.Test enum.""" - return reflectapi_demo.tests.serde.TestS(field_0=field_0) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_a_response( - value: reflectapi_demo.tests.serde.A, -) -> ApiResponse[reflectapi_demo.tests.serde.A]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.A.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_b_response( - value: reflectapi_demo.tests.serde.B, -) -> ApiResponse[reflectapi_demo.tests.serde.B]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.B.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_s_response( - value: reflectapi_demo.tests.serde.S, -) -> ApiResponse[reflectapi_demo.tests.serde.S]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.S.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_test_response( - value: reflectapi_demo.tests.serde.Test, -) -> ApiResponse[reflectapi_demo.tests.serde.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index e27b790d..3a45e12b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeOfferKindSingle(BaseModel): @@ -211,43 +210,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_OfferKindFactory: - """Factory class for creating reflectapi_demo.tests.serde.OfferKind variants with ergonomic syntax. - - reflectapi_demo.tests.serde.OfferKind variants - """ - - @staticmethod - def single(business: str) -> reflectapi_demo.tests.serde.OfferKindSingle: - """Creates the 'Single' variant of the reflectapi_demo.tests.serde.OfferKind enum.""" - return reflectapi_demo.tests.serde.OfferKindSingle(business=business) - - @staticmethod - def group(count: int) -> reflectapi_demo.tests.serde.OfferKindGroup: - """Creates the 'Group' variant of the reflectapi_demo.tests.serde.OfferKind enum.""" - return reflectapi_demo.tests.serde.OfferKindGroup(count=count) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_offer_response( - value: reflectapi_demo.tests.serde.Offer, -) -> ApiResponse[reflectapi_demo.tests.serde.Offer]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Offer.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_offerkind_response( - value: reflectapi_demo.tests.serde.OfferKind, -) -> ApiResponse[reflectapi_demo.tests.serde.OfferKind]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.OfferKind.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap index 72a197d1..4b126e61 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTimestamps(BaseModel): @@ -170,33 +169,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_document_response( - value: reflectapi_demo.tests.serde.Document, -) -> ApiResponse[reflectapi_demo.tests.serde.Document]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Document.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_metadata_response( - value: reflectapi_demo.tests.serde.Metadata, -) -> ApiResponse[reflectapi_demo.tests.serde.Metadata]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Metadata.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_timestamps_response( - value: reflectapi_demo.tests.serde.Timestamps, -) -> ApiResponse[reflectapi_demo.tests.serde.Timestamps]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Timestamps.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap index bf8eb0df..5f61ed83 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdePriorityHigh(BaseModel): @@ -198,40 +197,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_PriorityFactory: - """Factory class for creating reflectapi_demo.tests.serde.Priority variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Priority variants - """ - - LOW = reflectapi_demo.tests.serde.PriorityLow() - - @staticmethod - def high(deadline: str) -> reflectapi_demo.tests.serde.PriorityHigh: - """Creates the 'High' variant of the reflectapi_demo.tests.serde.Priority enum.""" - return reflectapi_demo.tests.serde.PriorityHigh(deadline=deadline) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_priority_response( - value: reflectapi_demo.tests.serde.Priority, -) -> ApiResponse[reflectapi_demo.tests.serde.Priority]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Priority.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_task_response( - value: reflectapi_demo.tests.serde.Task, -) -> ApiResponse[reflectapi_demo.tests.serde.Task]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Task.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap index 87b0d42c..759d81bc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeAudit(BaseModel): @@ -224,50 +223,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_ContentFactory: - """Factory class for creating reflectapi_demo.tests.serde.Content variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Content variants - """ - - @staticmethod - def text(body: str) -> reflectapi_demo.tests.serde.ContentText: - """Creates the 'Text' variant of the reflectapi_demo.tests.serde.Content enum.""" - return reflectapi_demo.tests.serde.ContentText(body=body) - - @staticmethod - def image(url: str, width: int) -> reflectapi_demo.tests.serde.ContentImage: - """Creates the 'Image' variant of the reflectapi_demo.tests.serde.Content enum.""" - return reflectapi_demo.tests.serde.ContentImage(url=url, width=width) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_audit_response( - value: reflectapi_demo.tests.serde.Audit, -) -> ApiResponse[reflectapi_demo.tests.serde.Audit]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Audit.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_content_response( - value: reflectapi_demo.tests.serde.Content, -) -> ApiResponse[reflectapi_demo.tests.serde.Content]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Content.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_post_response( - value: reflectapi_demo.tests.serde.Post, -) -> ApiResponse[reflectapi_demo.tests.serde.Post]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Post.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap index 46b90147..a0506c13 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInner(BaseModel): @@ -167,33 +166,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_inner_response( - value: reflectapi_demo.tests.serde.Inner, -) -> ApiResponse[reflectapi_demo.tests.serde.Inner]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Inner.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_middle_response( - value: reflectapi_demo.tests.serde.Middle, -) -> ApiResponse[reflectapi_demo.tests.serde.Middle]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Middle.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_outer_response( - value: reflectapi_demo.tests.serde.Outer, -) -> ApiResponse[reflectapi_demo.tests.serde.Outer]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Outer.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap index 2f00cc92..2986ef9b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -172,26 +171,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_k_response( - value: reflectapi_demo.tests.serde.K, -) -> ApiResponse[reflectapi_demo.tests.serde.K]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.K.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_s_response( - value: reflectapi_demo.tests.serde.S, -) -> ApiResponse[reflectapi_demo.tests.serde.S]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.S.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap index 0a1be487..2b611666 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeValueNum(BaseModel): @@ -171,26 +170,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_cell_response( - value: reflectapi_demo.tests.serde.Cell, -) -> ApiResponse[reflectapi_demo.tests.serde.Cell]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Cell.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_value_response( - value: reflectapi_demo.tests.serde.Value, -) -> ApiResponse[reflectapi_demo.tests.serde.Value]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Value.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap index 28351155..f0785457 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -206,33 +205,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TaggedFactory: - """Factory class for creating reflectapi_demo.tests.serde.Tagged variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Tagged variants - """ - - @staticmethod - def item(field_0: T) -> reflectapi_demo.tests.serde.Tagged[T]: - """Creates the 'Item' variant of the reflectapi_demo.tests.serde.Tagged enum.""" - return reflectapi_demo.tests.serde.Tagged( - reflectapi_demo.tests.serde.TaggedItemVariant[T](field_0=field_0) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_tagged_response( - value: reflectapi_demo.tests.serde.Tagged, -) -> ApiResponse[reflectapi_demo.tests.serde.Tagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Tagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap index 798fb7d7..4b46cf16 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response # Type variables for generic types @@ -210,33 +209,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_WrapperFactory: - """Factory class for creating reflectapi_demo.tests.serde.Wrapper variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Wrapper variants - """ - - @staticmethod - def value(field_0: T) -> reflectapi_demo.tests.serde.Wrapper[T]: - """Creates the 'Value' variant of the reflectapi_demo.tests.serde.Wrapper enum.""" - return reflectapi_demo.tests.serde.Wrapper( - reflectapi_demo.tests.serde.WrapperValueVariant[T](field_0=field_0) - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_wrapper_response( - value: reflectapi_demo.tests.serde.Wrapper, -) -> ApiResponse[reflectapi_demo.tests.serde.Wrapper]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Wrapper.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap index b89abf14..45624de1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap index 11af942f..ea5d4355 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap index 6436d4fc..f3a9a9c0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTest(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_test_response( - value: reflectapi_demo.tests.serde.Test, -) -> ApiResponse[reflectapi_demo.tests.serde.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap index 7be32acf..9d66aa03 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeUnderscored(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_underscored_response( - value: reflectapi_demo.tests.serde.Underscored, -) -> ApiResponse[reflectapi_demo.tests.serde.Underscored]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Underscored.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap index 09ddd255..0d8d3a50 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeDeepNestedInnerDeepType(BaseModel): @@ -153,19 +152,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_deep_nested_inner_deeptype_response( - value: reflectapi_demo.tests.serde.deep.nested.inner.DeepType, -) -> ApiResponse[reflectapi_demo.tests.serde.deep.nested.inner.DeepType]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.deep.nested.inner.DeepType.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap index 287e3157..68877877 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeSimpleTopLevel(BaseModel): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_simpletoplevel_response( - value: reflectapi_demo.tests.serde.SimpleTopLevel, -) -> ApiResponse[reflectapi_demo.tests.serde.SimpleTopLevel]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.SimpleTopLevel.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap index 4957ac54..c6e1187f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTypeWithNumbers(BaseModel): @@ -147,19 +146,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_typewithnumbers_response( - value: reflectapi_demo.tests.serde.TypeWithNumbers, -) -> ApiResponse[reflectapi_demo.tests.serde.TypeWithNumbers]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TypeWithNumbers.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap index 3fe5347e..24676488 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeComplex(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_complex_response( - value: reflectapi_demo.tests.serde.Complex, -) -> ApiResponse[reflectapi_demo.tests.serde.Complex]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Complex.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap index 3a7a4225..77cb56bb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeV2C(BaseModel): @@ -222,88 +221,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_V2Factory: - """Factory class for creating reflectapi_demo.tests.serde.V2 variants with ergonomic syntax. - - reflectapi_demo.tests.serde.V2 variants - """ - - @staticmethod - def c(c: int) -> reflectapi_demo.tests.serde.V2C: - """Creates the 'C' variant of the reflectapi_demo.tests.serde.V2 enum.""" - return reflectapi_demo.tests.serde.V2C(c=c) - - @staticmethod - def d(d: int) -> reflectapi_demo.tests.serde.V2D: - """Creates the 'D' variant of the reflectapi_demo.tests.serde.V2 enum.""" - return reflectapi_demo.tests.serde.V2D(d=d) - - -class reflectapi_demo_tests_serde_V1Factory: - """Factory class for creating reflectapi_demo.tests.serde.V1 variants with ergonomic syntax. - - reflectapi_demo.tests.serde.V1 variants - """ - - @staticmethod - def a(a: int) -> reflectapi_demo.tests.serde.V1A: - """Creates the 'A' variant of the reflectapi_demo.tests.serde.V1 enum.""" - return reflectapi_demo.tests.serde.V1A(a=a) - - @staticmethod - def b(b: int) -> reflectapi_demo.tests.serde.V1B: - """Creates the 'B' variant of the reflectapi_demo.tests.serde.V1 enum.""" - return reflectapi_demo.tests.serde.V1B(b=b) - - -class reflectapi_demo_tests_serde_TestFactory: - """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Test variants - """ - - @staticmethod - def v1( - field_0: reflectapi_demo.tests.serde.V1, - ) -> reflectapi_demo.tests.serde.TestV1: - """Creates the 'v1' variant of the reflectapi_demo.tests.serde.Test enum.""" - return reflectapi_demo.tests.serde.TestV1(field_0=field_0) - - @staticmethod - def v2( - field_0: reflectapi_demo.tests.serde.V2, - ) -> reflectapi_demo.tests.serde.TestV2: - """Creates the 'v2' variant of the reflectapi_demo.tests.serde.Test enum.""" - return reflectapi_demo.tests.serde.TestV2(field_0=field_0) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_test_response( - value: reflectapi_demo.tests.serde.Test, -) -> ApiResponse[reflectapi_demo.tests.serde.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_v1_response( - value: reflectapi_demo.tests.serde.V1, -) -> ApiResponse[reflectapi_demo.tests.serde.V1]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.V1.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_v2_response( - value: reflectapi_demo.tests.serde.V2, -) -> ApiResponse[reflectapi_demo.tests.serde.V2]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.V2.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap index 7c068a22..8983c931 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeV1A(BaseModel): @@ -169,52 +168,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_V1Factory: - """Factory class for creating reflectapi_demo.tests.serde.V1 variants with ergonomic syntax. - - reflectapi_demo.tests.serde.V1 variants - """ - - @staticmethod - def a(a: int) -> reflectapi_demo.tests.serde.V1A: - """Creates the 'A' variant of the reflectapi_demo.tests.serde.V1 enum.""" - return reflectapi_demo.tests.serde.V1A(a=a) - - -class reflectapi_demo_tests_serde_TestFactory: - """Factory class for creating reflectapi_demo.tests.serde.Test variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Test variants - """ - - @staticmethod - def v1( - field_0: reflectapi_demo.tests.serde.V1, - ) -> reflectapi_demo.tests.serde.TestV1: - """Creates the 'v1' variant of the reflectapi_demo.tests.serde.Test enum.""" - return reflectapi_demo.tests.serde.TestV1(field_0=field_0) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_test_response( - value: reflectapi_demo.tests.serde.Test, -) -> ApiResponse[reflectapi_demo.tests.serde.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_v1_response( - value: reflectapi_demo.tests.serde.V1, -) -> ApiResponse[reflectapi_demo.tests.serde.V1]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.V1.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index 799e8856..115ec490 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant(BaseModel): @@ -264,66 +263,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestNewtypeVariantsAdjacentlyTaggedFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged variants - """ - - @staticmethod - def int_( - field_0: int, - ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: - """Creates the 'int' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged( - reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTaggedIntVariant( - field_0=field_0 - ) - ) - - @staticmethod - def string( - field_0: str, - ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: - """Creates the 'string' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged( - reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTaggedStringVariant( - field_0=field_0 - ) - ) - - @staticmethod - def bool_( - field_0: bool, - ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: - """Creates the 'bool' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged( - reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTaggedBoolVariant( - field_0=field_0 - ) - ) - - @staticmethod - def unit() -> reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged: - """Creates the 'unit' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged.model_validate( - {"t": "unit"} - ) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testnewtypevariantsadjacentlytagged_response( - value: reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index 8f0f0454..d6d24b76 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -30,7 +30,6 @@ from pydantic import ( from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant(BaseModel): @@ -268,64 +267,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_TestNewtypeVariantsExternallyTaggedFactory: - """Factory class for creating reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged variants with ergonomic syntax. - - reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged variants - """ - - @staticmethod - def int_( - field_0: int, - ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: - """Creates the 'int' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged( - reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTaggedIntVariant( - field_0=field_0 - ) - ) - - @staticmethod - def string( - field_0: str, - ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: - """Creates the 'string' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged( - reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTaggedStringVariant( - field_0=field_0 - ) - ) - - @staticmethod - def bool_( - field_0: bool, - ) -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: - """Creates the 'bool' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged( - reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTaggedBoolVariant( - field_0=field_0 - ) - ) - - @staticmethod - def unit() -> reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged: - """Creates the 'unit' variant of the reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged enum.""" - return reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged("unit") - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_testnewtypevariantsexternallytagged_response( - value: reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged, -) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap index 1bbae92c..952ee48f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict, Field, RootModel from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeStrukt2(BaseModel): @@ -188,54 +187,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - - -# Factory classes (generated after model rebuild to avoid forward references) -class reflectapi_demo_tests_serde_EnumFactory: - """Factory class for creating reflectapi_demo.tests.serde.Enum variants with ergonomic syntax. - - reflectapi_demo.tests.serde.Enum variants - """ - - @staticmethod - def a( - field_0: reflectapi_demo.tests.serde.Strukt1, - ) -> reflectapi_demo.tests.serde.EnumA: - """Creates the 'a' variant of the reflectapi_demo.tests.serde.Enum enum.""" - return reflectapi_demo.tests.serde.EnumA(field_0=field_0) - - @staticmethod - def b( - field_0: reflectapi_demo.tests.serde.Strukt2, - ) -> reflectapi_demo.tests.serde.EnumB: - """Creates the 'b' variant of the reflectapi_demo.tests.serde.Enum enum.""" - return reflectapi_demo.tests.serde.EnumB(field_0=field_0) - - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_enum_response( - value: reflectapi_demo.tests.serde.Enum, -) -> ApiResponse[reflectapi_demo.tests.serde.Enum]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Enum.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_strukt1_response( - value: reflectapi_demo.tests.serde.Strukt1, -) -> ApiResponse[reflectapi_demo.tests.serde.Strukt1]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Strukt1.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_strukt2_response( - value: reflectapi_demo.tests.serde.Strukt2, -) -> ApiResponse[reflectapi_demo.tests.serde.Strukt2]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Strukt2.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap index 9b13740c..a34a7a72 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeNested(BaseModel): @@ -145,19 +144,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_nested_response( - value: reflectapi_demo.tests.serde.Nested, -) -> ApiResponse[reflectapi_demo.tests.serde.Nested]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Nested.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap index 945cd476..a0db04e6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeCategory(BaseModel): @@ -145,19 +144,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_category_response( - value: reflectapi_demo.tests.serde.Category, -) -> ApiResponse[reflectapi_demo.tests.serde.Category]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Category.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap index 16ebb838..0071b7dc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructFrom(BaseModel): @@ -154,26 +153,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructfrom_response( - value: reflectapi_demo.tests.serde.TestStructFrom, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructFrom]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructFrom.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_teststructfromproxy_response( - value: reflectapi_demo.tests.serde.TestStructFromProxy, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructFromProxy]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructFromProxy.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap index 7dd85357..891132d5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructInto(BaseModel): @@ -154,26 +153,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructinto_response( - value: reflectapi_demo.tests.serde.TestStructInto, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructInto]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructInto.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_teststructintoproxy_response( - value: reflectapi_demo.tests.serde.TestStructIntoProxy, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructIntoProxy]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructIntoProxy.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap index 3750438a..5c8a4930 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeMyStruct(BaseModel): @@ -142,19 +141,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_mystruct_response( - value: reflectapi_demo.tests.serde.MyStruct, -) -> ApiResponse[reflectapi_demo.tests.serde.MyStruct]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyStruct.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap index 99a9d537..02ff4550 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructrenameall_response( - value: reflectapi_demo.tests.serde.TestStructRenameAll, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructRenameAll.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap index c80fe7ad..80891709 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently(BaseModel): @@ -171,26 +170,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_teststructrenamealldifferently_response( - value: reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_teststructrenamealldifferently_response( - value: reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap index ba4ce6d0..9a265517 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase(BaseModel): @@ -152,19 +151,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructrenameallpascalcase_response( - value: reflectapi_demo.tests.serde.TestStructRenameAllPascalCase, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructRenameAllPascalCase.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap index ff56290c..e6180e38 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeMyStructInput(BaseModel): @@ -150,26 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_mystructinput_response( - value: reflectapi_demo.tests.serde.MyStructInput, -) -> ApiResponse[reflectapi_demo.tests.serde.MyStructInput]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyStructInput.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_mystructoutput_response( - value: reflectapi_demo.tests.serde.MyStructOutput, -) -> ApiResponse[reflectapi_demo.tests.serde.MyStructOutput]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.MyStructOutput.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap index f31d9e09..be4a501d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestStructRenameField(BaseModel): @@ -167,26 +166,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_teststructrenamefield_response( - value: reflectapi_demo.tests.serde.input.TestStructRenameField, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructRenameField]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructRenameField.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_teststructrenamefield_response( - value: reflectapi_demo.tests.serde.output.TestStructRenameField, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameField]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructRenameField.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap index 3bcf032d..28ca6e4c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTest(BaseModel): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_test_response( - value: reflectapi_demo.tests.serde.Test, -) -> ApiResponse[reflectapi_demo.tests.serde.Test]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.Test.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap index d626a550..6e8d2a5c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructTryFormProxy(BaseModel): @@ -154,26 +153,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructtryformproxy_response( - value: reflectapi_demo.tests.serde.TestStructTryFormProxy, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructTryFormProxy]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructTryFormProxy.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_teststructtryfrom_response( - value: reflectapi_demo.tests.serde.TestStructTryFrom, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructTryFrom]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructTryFrom.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap index 696101c1..8aff4f19 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): @@ -156,26 +155,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructwithflatten_response( - value: reflectapi_demo.tests.serde.TestStructWithFlatten, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlatten]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlatten.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_teststructwithflattennested_response( - value: reflectapi_demo.tests.serde.TestStructWithFlattenNested, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenNested.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap index 802ae43f..104dae7e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): @@ -163,26 +162,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructwithflattennested_response( - value: reflectapi_demo.tests.serde.TestStructWithFlattenNested, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenNested.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_teststructwithflattenoptional_response( - value: reflectapi_demo.tests.serde.TestStructWithFlattenOptional, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenOptional.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap index a82cf669..98a5635c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): @@ -182,33 +181,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructrenameall_response( - value: reflectapi_demo.tests.serde.TestStructRenameAll, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAll]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructRenameAll.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_teststructwithflattennested_response( - value: reflectapi_demo.tests.serde.TestStructWithFlattenNested, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenNested]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenNested.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_teststructwithflattenoptionalandrequired_response( - value: reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap index 73c0a3ed..c3d0523b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars(BaseModel): @@ -150,19 +149,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructwithrenametoinvalidchars_response( - value: reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap index 86d04881..d9057077 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeStructName(BaseModel): @@ -146,19 +145,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_structname_response( - value: reflectapi_demo.tests.serde.StructName, -) -> ApiResponse[reflectapi_demo.tests.serde.StructName]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.StructName.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap index d43fd42b..2d286947 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault(BaseModel): @@ -169,26 +168,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_teststructwithserdedefault_response( - value: reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_teststructwithserdedefault_response( - value: reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap index 31680f7f..08d9fcb9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStructWithSerdeSkip(BaseModel): @@ -142,19 +141,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststructwithserdeskip_response( - value: reflectapi_demo.tests.serde.TestStructWithSerdeSkip, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithSerdeSkip]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStructWithSerdeSkip.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap index 3cb83f97..e501631f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize(BaseModel): @@ -171,26 +170,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_teststructwithserdeskipdeserialize_response( - value: reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_teststructwithserdeskipdeserialize_response( - value: reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap index e1801cc5..ec3e73c4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize(BaseModel): @@ -171,26 +170,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_teststructwithserdeskipserialize_response( - value: reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_teststructwithserdeskipserialize_response( - value: reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap index 8d9fa490..937a231b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap @@ -23,7 +23,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf(BaseModel): @@ -174,26 +173,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_input_teststructwithserdeskipserializeif_response( - value: reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf, -) -> ApiResponse[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf.""" - return create_api_response(value) - - -def create_reflectapi_demo_tests_serde_output_teststructwithserdeskipserializeif_response( - value: reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf, -) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap index 9bd2c4f9..69e7689b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap index f11567aa..0b680853 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class ReflectapiDemoTestsSerdeTestStruct(BaseModel): @@ -144,19 +143,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_reflectapi_demo_tests_serde_teststruct_response( - value: reflectapi_demo.tests.serde.TestStruct, -) -> ApiResponse[reflectapi_demo.tests.serde.TestStruct]: - """Create a mock ApiResponse for reflectapi_demo.tests.serde.TestStruct.""" - return create_api_response(value) - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap index 1f8b3d23..8d4ebcd2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap index 2967b69e..af52f55e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap @@ -22,7 +22,6 @@ from pydantic import BaseModel, ConfigDict from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -from reflectapi_runtime.testing import MockClient, create_api_response class AsyncInoutClient: @@ -124,12 +123,3 @@ try: except AttributeError: # Some types may not have model_rebuild method pass - -# Factory classes (generated after model rebuild to avoid forward references) - -# Testing utilities - - -def create_mock_client() -> MockClient: - """Create a mock client for testing.""" - return MockClient() diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/__init__.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 47fcdb8710897d250309ffcba078dec5e38f346a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2775 zcmbuBNmJuS6vtb}@(Q*wn9VF=#{<~F46|nvhLE(Az)TF;7e&ZDg9;vy>8j-xuFch&(UwcI(C||zo^jr#Jcd0 z)EN7TH5jn(wT4#Lcno5E00wv*;#>!vCm_L-kmM;y@ie4)1~NPgSw0AZd${ zxDXgGJm2Wgy!leN!nZ&)4ZGz~hiaxWBs2KXk40zi63%3noLg?QC48Bt!ije-T$z4q z1&*z{l>=v&q8>XuJ$Uw?osPNtJ3$dY6! zGJIh(pWfeomTZu0h%84|BwHdIAzLFWkgbsA$u`L#TRwi3SJE}aENz-h4wrR>Z-LL<>Z>gWseN!8h z30vLvXy3FwnGvsTp-xv2MMwol?NaT7Rxe9uowkQ>w!jH`_reiD6q^3duD2pH7uQE# zg-#}-0~`fTg-eCTz{zjKf+8SOe)k|pxuQ7AG+wUg;6}-!Sj!~f@xrqlWwM_&l_pAr z)ae=qQC6?BC9|gaO85a@LX0s68_$_({=)vj5lntjJHy*mJH?CV)|%o~&5wQw@S5Jh z&9?ec*zCUJYk_ayXf=D)rs=p2m}a%zk*UY{rnzj1C;lEj2me5@z``RP4rrS8cWgk5 zUuAMy?27g5Ez#Rqrp^7qYFDuY78u%9u19ZkOk2B(rDzb^-(*)srtSX0p4{xuv=6l3 z*}LAI=jk&(1=Z+K@H@rdBTs~; R;vbL;p+)?2(tj6^+P|ra`=bB= diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/auth.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/auth.cpython-314.pyc deleted file mode 100644 index a4e1ef00e8138850087186974883595a9dd80baf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 29921 zcmdsg32;uPp!aSNE3pwDD*=K4xKjctQ`|&Sq9CS8ld?ss-2|FqTVMnJ-4sR8 zWpgB#4aSNoCY2#*WkSetVsa*v$YVQJmMKTFHCrY%fFQY{j#8$}_GDbM6c~WRF>7jO z&b{w%{n2QEvaF=$k^TPrZ~6bd`|i8rfd@H$jpCtW+ZuH<533)Ch zOVULtDrKanrKo&B-tWjb8Y%5K;LJGr>dLrqbsliv7khmDNU@qpNV=sNL5^9W7F4%jlM!XEUc0 zsZ4Spo=Fa;l+*Fl;7~$ME2oB4C7L)jlo-hDJaj-gbUt$$#REf0R8IGF%DF&1l^V`) zt8{;-Bj?nr|?ki4P3L(`l}gI-m3Ijt>pRPvXfYj3r3} zvOM?Ck$X`(A!THsg5&9M#@PyV$he}86Yi+99i>rMriAa@d{>h3L_H|;YIj~tq&w=@ z?tFX~(C+-vAj(2~hsntVP6VS7fCW=BRBE6^2)Qeeiz%_>hNI=k!-N3zk!WS6G+F`> zR^@yI!Xv}aCQ_s8qlpnUktPr+@stwJhi!)HDCd%y(+a>7C&2XNoPbv@7#|o&q|-63 zkt^Aih^q-T=jYp4=KM&a|DHdY$|#>z`iE1AoImmWND}XfB~$nOXs_po)Wj)dpVpq^ zP7e%^B<=-I4GqVQwt?7ynuuo-gRyvK04vT2v@S3Sp}9{YaZx%d9Wsi{#Hj{Js+W#y zYeO#IA950FW% zK)ala@@~pGS2{6tDouTD&mHbPJ$xq7ds0otQ@w+U=Xx<@!qNCh(vs{RVRY?Q&jPbi zJ*^H{N@IF9%}>wB`CKR#8yQY#0M2A47Ryx|6WWtkP=_9*n-E=;ZUrLQK;2ZJ?(IO! z`;9Hv&wus&D;LK0{4iL5+bIQG=TJ#v=;{#GpexVSbNi#x(~bweAW4IOc)j#%@@Y9L zM;*O@&rRpgscx=BO=QlhshsQN@bJ)02`i}tOY%%S!+>a3Yp7B%7SmQ?0{yPC_S?*- z9;eIswRa_td;M*S#`o|=rS9aR0j)zugK=)L2pVv=X*!pW3Wr>Hpe?LrwjeS`;qzp(F_;+I>1P@T`(NrGS1ZVreDQidY$gJ&$xc)d(J}R#8Og1gu(#OU{!R zijSldgJ}YDyCMMTPo`s9(_DoKMl)AI<@AGyE=sc{Qn2*$j!Qe<4m7`4zVfGKRaZNI zv-7vQCR|x%-ITKK-LiFKo?DTs>pQOPxDkD~u6HW3ZqmEX1oeI61jf>cSF6+sm1a_H zM${>*Ex1_lL2ae7Hbh-ipwGF>z2UZmX#5~w%#NTE2MswxbH{PJ=+Zal95_KOY@slw zthLnQd28R7$ncbbQw$HC%_PK>3GS0m1bF^v>eOmPf&ggKr4zt-#yVYQ?iy-9RNg*a z)iaUuY@~52(m2ujjow##-;J!F^sYBSa^G`v(>gbV&P&eCdg_}#HxBm$wJhX2Dut@z1WI)q=dO3m{=vfS9&K`G*2{5?8&xno@(7Z z*|KFavUSqCl}8P9=4HAf=Z(cu@iRox{IS@X;lZ;*lm@N)%-Q&mRuYNDP9@cJW+<6T zq=r%KiNywo2arICMKX!S#84QQR?v9LC}OOtMJneVQNbkD%z3qg3J71-4OCDWi-8|O zFao2@sL7K+)ij<)E06ojn5g>bmZC6z>E{rAN&2yC+pV(7X;8 zO3jvW9@epzht%Dmjz6MH)R6)Fj6m3fAkTdou|=xdl5vtu1zE@enZ}tX=aeAVg2{+V)qn@23BN(s^LYZMDuB6YW22QKPso}F}MH@m-KO^K#!Q0e_@uW1p zqrF`tlyQ1mjGiXM18qin%zR>MX%C`{((Mw-7ZM$%&gr!9zJRRmK+B>ua2G02r3C=H zafSi*mjZkX0Y(FRkpM<(tyyYBj|pg-ok} z-tDCyqxMAjf38FD7iogn3r@G3hpY4s#?_@oK*8=GMgw&xMa_s7WB0pIwi`bSOIb}A zw|b(1FAL#_PC$kN95*2$;0WfS&o=V(a8%x;o^N5H_6I5@7%PtRJ8XkXUI^6z_w_Ss8 z)yfYDU-cmMX(^aOPho}WMgr!>8z=Zu7^Y4KVEQPUEf1#q0MAcjE}oY!IuE-2(q@+l zWsh{wr{Q&*fHY%b5l{m?4$!a`pmT&uge2Ctqik}2Tl0NV6Rx2t>~Pp=)AFd zx?)2%yy0E%hNiw>HDj)@Ra zi;ma2`EHRJAuMl2YZjb}VmO$VJo@m?Awpw~A7NLaoJ=TZu~`5GQR2#grnq1prcDbF zRvC$_kXJGZwMXs8%NEW7BpPZ9>4Y~IIuX`$d3+?C0M#Sqmp^~$^W*2HBdaI9t9e+A zs{NfomDa1enW8NeZKa6BLX}`HRvP2L6Lfo+qGJ?oqlnO5JdJja>O*=&Pf8Ox{-X4r z>*KfF%9p3HCXUR&fCZ;l-V+wFBOiMHmJOo&gflz3H_h-~Hq_Kl$3h$*!Ga zp39L-k@3isw__$!H5UFzX5>@o$ebw;3ko5`yAC1VbrhbF7imUl54JoOstJGc=-R^Y z7fjPW3x$a^v(KDHNel{O5tM~6$U`#(lYDCZi#fvX7s@JRHHJk0P2b`qo1SAK*@bBI zC#ecWq!vpP*(Msj`Hl-j<4!5C`mR5p`cmBi{ER?Ijv&wNLTsVF361*tY3oOuJ+>dX zY0F2H7Ygo@s0V3m^N{vLeW1YDKy?Okei#EDOPpuoyMqh^xUp|mboR*<3EJ7`lTh|6 zBSY~4mJOBR5i&KTd;0UlW7-9wzp}xv3u#DcD;IS|-MysLDABfa(EY}qO`K=ioC|2W z3DOhf{LGnIo1m8B`Nf1jsC|v0&6vZ_o|v%52d_P zW#erhQUbLJ74%?G@-@iGr{u>JvU`beY+Z_Ka?rMe|JhFA3Fa6q%nO4BKx!rU8dwC$ z*PCh7o*04!P<_gNp#mbPv2;U9RlQBeVB%E#>`^QM%99ez54_bJ1tv`&EgIMvT!+^R}Z8d0Z<)wQ-<-dVLH z2<^+KP%&4IKA}s5l9)HaiFnRvm4Xx1N-G;*3eMDF>#%aBw)HEKUpWcP;Kk?hGni6< zm=YplO1KbH!et=|B%Hw-2+dUhCl*uotwtpZgJ8GyU_gbK(}?4^W>*D^avY+yWefVw zZp4YbpVwB1+hgkrDdU;tIS!Fx&=!tDp|n-QuX;EEy$B7$wu4UdExE^Q=0Qa}6d3GU_Ov$jFrQ!76q>M#M=?P$r?Aj%^Q9 z#s!L~zJ_gzFcJtJTxr2Jll}5+e;Q4|egl!qJ1*}S+i|O`=4#iKuCd+kSJsTTTwil- z&2(kk*dsITYrZk`>d@FDS9e_5F%@i?scpF4eXaY(bK~99wOhvaz4RC;Non<1c-ASc z-~8R+H-lsQENChzzj}u9n<*l}Ur>=@N>N1UVDQ-kcU_?6cbc(K z@7Ct?S*kmLpAj^wy0FAjGA9UDorEL=U`=4SPBNla1;z|J}gz% zUVY*>pP1M`U9ok{^%b9hAQ4+#bhxj1Us~xhhDTqezSbflvB%|ZB->#lF)&<+f#Fh^ zC}4b{xqfa4Vvegl9J0>6R%ogk^I4b9rXcRgqjiF8m=j~}@_PX1FXLG%={|C`|Y{lxSiq$tf(-rH+eD6ofUq0~V&rf<+ zeIzsS&u9Q2J`vXTOogC{9jwrq>pR$@6uGt#5CuWzt{VgyI!c@+46hriVo>3= zcU+(xcglcmWbCr)nyA45en!yHN}l^1vMjruuW3}cV!68=?0jI zigcnJCUWZvN!yNzbWs?y%o}Es7K`kd98q@^d%CE%*Nvs*6NKN#I-wYZBtiLo!o4e& z9L$BZWI6#4os2M=(he$DA`0%UWt=nF@=K+)vjIv4r4L{p1~0fM)wpwgTrx}4-SRo+B~l)k6!aQX?-~ybsr}+ABRIk z_-#RFd4}|lUerrR+>cijZ)gE zZoC&0VBy@_@({R2PGb7%u}MLBeB8k1K1FNKIZ7fmI5JG`b03c$WL7R73p6(>YA-sl z$679M-(E-Lay|C1Lpkd+;zJ7G8{22`a!vVUd9I}aOLyA4$>B1uNm}VRmmC@rE^-O- zbb`O7vB~cA_jg8AVpZxmMb{`I49b;g?tdPZsguJw*TLa|XLA9O9UGz>_&d=iJf0dz zsK3sQb~BxVmjxSyM4w>9H`g<~scWEeNSj;KVA@!?xL7J8wZQS#= z?ybewzYv9Z?f(XvgB>?ZwJk4&XKI=eHLQ8ZTRT%(`;s37ptF0-^-|#dy5{TKzqPZT4U>hGYzzr)WkAq3nNq)Di_5$228Csg7l`89B7@ACB?c)1V}K%}V4b6Kl)ZFWPhK+Gct}lP zi!Pjy@~~YI?y!D%exx$&^O`FYm_`n(`trBoIv|;k{F?Owdww|ArfD>~hhJ3;p1JgD zZ5e3mGPj{93Knd`Q?LuqX8ABwGg;d+6RaMuxW4Mzs+nNj_>pWw?^HwYtjAUAA9I2K zz+JHKa^G0rOucgb(QA*6?RmNS(&Mo7jRnjZ(tq=rY|1T9kTU83Blmq-0uHF$yp8~rFe zvmjG}dk>PcW}F-YlY@det;LRjeavAqWR{c|fa7``>fH`v6`FfeXV1Oh?qT?Gr83<| z;J$vZiFQ}oHwL}Wcb_|VuA97>yCHfeQUk+K8pDO@U!qGwB}a0K@Y^E|p>X6iocC_J zg<~R3ldY)Jul_FOc2M+36n!00&PCqc%qw%HYCM@v#PD+V?mL^#xjvm9PVoZDIiE>n z;3US3j5?F^!kc~srV3aRm{`S_tPm+|hXP%=SXIW*id-R+gBoceK;+gJr7MM+@bdg? zJX`1xw_V;gwrxCf{lc{i*~ZQIKiRl>ro8&WM2Sek(TSf4{16rlw`0|J|C6Gu2I3KX>JG6GN}Sf%u<0>v zBa&_l#n|aH5Dpe=cNTpD&B8zZ`=foh&+iq}O^@w`xYftObkn=Ayr5QJDzujY-Gms? zD@R>A-L(5MF&!;JCz*~KdmpneMjxHW4O$7yg4;$%E6o;qigvdaI$EfPl};8aH|Qkj zY@u?$K}Q1?I;u17MX+IcGv<-@$_LlL>+8q(P2d+);KR>z3u+@g#5|H;(sAn<;8eYo z#P@Lx@Pnj(w2#{6Y><*N`;7(f_1zEcX35?l-u>#g0ao=p6#WTBMd`8nT~z4|sIO8@ z8~ObM%6pw6-WdETrT&Z};?e4#Q}h>zgrUVCsZ|R|D)(;*SwoLu=hsO_rFpth^RP@b*~ zkL|}JLY3KI+f=aao#5(QHBHwWt~I>UIQHoKwJkFZt8awgZP+?f*LMA5*FJV*?d#s@ zx}C<|blujORUOw;*HSlP)2kkusZy?{uB0Z8O;>e;~wM#yy7oztjH&;C`WIZKA; zg#0%<<-LCIn`?G?ar1)>ROtsh2A736fdWN(M>tqOT>b@;7H zKcy81#mzp{%rpEGJB9eQJe$SRx@(ejy_j&r|HMVcS42X0&Bj;U3D#gG%_IWi7n=JN z5^Q|MQ|!SYP$Vc)3tQ03Vceu~*+NuqM-J_UV3yh_wAq@f!lvAOBOV^IMXS&v9yB?nE zdU(2P*GKMCL~|N0G^gZKgvlhIqDANQMViyk;t2-3FEXzM8QJ~Mv*8;CQrB;mbmqPwPo&?j*Xz3maE^&^ha1!{XA{p(49c!GVbjV`(?<9vV(36pMN< zO`D~22?aVc`T*+;eB+(!H_!>OLvasK1N*mD>ffS5uBq6Zayte`8|w1TAscAG|H(iD zHUZgS!&I;#8*G82!4HFN^l@qdo7J+XO3hM_n-LY$Gt}hIP7h5>&-fr;7S0YWE?%N! zwK0|`()M7?5JtL~d|YgX>`U96F)UIqFH*;7hnP8Di_4oo5^-`R_{6=?1pbT)n~P1L zXviR2kIK9h>EmL34$G>tWvx?Xt=Y1!sj{x=vhHlK`|V&i&*Xc-Zfy~+dr1CQ@;2AE zd=JSm?y%HlAeWHIUd6+0$}*P8ZaVt=JHt!(De_jDc@C4Iz4R=iH;kYv4YHt<`EOGJ zMPI`&y%7;PFg|?O1!K&eM`S22@6d2;#JWI`bPg9E|`a3ygPgX@v2v#Pao;$MW@>mkfPm#m{1@Y4}#cvl71&{5<%<>ptp_26{c{YEaN< z-UyH;O=WcqSp@Ai2-@|j^g`DAtFKV12*t>0Ho&~`=^)6n0X731Y0_Mi`m&pBfQW9v z`_hdo^dT#oXFZhiN)@YSeUyUKzG^l=sUVexCb+^T5*|DB%h?EzItdL5l8d!q;T#-i;C+x-@K zZ@ulMxLwwJ3$)97uc3K3>WMnp-bk3rfft@D{ywH{p}jF~U55(kC5zb`t%r8N0ahGp zp@>|eEoG};-k}_QN>u1iHCvz6>X%BKiw|)Vp=^Y56wbSRXo%H>sdSL-0$;`sl1!2J zbc=P6JbX3#Ng+GueLtj_F?9J4)4$M9ri_u%Q6}cs|L_e~@T%d|VEX<{rmU3K#pblX z(wzelOBQ}p{38SEQwth}#ds>>s> zy@F{in^%c?3G-?p1M6bMRTx;Au##5hqBOros#a!d+Gc83L*qN|acK(Opxy48Z)v@Y zBQa{eUOth0{qf1RN3%_jz1{TK`(^brrHMJGqdbfc^+MtK;6F}l?9y81{|?an8t8?g zWv(aN8KQ|#@MWP)OWG~wAKM)S)xs8*qINMs!`*le2k3h>K7*5DpnF}+h+F8HY}h4^ zW(!d_`eo&MT6wRFHN*w%WrZwbcm^?hTY!cb`dDa)y*j64jWFS`E$9jp)(9Is%dDiA z!?I@bE@#wd(+F3aE%X%0E;=`XMz>InpbphV$`>(}7lQHO#1X~%KHvQi|TmEpG2s4 zgJKs!6POD|#j#3)jF}H)3idiRVKTK$Wp8;bkA<=SNv>CHnHHg23mfqA{GWI=cEF_7 zy>uZP>A?TVNXPqSt0o(_O_yz-3~q;%7^)fXWh4Fdr>;GfZP+r^u%)2!-sfiHeV7%$ zAGKla_15oo{b^UW@9gt2UuYre0;eX% z{(nRQp@8sNO?4kKN%Sv+BnG0v1fB|q|vHO?d(zK zi7G8k1p5nGx(ZT3^$tDKBz`Qk-8b>8un|A*c5dB$P(NLM6U`y;`YgH<4f)7`g_d2h>3KE+bo z*_wy(@g6I+sBqHhwpfjMmqUzPtS=JUEC;`_-Ai|^SwuLnn}NxU#`Cie&$5UIZP`fM zWTee>si6<|wq4qm4YcC_WT2H@YPzP%yQa&#CxhKT4cAWA9i9#!ne-kpCsdQlr4JdQ zu38bw=l%o`iehqWp{x0RjEMuu@yv3+j+Vt(?g#g4DTY2Diq8tc&=w9A*tZxc+ohqb zfs|%r9cAr0|K)jO9H$L82dnN3jOQ|bPvX~xU)3+^q2W}&k5}}o{|7O=r(eazz7FnD z9`hOdI`{!fba#klt^;Nij8|i5T*w_lIG4eJ4F4zLL$=Tj0w1QbUzZ_Vvm*q_(9;bM zWUC*z8!%iZ@YPy*<7DHp>9Qv$gHO&yP;lEXt$a|g0{;Z|M|cUHd7)-^Df|(3b-^D2 zsp}oPHoD*NgphorLf+L~@QfI%c!*NG)tZFJH<5LH+k=sQw3v{t8jPEqO0;a+=3L zVe~RR26#Y!P0t}-`l|-t4FcbPGTvqf-;4hkZ2jsK_3v$p7J~KwvUM~4QlJ%PdLHsS z^t5*o61ukeiATF-+5YwrQyzYj%YJ^r-F6>cdB%E z3D~yjtYDDnIdN7nQm}!Gymlk6{f@VQTLryz06!xT5+K-5j56FR0?T!)z_-)n;t5m@ey-WoCkbjt@cr~ey{(Tg}f6r@q}WeDpzd|KhK-t-_TUUo)6A> zS6bojy-m@rmHTGhxPnpD9*}Q)kQ5X_n--oMO5+!rJHoAx%KCbI23!t%c*9*l)1cx- zB3SqA_|)0RKc-kt(V%0#oTGnlv5oUFUIRRd_Bk`>#d`2mK79L>!{&!U#!Q0sJmR-o==c*Qe~Hx9O)M>;3s4Paoa2GouV8;^~Zn&(`T|s{C;% z_&(S6cI6D9LPvz^h>8+&mHC zI}`6wje|xs+;c=c^BnLb-D-qh$)nx7`HvYX@nxL=jBaw5V|b`VtDFm-m297%bL*%9K&g?@V(nmMO_Xr+1T zp*W>d!Nd4KvL%80-w3#C`Q5O+$eXa3LoB(&`u$FXL(++bYpe9gz10=QP%=|VFGt{s<;$+|6;LEEl_w)lB(fGc$w zbmEKDa~g=1C*}Nnpc9KoY8SfAUDr{$;^il&109nti#kUKDuIQ8D$uDYPz#+VB%D4N zxaN+EO{e60DPaBElv)bb|BGOaZ)X|SF8MHQ9~93-$_R^*Xl&LJ8@FhQ9S20>mRlhV zKdc!@2=aQ+aHbH7A8Xm9)#Q2Drq4r4KSoCQ2NpSo#)|YbMr<``FKO9Y5+L#qFU{2q z6T{k|ouHC;%0&-Az+f;J#OjIjub-F>L?>O*g=FX-#=l#kA@bgJsVV)xG^PEhPRl1C zm*BJ#xn!oSa@L9Kt@4IhH?E|etDW^w3U-FtSs$f@3pb^3j8olgh*Dvxr0I49DFFzY zSv_d<*scAUH7g-I)^cp`Cavxw^Gx$$xZxLa|FzCD4IFlx04~C_$~NQVn`uAw#+dWG zH^s=&SX~boF`NXMm@kupt7p6w6Q6kfAqf4!68dWgV#MkT^lG`k(=9X=_54Qw=#M3x zI*Y# zIz>JzbL|9J#2*Y`?m0{)U!aJWGa~@YBg8nxdA&q;R6=4N6|Z=nD{*3icf0tbP9IaZ zq6+>?=|4d<>y%~rJ!$*Tq~@PU;lGgrKayJhR%-f@r2Iq*0y!LkyN*`*fmsO=)EbV! zEZxrc%hhtn%WYTJTv;qZoMuH>Tta1ng_zFH zv5;^~=(g#$TB_TQiMohVJZA59=#Flu?(BByu3A>g>R8BL&O(khn>mZ_KI^VyZPwg+ z9v|(|J!c)wR@-16V^uV(^H_ejSNC=o=mq$S5ON(W?DpwCUUwh!cNghJ-5c}`{5kJf zad(Mc(p{>TT3_|xtNCYLXG>c*S`(va6V19_#v${fPeBH>xm>p5zO9q~(s>!=b})MzA<1(h)iW5Qw+S|`|9rVGHm z?VLv!LxOG(*#N0n&SHMu5wh#fkOPo94S$$}+LH(=S`vUN<1d^9DABkQlM(|j0Zd6% zlB%Nd#$ibxQ6zZ)PZ32*3`ufa>hA07MIUpt6pc#*tJWTj2!M!wln6|qRamS-WrFpy zbGE%dU~CX=RqO>}LKBIN{t($rmOEVV8{s^j>@`5Gu9h@+eZ?k z%Ju;@D#y1EDi^k^CU)gyG^e^P$q~IxO<`^5uBnlnx8Za%2R)d)WO&12Yaf(w*r;BO zq+ssr0>Gga^VKXf!O^fl*$uN;L^I>-rwS#48f(p4Bt9Ybz)FSjqV`qWa6t9q{kwu; z*Ob^0Uu%OBwQn!H3$m_T$M|F81rWo!{IToWDHrw5ij2=-izS?hO@TlZ!3rIytY8A2drY z5R@?`k^;{Sui+i(VpJcIB8hk;rK(`MOH|j@L~JEf*|8+7Pgs=r+SX^PkQlOWC;8-1 zAv2j#I4X~YGgIq^7{$!ASBAYO0r^7P84y%XOPtp@{i(E(Mg>Q-xr7zWP=~i#4YCQg z%tXiY!UE5yw0T~>f7pEHTOYAR7J75=O}^;ogHQS6yqU5fq(qz`;OPu4mZx4z)uf-P ztYiH`o7ESiGJT29-W7VVc2XRMGpx(ndChRi+NF3TnlSQCDx-38B%vx`3oTuL*QS=B zJ0GJFv`twijK-rnIHP1GCd^ij1zTCw$Y&yg0JeZ;1oAiD%e+WJO@xP1@yJ&j)7*3V^x0M^!&RsI&YtDFs|N6a$8D~< z1szC!-dFQq$)9y^oN;fw@ytDU-_lZFQ6{P&QrD#>*^l=*5#8`BlaW7Vn@UvwBvGRh?XS zZ_-xPF!rbljMsqOC@LgD_FZj37$|%0UZyJR#nofyQVXq>Cep3aXM}w?%bj zRElbn0^zHuWaQ*%9;ro3MIwr(1w63j%y(QvNi9QiG?r48Kv3!%!EgYRxTr}Z_&OBn zu#}WlJu1f}tDELo&sg%Tu$BnHFfG2BV7C(n)IAt#l38Ich4np_yo{DyaW*W|`h)GU zL`05h2UZCBHcYRXHrz6+%qv@%&TED?ZHw zgRpg~Sf7vr6fjEhm-Yva;&~+;4eSi9jHh!SpCK*EQ!lads#M3evoz(0Y-h+;;wdCP zZShmmc7}{Mo=$B@!}VlvfGhqSzbp8iAP$k(8Gm{%CmTFRYf6e)y!44#Y^1-G!2lEh zFo5+}1G7o-p!f(F0Jq7dF6M!B0X8yt4cYrdFWY776GM)tEy?lC=QF<^6{2jPSk0n> z#I`cN3oE{yhI<&_sbWz`ifTYZf232)k(R{RmXR2e2HuP*Tx^);R!042jIEyGGztTD zBcE*Flm^pjP%&I1iae;On&E_Bfr$*SDqn+BBqJRc4nIobPs z&&eZ3-jT70k|b3LbLRjJf)B+_V)v+JD;t8s^`b^})+9;Ngy~$ASz0wrc4yWOGIl*q zEUZ6<3y4`v|C=w^1eAkJLaR29) zKbS4=xKrLSSKGLp&nlX)U-^qGOMWKpoZH-dUuyhW!A}a_8Muqb+WPyAdzSJXQrWfc zB`>RLp1N>%)86H3KISj4{8x2g(SiDJmTFi<-4b&amEFfj>VEp|+4A6>^59&p^oD!6 zf%ks>%2E@n+B~=M;D^Eo+H^(d$2*rqTUFT-vz3-DH(P!FcfJObe6?K5pRZqe?aKdY zw6?32ho2SR5Dsl|zbT?NB^<7H{KRu;m;F8AP^CE-xed9%(z^`@O@ z|EQeWKiVuD+Tr}D(Mk1If!c!t)pziGSN`FRu8;PYA1-y>DiKh>Rcgm4ZdKCQTTMb| zz20<1@Y8v>8-&A6g||0* zsJ`7s`OZA_G>S}Z8CKGiq;(+}!7VE_$SKOy4FS7pUiF~OBsG_%U^S9uL!d0vYj}YM zZCFc1+>|+wmnM}IGJnadmtVa+d3mn5bn@7;9ZF=LG|SRnRw=zz_&0@fPw)HZ%l~-! zZb9eIFTbNt7jB;FyH~j7=a**+I_E{P((|CEVZnhC-bb-#(lzg4{_@GfhriBag@=U& z5seSI+Pd1_(JcInze950^m$OdSt)ch+HY?3qP{`}lgxq^d6Iy|8q+SvY8p`nE8Az#J@ zE{LqS>7n84eW*2JhVPejc!j?bIvn=vZq(kY=y2J8;Y4=RX23A#3}i$$AhwUj>rxCDvM%`t51ct(F~c1>uWd+v}jo7N;6^BlrTg=&_jL;A5G= zqAUe&1e})))oKd72w7J^wLK8ND~VR!3uvM9Gn8xOWu`IQ={ZbtPAh(kpf^|q&GkOF zR5YVz9g5C*{~dfxgFVSf`awli4naR?4Nm6GH8f7TKQF7E?7Hu(ywUX2t+T%19ba(H zUpecSX8h7r**$;D1AoPJ-)p`p=RJS(LLMuxnfEe(<+QJU+Fid;PIRx4`3jnECYo=w zU+?h!UL>^If@#0j(@xMD;ec^*Y;#By_mFNB^I|Q{l8C^sU=f6Y5oa<&7y{Wceeoib z(v-v_z%8ab%0n6P)aU>VKg8EfUv@==17S`Pa?jMo1X^xz7;##>Ls+Ufckir5z8H!H zPq1J5He74FzVEetcYU?f?%M29(jfmHn12uO=v5q`F}0F1I(kwm=%((X>>0{9hf_>cJwusH z89}0w@6G9#f5o)28mWykiok00SqizsjG{>FmmY-fzH}p0^yME3WK?{)0TTGj8c_7I z8(Waw06s+oqce#p8%bC^gghsBK4t~aJx>}u*WIB!(0hKGKoQMW#`F_%Tpm``@k5>F zvovZp@aXu!s`DglnXJQ)(v@M7gqjs2w~o+OC_eJ@0lKibnS=f4xOm7Ba&AX-Dc~|= z<4*HLPPJnkkN%qCg0}5ziQJG(8deiIx{M%-9` zta2FTpkZC4YiS#c9d!$oP1o<@Wfm-S;E7Oum9)c;P{zd`%Ku&1c>qm#;p-?e9sXul$sTXJoW+B!cc{Ip1b&}CtuLk`YvPLtj2vO27pM9^&~ z#oo-YY-QbZkxY!d76vKglQ_PmQ&k}LB-xBuabb8d3Z<5NCK5vrb>-#|@$k(tgSP9- zLi6A~>&Kb`(2JpuIte`fq=+6MF`kwW>*N0wd`BxoM)tUCK5T!xr*D7{$-9B`7v7Mb14wIKS3rf`8dF=58# z%+N~b?}%zLCOL}959RTe2gT*H#XTprmqOu3b3Mc# zFU8V<#)1{(U_A9(EsgUlMUcJ%!8nOje$5F6K14y$thai`TRrP-n(;PG>7RI8=ZecG zk8>IVgrt~^f)zT8?+RZ=`p}T5iXR#dSzZ!uOr#}9+B;gK zrKdAJ(4(+OZp@>u(cmPFM6HcmH}9;v$hL3Bw zlfLdL=KAhduKJ{NO-uFJ#@mmKMfFE$K14Hh#FnJAm6KM01ImbeA(~L(g^MQP5a8+r zvUE)J2h{Kix%@s7v$&`F)7Y&|FA zC3->G7=ApKN>0Xejgy|()POy=4h;(w;Wy2@gqP2p@LaWK|bimNWpto8>uKD-$J zC>2?rg?NPrlf2Bpa<8N&}FERYKp$#2XJGMp09@mX-X zF#bOoJAsSZj6Fv;5VN;_a$>4D5`R&H8}_URQG1DBjLCJaf_$2mm6wM0@7xhUR}=5% zKpJd@E%r;NO{51S+++zS6}_bwKe}bMf2bbS@a5^Y^FYnY;rK4cRNr%V2Z zskXbmz0>Z!9M|0HxA?^MXg+xr!`J1GKcyFxy@_Au*4zGNJ2rDMv!lF6pprZLbPsPR zh06)Jho=(!)(Hy)G!7J1;uO;iBWuUJRdG` z!yA5nXt;q$e#cXls1tcthJ)0Arq)wK17(eraeVTX5M7&iDMZb1x0^Qx52)AiNDh~# zAe$EjLHLyI{}rqMoE3h?f-@|*?6wOC@>1q!rHyw>nx7Ur-@Diauy|wfA|3<*5C9({L5d{!0ACQif&fJ#y7%w!YYr2*{H~sp3T@<7#)A{=K zKljeeJ^&IRO*--SX+Gl4**kac+{d}+oO|v$hwEKVn}DnLZ@(F>dr1&}NI%re$N_Pw zQxt^rLQsec9~FY)L9s^{*Hsd%JE)KA+1(H~u)8sC#9e>T)MJjDSsBAYOOG{f?Xkse zJ@&X=dCw7dpq%lbv&R*8u{;xCciaP544Mz-^?2i623rpLdh+A>Jq7WCp2Bz`%D7p+ z^`O6}C|=Z4953!EiI?=0#!Feg?O<6?dAyv#_Jb8YmGR1+Ks-<>6bMy9(BT(?&Q2Zg zS-k3aRh7`G^fz98+=ddazJ4)n4!)H{|Qk{O}5(I{I&q0#V}NGK%RLZLHb!xJL}J3^t4PlQL5 zC+<+_WK@d9N1~&V(J?$O2!&!aD?_1hJT65~OvEFxP)MSWFHt+>Ct6RBor$!bK+i^7 zha;b8mG~@&$DETRIL5g(CJkjg4XN22X5zC1n6&v@Aa(eAi%+ z=qJmU#eNK_@x<7~=Q0Wc6%TnYdAPgg~O!$a+S`3OoT~Hs? zwGz4-{+`fY){mWdMxr-mlN5MLZ%dvh-q2irp{O@ZYTQtgR@@E)!C;%eb@+^`94xseM4Jk15Mh5c)Joc?&mn zIoB&$!+F%Z0ijPJVCj-5tNf_BQ~lJ6oa;X8x2n|)fM_nO!>6>-u9iyQX-2jvy+=Ep z>XV@1m|KMh1R~0GIY36+_3E$FVxwtt`=Q4l>kViNObVQw7#*TD#wZU~QH1a=0CE7@ zGaLpM4h1mhAV;wl*@o2+83_$foEh(*5oJf@?9j->a3nN3HX509KgNm$#!d#}AVY!4 z;y^SO0IdpSeKLGvB+_V+ZP8eC6f0(QC?Z?b&&t+lY>Xq4Y@kfpd^#MX1trl0%2uLp zoD3Q08;zn=jeLf5>p0SRLeIoNFwz~AHlhSWya@p3h4;;QQ#HSRHtBDe^*1EVjdSM4 z1-JL*PrmfY&weUlskmnKO?7{<==Ji~%9GamIct6PL(i0NY9wi`nX}f=gXdp*e!BC* z^YiYugr)78%{Mjn<>Bd$H=~!HPP83N&ttwzb3yO(U$2WwHP?k=UMjr!m^l&ZgbDb_wiumL3- zb4v!Bkh`98sBG(IG6eDY$reSZfHc8YH1Xxr(%9(OL@ZOT z;0y#y+DywG?EJ?ZH+SyBl8c0gBT}pv%RSA|4Pi(LvWdT!#YbFtlkpLn?Yr<1j?ZS` zvNdQ6+JlauGw5nHqX%xO3a`qR6X-x_LK>0vF|2s1?zZD3q?mZ%*8;sDG16wrDj;Ft zX_ROVAUUo++k$74r6bW;{ON3|LMySA-mc7$cJS)yczpb93+1WxJVN#Ocs?Ij^+^q$ z$OhIBV(TD2wYX()JjUZ>e|k1rGC3eMKGuhXm|wNAZjqAf-hz}7_moBOR-~*1*#vKW z%1)3&C}>ML333VUmXwryWm0j5OkQy2pB zwJWHxi2-3$dwxt~jQxh~qRKW;p|&!iQfSG12YLJ&>>D+x@PH}ep|XP?8`WwG>hJ}P zc?QKAFuiee2E#HQ!#n(1#tcz&nb2<>HyceWNd5h0^ybV)5#Tq_c&7 zUB7;LuUdrxGuW!q2edWaazk#*XN8X`HEm6gpQzL+2*ZCi*cS2%=JKilPTAfs4ZPm&}bLOYI8|89+X`6ZCb?Vg$1|of<65`wc|9ktm6&J_wFRTLyXXYHJe%uXpvbV zw2<3EBtLOU-b_C~5gw6EEdK-_q+O_Z)j>LrLNVS18l(amoq|ig6y2s{?DkeSyItAK zp7EX-@S1ulQ)pdUha4KYm1vbJNK``8P$Nh|6s1kg(8yRUGGk!lD?N!!=~pOW!$;p( zhf72J$k`PTpJ%dekW7a0wm4q4y=40>$MP{>GqTNOBHJ!%(Q3%{F%;5}O>eAP6p&2C z*)81=6k?as5a-ef{A5F>JjlGMqQEu1ni za^8hc%f|TFvyoBR^ei+Pr($f4+ymV>NnIdjKy<@u+>1RfrHs)N0K(|;rOXVp2)@FU zm4PQONCDQ_0C5cvA4Ts&dL}o2-cMse@)6@PGdj*{ zoOHVC^+4Y$xxeGX$u@ppK;~Bj z9>Lo51Gjf->#V!`jn>O`^VM4u?(Vnt<7dLsy&MS~c#Tm;K3I2FYp9eF8!RT0wwizp z_FQBzLq8LGHgZn3bFrAIhGZLKunfL!1HV^AL^c8jwBQ~PMndt}e%9Grg41YQq=cah z?!XpEh-QK;LSb>rN{~$`s7%=jau5PJ333tsxB>AI(IgnuOTq+0pLX^U4Sh^m=wqr9 z25SZks_qg9WYiF-c|`;w{UkCXW(c#FsWoUC24FD55gBwR1>bn%9Bu)t%J}ML= zlqc$~p^$?ii8>jXGIr*JkK?ta79>ENe8E}=#946UFY0w3+k2&TmrlKPXukA7iheE} z{s_xX2|BAXW<*9*QbL+z~ zOJd!uIkyCx@h}Jrr3_OD0IC2P%nam&g@HE8wKLE`IN~IbBMCJ?y-1)~iN+YSkiDP&0JDPj0Q&toPendsr> zG=wS)(U;_sW%NaR_Um|8r7m8qA0Z z$xB2A2}2#+fjRm9l$jt4K~{onLQ!eTPLM7s_ax+?b1pcP#o__`niv zO+dQ}1?y&&c9}f3ALKPJc#1EbS<>sgu9Oium>ze*qMabYq!2LK#J7F2m8n4KL`1eR zkg08Dr=r-QGmXedmJY{*&oXky1(&;$J5?*0t;ex|^eK8A)0qekt%fBgOc}<*kR5&( z^=B$>a9E|OWoW}GU8H0eC9fg5?IA7JQEH~bS!I``ocr+B-!{|!<>~(8jM3h9?M@#I zQRZs$_LuRI7;O`1IoOQlL`uuALoPGoj^*I?5+NxJa)fQIU}C>-p}+89EbwHWHE|AD@WC;&M?2&SgD$6R$53YdtS4778W2jjYlK zh7A_d>$L(KW?Y=mu?`U`Wc2Dw^fTSHUG$Un@AnC!PV#9j&79V>+K;ej^*R3csAefW z$4xZHP0AcMX>;79&2f`9$4%NCH)(U+L~~qDbKFF8Tt{=AYAfz9scR2*HmV=;Z2Twc*HdBaZwXp{_0c?q| z3HSxGhaXbcS0+d#fa^&SUJKw(ig5K%xmAzB=DJ|cg&99)W6BsX8^m4ovDL6Rg+fak z*e7oZX5&%pNh!VVYe*Rh0I4acOPLvHq4O#$f!Ra^Z&TChPt|Y@=ptUGwG<-`x~J_u zf|`bl>{Ar|q<*qVvEhjX6d5SMMBxZ@?EDyXXl(Q(teRlN&^y`O&CF5)vGK@I^yIm~ zi7{xyG?AH^KBT2)m^s)``2;sRfM)jynwpkfV$^cbE-r@^ks6)Mt29|mIf;>LGDWgG z6k>x(V~^t(hu|ojvsYb;&aK;i&0CfzKRoX}l5iY>=Ci(Q)?T%I2^#niu4>L>AakA> zBPVz?=iClW6}F?WMfIoLWiv;6e2 z?CSE_Px0*-Q4-=&TaAH5N)}3vr1ZF7x7IBhap(QaR9!2W?p%5bLm#%L)uCh7N+ErE zIRKTYs;H>PN9a0*V+0_Rwpr~XrAN+1>eOSjg=H6*gnkQ6F|Ix*zh|aFgQ{>H=cg>< zxPGvv10#$xSIrL$Jv`pDEP=fY7s4%1bO#CvPu zFf-~)iUY3dKTl+45s#Dk!oX%(JB)TLjh1B z1g%G_t#mgZt-!e6bG_Qw8V8JO{lhO&{jI{d39Tzlw@QW5t=qp(5S|0(NM|#~+48tG zcYKHI*!Wud2p4lM^{b~aQ#eGi^pWve&NX;y9dZsog1_wo%ADjQuv-uYKQmxv&km3h zwqkY6GuY#xrB3{Q;2Wm_ylggQPZ#cmrX;wLw3z3u28!_nwy zd_zBKx$Oz3tx;QvD({!*xUnAx5skRRX5?H5BsUym;yH5IMZ0ZiQpBY$09|4=u=>2v zFYL!Gj*Dq#G9W&#(TKCcd8j%M`}j=J-h7ijDzcMC9N=OJ;vhxVwY16hlhMe?FcJER zi1c5P&sjj=JZAycu2YfG$k}mer@SeX=4%FN>MlJ*W7*O*GByMi*3K5~H6H}(r5e=x z!QT@j5cGAnA5^wY*>C6tr+?~K6SbX5$EJj1(|0S|e!4_N|Ha}m5o0Pg%i^{fk8B#_ zLrqPST9C*F8aLTUR(mmK4Tpo?(IF^T*mSVI!P*W~U3Rm{WcGc`j84{vVO4BmeT~V+ zXgqQzCOe|B5FG-Zgz4+BY~mv^W8;jG7>aBLx1}j$h7qzw3O^TO%BVsZ^P&69xS2Hh zyrnVOGcJt{MPU9s45L~MZcMiEK_;!a^j+!*8)zcS>(&MMwTq9pKW*xlHL`N`>Z8v% z&CCNFg*-EDL3wrhnYuRinnXBIpqS8F@3l-$tk{H`Cn@?SbR zHTc=Flu>ZzL%u0mm#BXvQMm2GfdyYl!dH`U)F3y%BI#?G^)+0MBzz6?zOD-vs=MT3 z!R64qG%kE?3m^xYuLxL#TR`lnv|)YZzi zB_n=*#rGB8zg+RjlAy1)!MyR7O>k6SudGTq$`;ml{Nc`-o!?o%eb!SyWxM7pzxZro z{r04qz#+=g>q~Cu%k&yqhnW7uAw9iyI;5Z7mfJMI{_}CT|}?&+qp!-J*4*)?X^_SHm-+wyo>Q8U0-G`N_8;XhU}xt z1mgzqNvc2RQfu=F`->DlIWS;Sco(?$F|+!@fJx=UgPRyPE8#S9fOZl3$(}tE(UIZ6 z(AXKsf;ePWMwE$zf#@h12$QYA&_pZ_wxK>{JS0mW-O}HvlW2=6J5{sd37GlEXAH6d zXCLP{vHIUAz!b~azc5Lh)-a!~&GfE%O3TQZp3ZHJoO)4rAg2@U;Do~!IzbH&DUFbe zGwDUvBR09m@jl2g4%RA@-kMo&&Ahknf*C8_Q9Ng_T_~wfmbA~7w7<1C(bu0SX`e57 z;=ug2qcPci%Vw=)0_=>LjYOmF-yEO6Uwy6VOID!>X*^W9r{tK?b$C6la&btP9U=cr)WzV9`Bhe`Igo!tI0$Q8<~qW>O3e^uSoY;-LO zNSLY>cZ`uMFJ&gkLh5uYK{isS+X;e^V_nKgkc-smZh~;S8iVI?im1kA0t;LThV-u zU$mKJ{D1kQAE}S9hHnyVptlYHlAV0vDb;gZ$p1-2Xs0w|=S!aHOw(UVpCd5*Wgli# zfe{2>TDH)(_%YBoA_jCVCkV>NS0V_?BZltZLmkXcl5Nzl*ES?;cg@!Bx>7PyDo*X!w3j(?xUc2W`T}O*whX2@vG|&4EBpm5wP&@0Z zy)-!Q+mLWlt zo_htwtzU!N-FhOyLEX5%l;pq6T9g-5iEUiJng(moJD^wXxS%G5HYy+-GpOG+3B!O% z(^D=SSr-+y>&u0x2uZG(DcIm&rTkX z6R=#Ty(Cd}*}CuSP=xP4iRsBsW*wo{qFUXKS;+{ZdOk8v1C+(H9_R32gSMBRyX@22QN~d=gER@&1e*CrLzZaUa z-GEG2lk~RDdD|`*U3qHW+m~?kExH9q{ReoIUw%UnodxfC@>6=;Z!eKn?{_>qg}=1# zcIe->i%7GM2B{kiaRaOgcShVyJuDj$!dI?X&Df2wW7gGh_0xEBNhOdLlE08le-vJo zM%NYoYdL{bR+w|?8P-sScBm)!Qqhhfkw##FL}*l*Fs@6hT!WA+974OUUzgr~0R8mi zx<_?UQA0GtWJ6zAf;BO73sfgIz-&@E*0E{DrlDoBa(_5F5*db(Dk=1H-`N&`ovLvt z3YEyaROuvkWGy zYr$9g>W)`-eBsfAqxyqu?xGul!Ror^ty=JIyj*qJm+)*_DD>Yj>V4qqdZ+7WDLtOw zUh<%Z7u;Uq^Y(WAmpmKv{|-KyStz8)xZ+X+`_`RNh-e?Fl$mkAVtANFB|2N3Y*g%I zpt#qL?E!PeewOnyTajrhdAm8&_@bZ8buu&3`{lJ+WBeATA@&IC&n@AgNH|LAb#EYL zBmg2z@g6Z{W-wM{ZOY0(*hOz%v=hiNn3k7%nE^2JT8&(gR~<;{lThhJdtd64R)tlH`azOO>}?$+DdtV1mn0dL-scY_39Tj5#$f4)oDkm z!MZ*|o}6phTfe=wz7FX6aLSf@kz)NM8?9rSN;!S%HejMTRQ4^}Si$;SYdZuT6O;=3 zu!k`Zm{+RfkjUN14(CJ7kly>4ahRge7q$ONIV=OrfVt0~+g1VlEmc$+w`9!Si)u|1 z2u4xEmG4?>GiNqEwwPhGhhOU3YCDD@J7n$CVBVQq=G4!HVHx9qgQVQL73|fmbQ}X= zfhd2@l^zuw4y=mxz=Zo4TgDNHR!@XD{xeFIWz0S5AGKz19?N9?fO0;oNj8BA_@ST5 zInHQdP9MFp^@&k<#?wKB?Bc3%D3jRvuI$VH%{a+qSx}Le0!lgNSI<}&c$H4hOJ{Sr zCMMBoU}K)_?0qaWu=~ity}SDlKGrL3N3KMRlY5^KQ-fOy+7V+aeZDc?OS$mqBQF&M zSZJf-`{>2}l%()e_NzYpO25&beI(d14vAv`f@6(}?w)ZDW@yA@GiMfaln&C@Y!fsf z?2EDm-(_B8vP&J6VJ68*6r>?W@}IiFR&{P!=i^+m5ga8K zpSWtTzBKwZ=lr^T3uS?1*{0dDO_xv4mpyvn=rv!(#ZS)rwj>-|QYMo%Z^2#uW#7EJ zb|Fxk3_LO$c;u~y`9SxS^P0c<(vErm_Jn6U6#5=`+ICu9KXeqm?=GC0xcF?+-8AQJ z`s(C@r{XK_H{7@Mx;EGU6_9{kRn=wHbiI6ivb=M)ymN}#Q&-LT8ot_px%S^a_13nl z8}?l*U3V!y{p5V<=0yHxI0;s*pXyogSAID@z4y(@zw>YWlT!;tfkbsXzObe6hJYkx zG8ES>Y}l0Cuy=OD-YduFH#~l^_gYQM^z-vIJ#%F}i%wK>qY!F%wF8h=^GYx7{Ay>? z(>CX6yOv*iu{Y7&mCWBUm%n3qgEP9$&pn<`)Z^e|$DDh|LRD+Bs(ZGo`$|u8Z~yGx z{`smWURj~ftlZAos-16ra=z;5lPo8o@;L;}*P6!eh=gSTxu*o{SRJKzrol$&W8B4l8^zG z52g)9?K-A0@0Bbhs)T-*`YpzmU5~n=;<0qy0re~Cdq&;WYHnYx3Z?HW*R6^b&}y_E zg=svDy0W!r6yJsiFrr5p8=DqsFDmby@k!spoq4IrrV(tH;L`5}4#@@zm?2dHZ=jE6G?IqCRdWDyTbarPaF@pxkI(osqnrzVXCI5qPpAayt{ zrh`eF;SyDdk^UB(w?wcyla{(!OWmdDRZACWg17M1@>j~I+!sH7DgP^_Z^9`GT!}VYJ{I7iB=?k`$!E5bUfCk&& zJnL_s9-Q}Yy3lhC(Ruuv=lq*5pPly~xzK|TIrEZ^`dLT)wB@Q}JAQjAaFEX4>zws> zUVidjlzcMbc@mFum~#fN``~?de$rhx>#hSMvTnNOtw?$|&e4v2-rJdQbpGrbJ+GQ| zSJCqh_Plk@+j?1?_qHb-?byX5`*v(2M(yp=-Og^K@b$)0r0*CD_SWd%DJkr3)4$VJ z2>2Ujky1|3&)I$kz5AFuJ9}v8(txs-%=6-M;id^u18$n&`40AC%DbT>Z|EgGz!U>hg#dq|gO96{ zNq(;ttR(p~Dw)jFv51v~dzz9-E^7^f$(7QPkB&`f+@N~(G$XM z)kE(pZ=gN~k;OcJmn`P_yJQZ`-z9V4^{wO)L>BXb+MkfOh*nEe>RxK07A$|4Z1H&u z2;wauh+6OyHz4I}l!wt;p}(b-yuZ}awe^y}u}a@=7Lj4^O)pF~Z^lI!Iozzk@$JoH zB93Tox=1^Ivjob>oB2$sGoT}ZfOmu--VuUaLPN7EL(ouCo>w>mgNR!sL@bdw!qJcr zZwP7Q))G|Y7X2G8oK{1RJPm38l@|apI1SE^WWTJRl z6iW*+p3E769x0|43-d@%Q~`j+)Y?h$v?zYovY1+h$VdFFjPevy>rslQ6)esvPcgMh z(7ICmm7#_DJI2$>D24b?reJ{e2eGs$QWnLC(ppE+w{l7&o)%(hQM9bPmBiN(ON*jq z-LVwDj8gR|g-BU$&S`ND09(gBhcGYewH zt(9NU8^tWrr|kV#J?v5=DzHda(jaPHbvW8+I2urrj_^fe8I42Pw4UNom0ccUw<{g& z_HHM8w)}_*M46A#9sueXt)!h$ne72YsCou(ofXgPj~Hz@WhYy5vv9E3yXy57~)1)v;t~$mYG{!2*>5UB(vZ~?YFuU>LB-~LiWjLKn&m%`0 zPW5TVT|0SUCjn4$P_uKcl@vW0(;((dgUG$bFclUy6+@`5F*8mTVfnH+Rg@_g=1v5k zKGyeER710n6|V|g;^tSH`NntNTaRt)oTHvat$NQP7qU^ zWContie5?MR0*l7vM3NO7q%kk1m!Nmmqvlqh%PHejFNI<8conQPf=o^q=u3;&BH#L z2jZeM57_G7cU-9AhZ7e{dXBnsj*>|v%uSmPeAJLlO!2T>0Aw>m-XAc|-b<76NvdJl zq!8<1lhO=et&_5104C{E^nvq~+|M*TLDSI98gc(&mx>=s*d^%&>eQzx`DaLSgCa4d zk6gL(($JzI_0t?&pgNY#0m%hy4v4C*VGdRgb|n1B9jcV3E=LudMdI#d zCNtwzusF>uY?V{0qHi$8a~DBh)IRwof?lQMA|<;hVJhfL1Tlj520^PyuVkaIO{bND z@*rVnPq;&;OJ`36sX;5$pgfeP2Cbl=JP5^upcNF92cdWnv?3=Ij{$ALmvTklESEnn z`u-_OsbnoXIE7rEJ5yP4c0NHpQH5Uwt|%%0sWeW~1#MLxQoJ2$n(AI{j9(;_`8QOO zt#+(#cF`f++Q#HflvL4|?b9-j3jR5|_yVd~(z;%Vm>s<9S?K6NC5*6eF=NdKsOhlb z2p1v!0cu&b!&B5@m{C2n4!=wv_zjv|n>&-tVf@qQpplw3aS@iCXZ-%ewd=@LZxP z{UYkm#O4PwrI`^x5C@*eVUhlPE&ZLL{=T)WzYh+Fr?WatfwCR|4rg{)3wa{_$F+3$ z#+dx#zWQ~JQlIBdda*;1_qa2FYXX(q|PQu?d4bm{B##Vb@Yiw+@!zD9rd7YjuC zI@S3OCEr96qsqW#Ig$Dne#i~WD7R|8q`EyQF*{fj-=&&Z6R{Aq=%BQ;Q1jYiZAgDj zb*x61{{{o1MZLi#(vOb)=EUBsC>h+K35__@PTNDHV% zdJhSwZc5|{=^Aq6ZOf?JngdV#h)D8(r@FsS$#qJ8NXh>}qL_1X>yQACy}+C|<@z;# zkrB8VP|*)Q47Tu3I@rSX2N-NY`hXB!ho~+0NY+y_%xLgFe-@Szv96+*Ay{k=40ZolvYk^sv7u*#+ zHT=i$7?R%DIUaZYV)Zcw(0=fr+iyTb*zR+ z-9V%aA8wqt8I7IOXUK=UlUx*Wt0?9j-~3=Q$hqnDZ!ZbN~JWi6-YAuw3&^b99Tv$Wbc-t{wd^G7hns6Mwj{lOW?6tCFano#Z z)AW}4;*O-RBjM;kz>@r4@dv(+pT=rY^$WX=yF0|U&EoD>!`qf>f}6zM8x3!-XZagN zvD(req|qn)?&S+u+nzqdM*kP(V=Qf^)@-HZ z5hRKhKp99fY?W)54de>`zN}+AsFs~bvW8J%eydt7Xa-y4qATs9x>g&`Fosj}lzohO z%2LWaWeI>LoO#MJn0v}HkbBA!$mfA(TD^#Gqgvm=qq&;Pa*o=yOMQUr)cR2K<`(Qn$dCjJsSB_Pvr8_i#W>t(hRl8~N}Rq1Ccl;JF7`A72FeM@zmxr^8CQ(0cS)oSbEuv14PG;TYFJHOzy zYhzx!wmx+j)knCi%Bg-^j@Pd3QCr$;SLz1QY|NK>h<2vEYlyl@O_WEDsX1P;(jm%g zqaw^9HU$X(1vW?zp_l89g_7!INz-ge)0Fvr zf7PY>ukQPkN4_?cSidLf@1FB_FHlIY9kaDN-a0*BdtmD5LS09)ZqIDpo+~@%>pt>I z?{)fpV7BhSyXN`2zE^sedmY`?J@(^kbC2!1Z}-?9_$R?Vwx^EVV<|0lQ`%PA<0bc4 zz;KVH6z;LOeY0{;0JnDqdyiZHu1loUYwxKxzFTgf{3?;)YAX6}o&8|G{@u39gKqtQ zb{hd_$wnS50x(o@X)A!c92t>4Ri?2)mV2z!Pb+IRS?Q1P9q9=wnI-s>)`(W~izM=# z##++$jwqUY{c`)2VkfD~G<5uB^fSf2_c$1i#_;z`Icb@R}MzPy%c)NYKfFECP7xCch9i@QZaS{BETO>HIU~jAboppuX zUHW&r3ITt^CsLYUxVK6FjV2?(t$LJ~!ZcSWC<)?AD|=i@MBb!cJeNiZic`X@g@*|m zr3b%C$!91bORfjxWy$PBDIo`>*vF8Nm*pdO^Rn#Rs`|&Iy)2vCa=a|d$jh<;hExyB z%aWUEk*6djr9!eW%zrXoQO|I5jY$J0R?G2B|oC%DHKD9_!C1Ch?pRo5SIe6bhw=} zv0%Omn5&Ov{M>Mu{(oVKR1sX%Widhw;}8^j~y73$bd{DVOnxfvV{_g6vbVO zh^k5?Wk~N+LXi@3-v+Yk+l?D%aWg3#kMTQ6y;Z9NwE?$R%)xUSb3w$$U|b*=sPD4h@^_JT(oIyUgQ&hK`K*VpWd#`34^(+7P@x7HH2~D$RIow~ zF=_~?Vb|C&qc#Aw(M4@gJx55Ssc`zWg_NGRGC4z;&FEC4so6zkCPx)jpULVeD?UD| zj4xWV@IIBz=!Rv+B7z;#3?pZ0IL(AdPuy5cK-)4wHN(v3s5PcrT3WNTl*1crz5GGg zd>1+zaA=BH0&q#34qF~ou)M0MdQ`9K=@*d?ljMw``Z`Ef&NgR7OPcbjj1NF*KFgOP zmS1IDK$<11AuBLRUJ|SzoGon2@qFerN^`XE*{hnV!vQqYWQWtTSp`nkNA;{`>1jpB zQD!U{jAw6Yi>8vw8J3nYOvQ2zq|B91q}-a-4Mn@DWwP4!tR7YJGl8XxW)8+h70pO1)~v2j?Uq7yV3=X*v7jwG-$>X}N}D(J zlmN%X9~K#YpcTSqFLaiGJJaI8ZwN^P?I5`-%nGVd=AWbjr&PJ$3tR~NM}*Cxx?R(R7h(is8&A*G?KZn-!HDA*(_n z;c>)lI=D1>thev~I7r)JK#g9Nk1K5A)ZO%| zUjSY5Q1pGY5voEkV_1&9Gy@?b&=zR8D)4RMe&`;ky70wbs8BMZG$L%UdgU$NR<{I0 zSV6u54;wZop@Ul*=k%KTc=;*afd;VinDL5Ks#A}EONPUUg~OL8CdL()sVbS7s$s_x zt0I$z9pXchXw9nv-49E#WA^Z4D)4OYsYt^$_%M#_hH8nFe5CKx{jvLF_r{j3J0INs z;Biy$T2pUPzWC6Bs>*`0N;yjS!=ysP@G<&b;y8laa>U`2E`T_&UOB?s>RwOx?QbQ=A&uK-bix$5CU z*riLu1s@9u!?w^{5TlAML?W{7)#weAYpGAm=XE1Z6G*K=+3e#g8N%cI1k#5(*NlayK!{8;d-gaPR96UCNj zvAJ(qS`Rhd8NM^TJiH!mxpU?Am6h}Ny!RVc8y@$@*Lvf{Jrj^YYx{-s| z{$w(pOTn?3LzN+rgNwEnISZq>SUWghOmk96&9Z3b`n;u^FtMTRnp1i-)K7{Ps)KnMs&76d8=_Z|OJN?3VyB&GbmaI`j7DE!xGL=>zQ!#PedMMGx+T_q zDx-aFGAm{0W=p4F)k*>L#3F2-gxZx@MR{U1C8;7LfS#Jv$)|cDeUeb=>~KQ2Zsq8& zc)AoXKlNqxn|ijK9Vxw#6&a8cVy-v?>CZf*E>UG9@doBFx$Hc?h$_03ibY~I5ylI9 zf(;6r3ftW7nM=P2n~_+Qu_cz16(_-6W0f?T1wVvhb?0xPd)np3D zBNIi2@ko+_8(0;OohxDc@Ctk6UeN8g%3iRc5+@;B7bXStJCl%kohy%p6L<=zE>ay5 zOGQ)Mn^0zGZVr+^g`Ej9?CP0fg{JaI&g~%uw2J9Adh=D$_N1~V9mI_@o8_^`ZpIap zY`G-kmwm|n!C3w4ep~><(h}M5k>fuBI$oVS>U6Ey{#oO+F-_dtZMdHE)T) zZ`AV^*5h+<i?q^mINu9*4S2;N?Ke5c9*j(JNEVgFX19JTHAg1*xim|IPyPeEsf*mE@8EkwlW!EHGm&= zw6%LTZN-r(_*Dw}Iw->Cdr;S4+>t8A?FZCf#+zXp#c3fv>`TZ29`lh&1+ zS~df>0vJH}k^p*xte3>gf<%oGqWAOsaJ4r2zwlLLa#Q&ppjG(Z4~m( zsPkH@N}NywxbtKccXCt%ILr@|69Cpap=GHJJ2}Kv%+6gX6SvMY7yNELzTCINu{q9U zN5-}4aAr~Nd?cS;-+%PuCVn);GWf%S$79m`At=-K0LpxpaA*RSMUYs*Goln{@G>r} zyn*mCE>!md<5chXbAjBwiv*9>qwIqAWiFAC32fpKtmJL#PiCjsf5gYRO& zT(+7C8cMw|E3vi40mlkK^sCG(Dg|*!DR`7V1&|J!HMeAuAr!j-a!fO4B=fTrZa2Zc z@ve%ZHB`qkb1&Z?^*BhcfrVH{iuU39jq$Y6dH)tHXrg>T&zgbtD+`ai&a8EvDIPxi z;ME5UkI#**of|8@m?*aXV%h(%Q2TngZKZAHt(7aqj>td4k>yMOZfXVEdi$aEj_xhL z7jsN+ImZNbU|tC0Y$UvErpdh+dRdOm;@Eo=D;C1hThbSxazikta#)Svi=RPNg<#wv zKiBgV9r9P`u}gc(z$;z_UU30b&DZj^2nxosRMumvMseX3{3@ladjh*Ktcm+`)wsX= z-L~qtd@PpxL2G2YX|fV2S;#3|y2viycL}3P@0^y!yI6?6l%onjW*LLUTLnX_gUjre zY7FLx!Avlm@l%A}Dd0|_Ih!%9w;}3IIboN<8nhnn8@@9DAFN|WP5jNnIu)lOOM@7H z2g~ty5af3-it%?4Tm|0xV$X@cgWPFgV8T)pe^I=<#NRe|{GAYA5*!C{1I+#)+;zqv zAk{}@mJ!#+WMocFOhy8Se3<9&c<0->ofAAHGcFv1X*-4F*n0Qr$K39H;Bj_+8&6X;Jguzc{zb4SI{CbArNZ7*_owrFZKm)Yi!TG*P+gg zW}|9;M9oSQCEcA=s-|cg%@AouinRTapKY}x&5!;tFtQu(|jrP})kj(7l$7;Xt z+?Q>fSG7m-xu4JTJLi1wbGph(T?EqjH@_GDyPc3f;U7KORDjuTV+grS0z@VkNPrn( zhApzC31Q2KRkqTvO}4?;I$|Go$d2J6xoFraJBN$q;wDn3wsgrZXki<14VTF7CK9mA zrSQLKqLIW7lR(2cMy?B3S_wayBB6!`22OFuul1>ETo&E-&zs zAhD7xaxyA(hx{J-6hHXNuCqK3zO=B zq!fq9%SkbIn*e4G*euvs3FmB4BE1XoMZR}d6u4M#gumD;s@n*tW`RA4l)Mm+^@vG0 zMrbaH;jG$_Uc6w?f{qOwrazHV+@X-Rr+g?RdST`|_(}DUT_%4erFPdt%+lRQx9E3h zlK$U@dO|k{0ZdN#!DiUE*8sRoX0VK=3EYaj)SO*!%d3RHP+z2%&fv&2^=pTrf3xOz z!59HX@1uW%WTHeL*Zj@^JE=);*AHvL1cz$5^z8|e2ex53ouN{co$_gjl~W1WU6<=P zP~)JBg_KJOgRFl3v_CMZ+JJUsr{E8(Qsa@SV=zpBl882v(NkXFWaO1dG7NmV0|y}{ z$y^MpmIQf$P3lzL&5p-od^Zbxd6A1I5zld-L$OG*;(&@!d`_{wmjse6hEZ8=AyX+UIKRUfu z*>>xPnabXbd!JddJe8^J%(%NY+_mfO##MLYS`#+dF0y%CTf|oE5-VY_@5PQbWXIcf z(TxZfaq2$>}^nJf!+qEXdU3wOmcct z6^pgdyC!dL+@rkI3`!OS+d&OOiUDpIO$9K(eauUF7$E7;RG>E=b6(2p4g0002?Nqg z=$i8Pv)ZiHp=XX*tG6(}1#m>kn3wWKY}BhKSRFFI1x9Q!Yjr4l#F^Lh(jb^M{n|+w zCdm|@B1khZnex+2hh74+zDZBJOD_o$UBVe7f$#@fEYRWt>CW1lG5ZXdL261cGrc+- zG-PbTGPB<(wdnJ-l9@iE)R;YCEi_}o7PQXjgp0I#o8orR=x@_U1vUJ4poXKgen77e z81+FL7Dj;SV3%wcnCz9z6lf1~0guqOxvO^O_fFWe_;ygA+5CbIGx_?6S*}Co8E5UG zU0;`e&ai9dC6^H{sgGoSVFwCO#|2lwo+VGLGede0z~Mc5j)l&d9Qqi}@mVu%0mG8RUo zp9KR)0$&I%Y1Me6eog{C5iq~O;@dei*w5WAYFbGNJ}huic7cmUr~{Mh^AxZK4Lf9z zodVkr|KfzYbChRa=39U}aZ#6vW~8}Lzv~qEH^tzi#g{@cE~b>Jpb!J+MvzmAE2Q~I zq0l%uAI?SYgODU#;(b2F3YMLS3Kr}n{sURDqRHfhjGyO4NwLpG;~bca^dl*@*?2sv zI5FqB7*x-uz-Ln&vqFp$Q;IVJ8;HJ%QmjMJ2SLS-Is8c`g@|ICo*sEiu_G)gMGKt7 z$$&*GV4<3#c7%|l6mX-m3{Pswp~)$tX(XZrrC6hUOhj`{tir#x7+AK7Eh>PKYsVZB z5W=$J#vBNM6X7@&yPQl!dBs6L;6@6PZbTz2C1=A?PLf2lvXr_U91@xv9incuuUJGI z06J0kk0OZ1GZ@&^DOGILO)UkiLWo%iTPRj2RGjbgDfO?5TIUp&&=hY+Hv*GtnWB&r zG3$h%^iLo=E|aZV;@D~RygVzt<7)ZP8H%j+>+L|eCz_P>F58pVNcC%Ra zTBfuK%Lc9wEGO?yuX#_T-6yc3EmPX~oW?f}r`?U%u4BEnYqhp3Q`&{Ck6b@;<5=3= zOlv;t`J^XPx);k2T|abVFzs%jBY)=m#Fr^;%`SiJB&C(tMsEIe-Q9i9-M!(dS@*Q9 zdfL`H4rM%t9`qf)JF?z)>R#WePpg-GnVRmEx4*6F{pQ4#Gn)Ih9IrG)j-SAp#|DDNiTL-?HT5UPAS~Z&X zjNUKxek@nBfp;(A2o0EWyO02D+i%p`(^2aJ0OnD`O8i1wv#A zdWo$;>jcWSyp*ubpkSaWXc)ZbE83xClvRzrvGSP`wFQ9~X^^RsiiRH`)3XNmvs!zh8gb;xUh#tL& z&#{JLbL9@oQX1%HMIKc!1_{|YfsaDS5QqZih(*{i1PVb}fa=PP$7Iovs)GxSoTHO9 zd5!)KQWWEwqIb+Dg=jz%Lx=`ul+`{20CZF}sc!@^fuhBG z?eKEhdP(oSlHQHZAFOu{t#%HrcMh+14u9KuX4TVv&9%|6cfH}jYQuqRuFc*zzpTyl zo=tn$jHmmNopg;dpgX(`8x{VQpR6pV4~Ns9$hOtuRmI+8mlk=tS+`m~knT8yxpTne zXq{`3vw)-FZh<2B%*d`SU=KKYt-u9EG@L|rJT)>Dr)~_W!6XbTDK-qVy)dqH9hyq$ zrlSyY+s`l$X}>& z%osDsWH}5tdR__=lrVS);j>Z`JODQflFW<1)nSMn#urWIMpGDg9WCTJxMe^p(M16@ zN8xHg0+SLsEq;*~MYwIC><%G#E*X{0fiwXDwi>-s$Qe<>U?vxd=uAL^sv0JgE@4VD z6pJM^2$*Ypi{>Kq(^MH9Z7#h;?NZ19hXue&v~Vumpr|WVDncqAS)4TPvr-0Cs`V-J z+N8vHV1I90R08`Ez!IKKyBc;CF91w4N;^I955laK#8b6a)tlaba=rZ2z4B8VgGbif zZENm>8^=f1ob0-@Z`Ij%XC&i1wvz!g0%EpVI@YrpfL?8=TG%9hs&Ow>@3`4ue@X+* zFXVt_nAA|iCHBgP1hQp$3qR?7!}PC-Gc=}2!`Z%_fWI$G^bt1C&&E;m(nL{S0sPJO zSyi&X^vP*nekQr&*>|(T94IE0G5E;KP+&A3f1gbz@>R=;JeJBCSB>Vgc+V#;2@)_D zB_6mNQlGl7X*@2sEY%WTYx5F^ZN=GUo9nm>|PLJFwRn2v1-Sn#>j;^BArf)^;)m z?tU1qCw0-Fd+!)dpkV<`02%d~hStR&$_Q}S7r{1xt4~=>v57dCDXIYxUf{#;t9P}z z!+`nWn&m;Nf~WxjiYCu27k(e*Cyu6zO;cL3(fGU&ei`!9O)wy91Lp#kP9fokQrZL>@ZOgtir!^7d^HEax%-$HQW( z`ht!J7=Yi?@$hSoNB{Z#GdZqH`0 zYz~2uC0X@6fH{-0W&}Yf%`|-Ij4DHG?-^Jr3@;u;A^tra6FRS{9V*>63+n@ixZG#yHg^Dv8gZ;0|-rG zhH+AH3Np=i65$Smh|`z_F*^^LL_MQ!z*@aJuh_XTF$(Rdj6k~%9Hj#V9i{uvaFo0a zYu1l10#T^!1L)VOhEacn@Cou-rvB9C!!B`!D%(YeoLY zNkIgKi&Scmh^gpq!|R}tMf9FkueKJD%6hFpA12W35maoKQIsE))ue0BWXeX<&e5F` z_odb+qSqzHF$+VMJ>x+v#OyB!{1~%J$Z}rIyy6`2L;-bC_AEm=FlPaAXrx!1 zMGQgD!am3ULQU2rx@N_hUUicE?Lr+-dCLN$K4%W91fNH8=8=HiK~*<$q`IDNH8O#` zMj6hLGncPODH}dM85;iK#JQ>AlanKpD%sGJq#I3^jqx}qA3=&+1iMpI5lh4oY(>D!gXKtrsuXe_0Z9+<{EmtL0A+ZV(r1uuSs8|T zXt6Q2CvL*D{)v?Tk(7K#`ZA<%%jRI}{%G6%pSG_1yK63wKXDSK>CdG1&(>W}Z17C% zNh7|EdGaF*#898Sj`4~o_29=nsRfJtFP&i5JbIV0*v~SLoX^eO&JxRqMgOyvEFwi97n|Jo=Up_$6vXJtmJEJ@ld(->oNxN{{!~|S%d%p diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/middleware.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/middleware.cpython-314.pyc deleted file mode 100644 index 3ceb811c54d633a6de37e745bc8850f538034a89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13459 zcmd^GeNY@ncJJBQZ(u>Nu!s*a%cqe9NCH_h$XG}qA)mD37L2U3(AH`hVC`iW_YAg# zQ$Au}T)IkP>zu0`PA)O3+(qK*E|x2GclzV5%Br(nPF*Us80i*Ik~&q{sg&{;WVw^2 z{FC>(XFs)I$#$GdrHk$E>FMt2e%h!sIZeF65ux9p8fq|aI3lVdOO2|Lr6$z`sd&WPZ&5A%R@KVt8IRcd?W(;$Pt9Y` zrX%_N1!{rbheLIY7zef_KATG2WTdDAzKucMG?F*s7^vq@>2a$tVuv@4>18~>y&_fC zZb*Mpog4I)v#+f7r6UC+&XLlr(y~(GCSJ3Pcr7EA4v~Ldb+J+_l-klt%UP)%O7lis z$-0|aX+D$|jFcx!D_E%mN( z{Jfval5$Q_Q{r2u;OVp zXkyQSgPOyCMp3ChpiatAe-w&sJo?xCb4J%S8_zVokADDpB?NTT*KF%^! zR_Qr>3HOg4f^`y+*Ie zYi<+k$b#h-uDNE>$9cD4LRF{EwtD%nHCtFdtNH@47FrP_nFpTxVTvJ{YGxSCG!5T% zB--%VEf82UGtSNwoI{&(?X}iY7nX` zG?4bzmncqKhN*K}zR#y`F4^bPs?tYWn6s$UT?-Pyy^n>N>~ z37+FnnFREGhIxX7dYO=dxC1h^qy`A=73#=tF(@<}W`517BKZ?buCF*!h!t|;z|QHR z<4UJpf}j(pEnd}042 zuAJTHg8@v3Fb`|`?6g0mzbW+j#)4E)fnDTq1YTQwzR^g)=cCvit%67^_4yQ(F9Dxl zRcY|dv??o50jELBF~Sj3TOulhOuQ1JSIDZtXtJ*46SH&8fXgl>a=aZj3BWHIkOUC! zkvuK;DR~@&nS$r%S%T;Pi`=34Kt;Z_ke}H8(h89{X(EPh!dJx@;ZimW)Cma}Dtt+C zCAG>-nr1NlZfsBw(JaZu^!qcIo~?NX)1&-?B`=7hXyptK%>Le2#Ow(r_&>?!6yZ$< zXX`ALMO4n!s7)0MqXpw>&Ly}w9*Xico8_9Y45JpzG+@N|5sPy3)x+>6O{4d6zVcdA z8a*VaCa)3ny9xC>=yfybbqnZqn=Xrva&?(f(KGwF*i4g->V#iKMXDraE-LPXh6a7k z6&L`I)(jPEgyF%45aJRW=lUwP%>e4v#J0JXhYDP#Ox9^4pdPldHKQjImN(qlb!^=C z%qL@qABKU%aS?Hc3#Q$x7|kDC!Q`EK_QdzKj_#l)2T(8#TYMjDc#0KbG>~3PFLje) zA%UQWNjO=g-~yz$jMKDRG~f@mHNa03ZLQHneczoaB7Hg$C`n#~v2yq@Oa_v#Q<;JER(dhwwqaoaH(yrpil;1z zBB)_aj(2|!}%_uSp&l>>6{IXNXov^)eQ(~2(;8I>2T6nRZE zjml@H$7vtrX*))Tu+%sj45$=0I{g|%3r5Z~N$90n6QYTMC;(v+SAY!uRIkH8TxPS4 z`*+YQBC!=KAhFl-zMU7dZeFx*Ue2$&SyVpP^k(ZDt;P@dqi&3lUbG$~?4Bzl1`gZs5u;xCDJX4T zAs-nJ-8O<4y=?}TX8g_@V6_1Jl0j!#A)ckZX;b!Qj3G4%D!sTI7b3h4_41Ql+1JS+M|05VZ3Q@X_VN0%US#O+NyRb3t z$L5GkGL-!T+taie`@x;H4pya4!nBT`*kBq|vGjaUosi_S;Ln5Npg$y?@duuXjEyn3&(lE_+<~p0 z3}J%M4A@qPKg1@rzU6?mgjYO4Jl|`!z$^IwMT0u;YR)^KpvWn5o z(()A(q$_4py?w=kIV;(`WyOX$JFz=f^B~9NtiHz319z9Rc*5QewFe}Dr$j~J; z=}+TumQV$bH&}baqyUx(qJ9=m>`1dp1R$Gu>nHHi(~V!DDB*AY9-eRA#^_Usnnmiz zSGeuyC`8RV;>s*d@G*CJadlFDFIl)EVI*-wU%GLlT0S}k75*H4NlmlW)U-+C7uET@&LLgU8n1%r-ki_3XmqOiXw7om5?c8<-Hb#kYQ1nPVCRs>t0Zu z;{e~P$gnAwB?MzZeVr8^fw7LVeKTyDhV!O6GGu}opks*zXjPoZr_$4gVdHjWSUqfq z9umQ8NSujGS%xjA4cl=g^l%DsBMSp%iCijm!)aG`i$q`P6q~Z1LMXz*02mGZ zcH+*MG7p)j#G#zl?GVXjdE)*Uhuu&`POiJ_Mq!UvkqJ@_^PMt3W`+^Dc`hgfNtakn zf&$oginFb~x5_aP{3Z&ID&WGQObB)sEL!oFq43Ao&zqh$fRbO4hPZu#mp>v3_C}}qgnh47$U)lW>P}3Jf+!# zN-zu-E*x2DRw+3{ZC!M2z3ji@`pMHbT#sDsSSs0nzIVCWJ>T@&lVj1b@#sV-HgR@w;%s#MT=d*bwCII3(NN%6Gn0~v@3p+%GVfR_Zj0r& zeVE_2`Y0)HU+Wb}e%Xca59CYXi{V(_?ho^JFPFHZ`R-*$)qH)_+W4P+0;%fwbghgy zH^)jE7E2nyk}s%OcGq5TFbaIn^BvFS`qThcg-zA;k9}L<{J+*!Na=+ z!l6R*yN(vjcM0&~-R{yu`KI?uS`S%F?+a!qf8Sz)lK1nCkO%dQN;##YyHT`j;^Dp_ zO&oY)NHg~L_4I0{A#cyYKF!?QceHP)PqQ2!7&>y?GYHxr^c6{P*v-e9?dy64G}{=B z%*b#mt5Ov|xv`hPhgC3o1%3+p7SKx|ubROh@?qVHrOi)9jb*oufO2j-L8UT%%keTc zLiS7sU2zI=j-rxh*uTQh;x9Jx>U>CS4$W|x6M-v?SMC~dgs zy8(UO4bi&2==yHBI>a71s7VJYn1}6Qi=*D3CFx)j9oo#D06wNag|`XcHRkX2D{!w{ z7WrX-91Y^&;uiLa<%;@O3%>-+*KEl;HPdX&GMS1{b!HPkg=a)N$gW;+I^!%i#EGv# zg@1sb!tIjV;MQ(LUsvPJOkb-n@Hmq1MXC?OXRU72)#fnDg;$_5&vykx{{Kf=c zbdh1>u%X?62RI>Xs3>9_Gy;mq>9sgb5_kZxg_wZ~#bGha51sLzd3T+lh0RP08}D}X zot5EQMebv9Zoc7x`8arN!wFrTx&2Y(fK_|{w<+}X(F#*6;6o0euR>3nDHtA=&(brH z=POf$IW(Ks@fB&ia&myo=heC|6oG31N_PfJM4`JR;CI+6R|!PR)w@Sdb6N< z)dbJ?@&>}(KO@8xM>x9A;3s||Z5aV}4#Q%$8xu=8Wf+E2E=F+i?w*5G_5;2B64%I- zU8KpnlmG^Hit3CYnKZ{;#Aq%-W}_P{>Bnm#xacXKD%{_W*B-w=x(3*MeEMv1)B6T| zRYAavBFIwU5ms3||L6)!ubk%3DdvZ&Ea;RL;u<{e)0t&3&9oXcCSdm7Uw{b%2Ygjz z(3Ij zK{$iaFCz7QvGvruVM~cn`cs6E%O&OCKR92wRJG%J$&Q=ut(Uf3+;T-+a(BckJEG1G zQ231hE{SMTFQKeu%j)f+Nrr@X=8^@&m`m*T)?4HY72NAxs>Tj7w>VlSc*a#d6S+**X z%}w*_rEgyR=2c;-yfaqZdEW9-X%)CSOB-T^4N+^usz^$@J}PXuqo5W2EqAx@L!s07 zw}supPlbKPpP9OaUkKd-8#dfQS{E5|B={E2r5+=c)Qpe0G4jXwh|#a$mvnF*`W>7X zHQ;#>*P*-tRtvx{8P>yopWHY0D?x8^7WSCw$^repGUUe)(_JTne3^s0U&JS6Hskvt z{RZE^0|9dYzC9f9^?m`s$94mK9s9?%(eEg5haYp?XOTJy^KeM?yBOhS%W(Ljyb?bL zen`6&g`6~#&yn2&fx4eT!~cL^8mN;H)JZz1lMvKN2WSv)Gu6q5fM?pkYX38&jP9mHY42h z`;4<>12hCi&1a*b&q6;BigsYf3b(++MCcDNx&)Dug-Mv!(|W%UF?Be?=y({u@o6>~ zsjPpq`;G3)bxW14QD-Z{iq^}KtJCj1`^$4nHAeu3xEklDZ@5}wu8u`l$Cbe)*WqZ< zVXldg5$KO`&5@h%4n{R}Ad3p!BXpGAm3@d`>77@(+Lv+r+a-~cAX zkcaO;_vt90#69o4RCBTBihHTJ10X31NuDSmna~ORB zzoh2wOKNT|D0weft$7Q(KY~}3$EM*vH(XJss3hoFj5;xT4kAtTp9xTuo)no=D-1+J z_%9LoPYDc64{3pEV}QOzJTRL7$FU`y!6Yl=pkiy zE7`RbcG${XQw)``31-b)v+m<}th?#2p)GD@<)0v05d}f`h&=pnr1oRt_-Fhp_${gX zEou8#QvNZ?ziBIq*(yG?Rm|;OvenO;QFm0$J@Mwq8zXbaFQ2?J{qq;!e(^@jp=i~i z8zqOMq-eRgVy^GaV{aUrd+c)GTb>0^w6gO?ao23&vZEyGte=lWox5*19-hrxGdqQX z3xPEP$yzJs2lf0Gp?uD_Mj%-`AmD>1@z5zWU5Km^NN&%-8^Bo*-Ns5%9I{-C{WlG@ BVn_f0 diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/option.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/option.cpython-314.pyc deleted file mode 100644 index 460fa966c74f1dc9aa87893991ae3392e51f7d31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15584 zcmcIrYiu0Xb)MN5m%B?Y$z75XNs&YGA+7k(!?NW_vLlCs9Re=+c*J=q9}^`PyZAJx+aZ~o~nS7x(JH)2MLN$ z(f;Xo?w!{@NXm9{LEgD@@16TN=iKwUX9w!*0s_*+KmTK9xknKGonFl3;{|c^zfqVM z;({i;B*ew@;+RWwby3-M-aY2gJY!zXJLc1TV>Mb$mvF^%z!)K2BM2ST&wbuMR;$&r zZ#?G%V?iy5el^`f+9wAq3zO(%2dY$kV2n#wDZB2Q)Il$I=Hq*OjFOV{L_tR$)Pa3FALI-^S0 z^XZwaEESae>zTByQlTI#_9*!&DL$iW2ULkqa{AJfY#vq0ZNpoFDK$&@ye%u25(voo?f9Egc}FqzBcHMS}> z=F#geef`4O#K_p$k@52rqq_U4+^k+RN(;}V^qNc9<7867XVFnv8_6s3#niNXJvm0( zmZ?6NLS;f_wYqpIWdmLi3|xtulc=2+t_Ye4N^!ju(cE!S^Tb_%t((Et8~32>Wn~}7 zG%MG{8BST*@4#JcJfsEUb-+ixUY~g0+&L|G?q?U}9N;5oIfe)^7HAAW5Huagav&5i z;+Rt8f+DLJNtLu|SyBNpS-LSTE3%Z7rZRFiE!{|}5 z^1u&aNq(b{&7?9~c2-hljp`@zIr%VQYB-Q0N;jyTK@Bu3Zgw!JO$sl$9{+toNTaSp zcut%a<6_)(SnLt*xc`$NtosyMn^AJQTh)|10&wEPp06i0l}6mJKYw^Se_cL&RmmiC zhtu-whwYs^ibDlPT|>$YfQRm?l5(^r%<4R&{o%r_9!ew(N|F-^y}c9(!_G!JjB12! z=7Au3+czj%>|u{hR10kTRG>tQ##U=LiN_FY!A3>B*21yUhr8 za&%&;%D$C7XkpVR42IOj*lbNA0c>NhEfsrZ^)$EAN!jP$7J|ke0J9@ zOX%v@ax?9Y<>$32H#AUQAFyY9{7^eYN|%iy5&QHe-!C(QStT_u#w3qoYhcdRptN-Q3SUylk#pm=rHt{Y?2shhie;(gPValLK?grDP?D@9wyic07~;WGa2t zZxD zc{Jk)r}HT=ErO)dO&MuN$`Q&=AOo&&$RVjyiKM0}nX5CJtfD_rAD^Fq#Wu(?dQ*u$ zzbS0EJYN4+2z++SXJpM(I{E+^2P_|fXeNb!D-l?c#7!UQ&mpsixy-)eeFW0Sl-pTR z^IfU2Ww)h|`LER4QrxNypw^P-R&5ZqmR4rfhEQwiXI5>ULr<%B=xJexp4JeLVtvg_ zXK0MKpxnyJP4PV_?`7pkyba}cR*uFyP~OMN&GAl@yI8p;E@`dtZV=Iay&-O?c3fFV z{u1E1z_m9^RbWb$w4DxTt8k`{k;*1jRg!b5WI>(DLc!p=hBmFp&=K>hnz;&Pk*OZ) z$-t0g$-tA+xvCln`jA%PY_8NhNaaAsi%<#eX3_0wXupM`)>HV)ex zSO0cd;_+iK)&qO}oQheD3r^k3z&p41lJq9S3m&E1cPEyp?<!bi4OLmbz+fZQKmDP}SL^b|N??vGmA+3--FzF+iK`H$Te}74ETEB(bNf&0QwPp-l zCg`(t!EcuAC;HYndN2=w-AX0&@H={hN?VN{&RIx!mL=PAA9k55i~Hg=Ck$A|{U;3K z?GYSvZL?l;1kg$C++)mkC1dTvY&r>BCM8WCgEqWb2Rr+gv{Ni?Fz_>_nXUNcksV1hm3} zvB89c;1h}A)7g9~nN^=GVHeL~6)I_l#4g;mog0)bJ+e-Z;=md9Y9CbeW69d^X}q2m zom$qUa8WdsQHunDK9D5%$wd)l;?Tnwe}OVKjB#Qv1{2+#%Bq~X%yR=S4BnGT19b_` z+4XaubK_;>u)TL-=KnFY+oi~AxNkY!x7ONmEA&aE<<`viP8LJ^?ERaJ%G$q#uOAZO zdWf%{b5i93zT}nz4Ym`W6}HxBXghi@=RSY7N(B=s+rP zm1Sp#Cm=0}Ec8%DO<0Z^bE_7gw8bZ_sz#pI7# z7oPc~egD$QmG>z055p^w z3&qd{`^cKCg^nKBJGjP022a=A;5P7dm^`+RctSagG0Wkn*8oyS&;r-^FJt9p!n!qT+XB z#qhvtc(fQE{lN1#!Jh^{JYGC9TJ(>80lXNtCpU%srscUS|M){%9yyQ*Q9<(2BfIqm zd)TW%J4>Xdi>TyRErED4qsqqDlXNY1R#EcGN$EV;nlejQ zHMpBercyFoGi*w_^>N&;4F~29jIf)J(q3@;IHqIQB)|pZZvlHA&I-%9;8y?`y`|y= zv+2KyHkI?~^{5bPSPgdIuNdsO+tg9qcW$L=v=|y)3rC187X4r3R>Mg;N-d_{m1@3E zYcr{)j;IFNA`UqoJ5bGc@!7ARYPO{}%fw{#=ELM=34Fml_b1Qih>#qzZ4h^abg{;0 z0(8cy0hFYGgs2j}GI$>H%C1C79d;l)j9pEd8iWjj>of>%hA*+4&gS-(wlnhQBgQ<8 z1eIBAS$T~zCX34mQ1|hX_0|d+zrS5pNMKC#mDWHI#QS}^?9>9+JCwd*jqf^4m-#l^Bns!?`Q9)@^T5!BQg0BhLM}g2ISbaT=47lCdv~&pidbn=?71 z<)rj9-?~AG;8VuO<*befU{|7~$?0m_7#+a@E@cLLWfX!kyGNQwMTrNnmJk@eT$!MlYN$)*`L%oO=6IG1R#hZds_eIfSVJJS;)5D>}o$qI<|3(*5vxWRvih zb7T7q=H8VqKA_E+PLZH@h$vxb(NA^8(3mAI8YpVg1uJKAW;URL9+XH zr9li2w;ZQDCyT?kluSCZ1Sm%4ZoJDx>nzz`ShF`{X@7k#lf|ALLQ}e$q_`KvMhBGr&x}?m=M0c;sG8e~HiH|ftQ)*7xQV8Zb0L+l`}9p zkIm?mGuR)qO-+{fZB&$yoo|Y5vWjrz4Ge_?_^O2XesF#%{obp$UtR4uw%lct_2zXSImIoh!0BSdX z2Za)kZF^<4h|dAXsPeL!P|o$MTU!^VMAG2ls^jh6#YGwNTOK* zoQLq*Jc6FPBIsYx$gXq<%{Uu!2--chE@2YMcllf*n_Cn>I8ez6+$HAF}kVr%(a&bsDsa& z@rkjy3M20z3BlN0W5q|h7&Gk0?e%sRI#Ts2mIu5s;Bm1C<=nCyKZzV!t80Ag@>`b| zE`JgkxYyjjq`i0Z_RZV*51uPVP835YY{>qG(5eGJ4zz+b`M{bG8;6HIIY%m^dQSP| z%=-1C)fRI=ug{#+e%dDqGJ@Qgx`$!Su&tO`)qv{iXRDh&sC3Vn0eomx`GGD)QKth% zdq2e`mG;ifw{NaQdWxYh#F%<%p}R?rU(%{f!`|gRMsB-f6vv0hw&>Z}9prG-!68VF zy3eHF;--LXajqOdizL<75dYkHrztbq^sHe$nL1@3ZI%g*GK-gmT2(zcJeZIHfPyIJ zg?sR=y!ov+SHnk(;iK<*mM*>b;_Vk#q@zXuQ3eX;n4O62QNBczouup(Wv3~7f-)i* zWfU2rr77g+x{N^Xw34A3KMw)dX1SftXo;!AU!jkFo3d|Ewm{i;D5LYt7wcrI$ExeG>c-gTtmBwy)WVBs^h9Z^4Su1mP8i=?Z7{JY8`x@t7P1w9 z+}rYjrEfKW0X%3hNsjM?)?aZE52n1U^Wohr4^?ztk;8`T98qM7T!3HcS^gUXW=tgwqP`O4Ww3qm>`HKd(ep+8{5VPV7>@gsE2P(p#0Pf=+d8c`%2tJI z0C7LTX@9Yv_=#vN4vkhaqa?#W@j2$B~Bwj>)+ zPp<^Kiynv4^_k_K6Hxrv?ZjjW7+d&vK;-~I<3KUOh|0LxLJuohP?1pORR8RYI)|VV zozSrzhMca3A;->O6waASS%wY|4_rd@LlWgL(1)$k0@M%BuLS#x9!ET`2`CTxKFpac zaprk&p`Fw{Fr77SGw%ko|HCYnNz*SjZ3xJgJnQs$AJ=ktRGz;YzBKRVD=vcEVWB`5 z59Y$rXr|*vp+Pt+p2IP}f&NO5Lr%Fb(>7VE2!4UAfeGZUra+jQfV z#vKO}A3q~FWuyCYfX@g^9qXZFj+btr@h%f~SekU36kv=dmyJY6nWc)6encY;3kA=l zyFobj9YH8~9sBm~uy5E_*pqk1ed9h9eLNQky=4hsR)L1Ok1k;xhT`}$CHwI101?RS z?PhYo$@*=XV;<<1+pW;i>n)hZLZ|S;Q&kpL6kcGsFyXkV)x8-_ zzOJ%}AT=!(*@zi~ElbB1#e9B)@U;J>2T$H-|Re6@l zR6Ptp(#@ZoPOy1&4}18~o5!{ApZNTY=A?|VqfHdx`q?AYH_V^A*V6XRD{sH@PWD@Y z1$Vi_Vb5x$4}Zl--@VSBA7_7%z2*B}aKkG^`|taN`aO%@A8M<0y~}mIpSB(Tz`N4+ z*uuGQkKe6pwHxkrN(;~a>z;kLJa;4e7SkX19$$?-x*U0Qt-WiteGq@e_QAD12UhnC zf3#=#eeEYV@7(Locp=0RNW_Ui|O|Lc&EH@9_i}tKW4}BCp^zp!%52Gss=YAd? zwd&qK{`2UOjYeT_C!F`~hi*OcN8|U}y6CYnB((OdA3-e5{MT$gYjVhhXgI>u;8uWCsiF= zQgFi!^L!slg08uvEDY1L#b2W{(`aa$p zTdg^?TytnG99<1}e-!R6`n%VH4c|Xs4DKs>cnsr2tc4jK^lOx<8JJD@Wr{)@Q(mTw z6bT-Y>ZKA9H_Q+tn3M%l>viTUi!Ej0Xk2v;(id#WXXrB@*C&|j$#?Cmg6A4aKl~E)hl|r1zlXNk4 zWcH4BBo~2z6s-dUt}H0V_o&Cp{}&J<-$%NVku z!W^UU?Ze@0bd)#wv)ZCr^NgY?R85*SmZe!-Yd;3a!R34K>-`{ibUnBrJ1D6%*!C#nBU}8%`io4 zP$HR0DNDh5!^plG8@9%qHTFcNdp4bs4bx+-{NIp8=A5G$fcX;+r%BWnTVsd^>L6im zs}m~AWP-fp8u$qzDQIgYKjh}QI2U)t`M3~w$31;K$f@REs9UDjnT~?e6Vne|QX>KD zD>Q@+9;z5Qs!_Zg9}#x8Oc*+@e8`;ao6jsLeKS;*wZ4>crH@(~C1=%&>ai?Su46Q( z;mmzHO;+?KoMwlWSa#72BoemzDT##Hw&O@+mHjQii*D`w0r9#0o0zRP9^T-wJUPJ1 zyT0a4H+*jaF-h9$h;>o}Kll!AU4aS;uboVAW7t!bpw+&Rl^s)p^EFngIV}X{a+Gw! z)yp8p>YIQgIc3wsak!R_pQDOwDAJCtN^qMNP*IsSz@4>jbu22-0L(>$nC-)CKV(t9 z+-eFaZoI9@v`)iF(g2x`oA2uCqD@emL7cv%Rc2(z`mt>Uh&VcKX_;*LNp1c5L8*AK zw{Wm`J=|IhcNW5(cj_B&4E}QPSEp|_e^%eK-qe22=dSf{5Vy}yTVWt=glshGGrfs~ zCNJRm`V)zTOe&YgI-L9~IXP|j>`NqORjM0lRa3MKbk`&jsZ0_o&{F|W&>%8w0-T%A zq^JaIm<@>p-a0jzkPU;XGdV-i6A8Ay#R&?4sW!_{;q?=c{ful1yxY6sCv^>LLU=vc zye2fS2ll`I+kj*T{Lr~wx>VbGI)c3P`FkT1s zdR7m`!^XaN1L)xaQ#_kh9UWWx^CXqCS%ordq34oGMb~F@X$dWcb6s`7%rTm|qNc#A zD0D8PWfs(=Br{^k$Vf98W1hhy5P-Rm)9R9vlCH?>4{_l#Bv>wjQbTd{d!i4E{?5L$S2e3^T&43w1t&Vc^ zAQTojvg<|hzL*CqWV#KxVn}@mvSspsxZH;}FwHlOGnv^uhG=RGT=gN&nU8X0&c4GPx&Mp8O1YJqb(qk}=GH$kk16)y6Qw_LX z;q6up=Gjupyf>wF8j|z7NeEc$!3(>!t4Ka)~S!{ARqBe;uOWoa7r4cf&(!!@s!p#;98HR6NKZpnDMeJR z?Mmn9>?x$I6y$4fyq5PqR%ZVj3zDK-_7vWexb6;BlfSd7jhs!ZvgMCkn24VF4jes_ z(-lPCtMiJ+z%(l_g0q;CR9%t*2a`rLMu%`8RgyFX^xMtaN`=IhGf0bj`VNAt)W9WQ zTGfpo=?0zNQn^;k12Z&hmLe6gO0OZRg23GP1T$YQGtZT|SYrM;N zajH_Bb3&+YyC((LwUtb`#@tn;@VWaOW9VF0r7>Ss1AHP5U~&Sx2-%Z6*ADKU`o`Q< z_>|WAgp461SEWbf82w0=c9+EzMhPtK;QZ(}=KTL7Lw*M*3FKsa*At$?`^(bq`y1Ou zn$CIFk{9@#D@Jmzi-!rx@)P_Rdec=YE;#fhje|Kshg->|4$wA!)O87n ze54KL%<|4S&>Qq6Seil)m8HqLUZ)DBL+g}TVG4sFmL^IZbilk3Hn$1^pX`UrVmoS5 zGP97S3Sfz@UIBl~agQau!wA`kK{JYBfa?d*E6wOx@U!400DQgid4L>6o0m242Bnen z7bH1nWRBsCX$5ImIGj>ua&vPy)yyK;1j?$Vb#y-qYD%7A1vp7pZI{yts;zI^VTASL zEF#s1{1T*RfnO;zE6G=6HO&J2@)}m)#MY>slYuOR<>1>OY=UnSfZ#((L!hCgQ#yD@ z2^L8}hbxf)h%5O<^c)BnTqcM?(u#&5MluCj5`ic_(50y1Cl*UJ? zW%5;+G(B-W2#!l*({=HVShv!DZMJ>e<9LejGQe*&K4sV3z3U!k>T5c5gd77 zC3WNSTbJMOFN#NQiAQ#<)>nx1twkQc9XL_Bj#w0XZ;8DnYUpe4ym|hEOYdDOb`BOg z2X9M5TWgCv4QXgvIsdsdw28F$ z_?lqoUKrZmsb8J`?6HBhropxF&~+coUVC6gUE3$+z0!ZaY64ol4ut(FX}Q?w{j^oU z{ICb|Z9$0uB!CFqmIRfrbB*!grVk(W+*Uv$pvF-g%6valn8{?)dm7y|(Ce1t`+x}U zhE2?F)^A|(A;cI^Shly)j@tYM?Pt3^E!s|d3l^o7OxEsZoe>W^;PDi8#xFg7UP&u+ z_yS_zq6K(}l#=sG@-jTdWth*i9SZ1kF#clHMMqH*=wCw}tuO@(Ky=)O{m8*6tD~^; zWo429M1}+SM@hA9HC?Z7eE0O*rwjF6`9Rm_`@&`S#Bn{ooxd(3pAU%{S#(2j9~caw zzb?2ZIXtCFZnfSj%e(*yOZGcpaO+R-xxBXnvh%oLwN^4!a*lR4laATxAX7E=%5aQR zC4>I(QM(!006c`8D4D={E-EbbmJ|ZOb`G8p9;yqMfRCkG>&+Dnf&nkmQuk7*TLKuC zw2TCk9EnCfWo0pWXfl2HbbW!+429P+sM13)QMC_EarSDAWF~-}5Mp|z>iCM{(Ocrt zJM{-vj2qY9y0%u|kq>m-2{q=MkN&p*cfudU--~NKXNo-+3OyI{M=yS&Z%R#A^p}q~J*vyUFEpf@e zU}sdVX~CixyCuc|q|h9%>Yq89w%Y#A`J3SnTHb3}YduzMeWK9%M84%z{?zzGH0@gf z8Mq|i;_L-vui;jm*qO%{ddOBgSW#AaAYuv68C2f46^9D`-v(!F^=!+BTyT=y?&rVT zQ#??+PPmz|sjCq35#}&Gx#a7WtT%}#O)d&<9~uaZHzN2+AecM4Zb2ELQk z%61%ufy?A>NV1ONy?q}pejNTw+aKGCgU=TRpU)4B=f_{j2PQUnm;E>ny1|}9aPiS- zt%XKtnrJ6xhcWBI?0b-z-Ym@kWEqQ9J}R9;5;TttxhN_YMW~|45j!m=b?b?;2iq{~ zhM%rN_EWOy65QVV0eFVo@Dfkxo(rDU@VPs*fwfXwTdA$B)K)=v-wSd5{Rs|Si~9jY z5-WcYa8$tJ0@sd)*uLn F{{s|#LDv8P diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/streaming.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/streaming.cpython-314.pyc deleted file mode 100644 index e29640c37363fae4c034ddc24e8693cf1211d62f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22278 zcmd6P32XGr}&{bAy7IvD$aZnR`n0AWD} zaE^sohCR(fLZ8rU$QbGfHuQ-Z5m&L#*lWs|c$u-!+-u2LdaW6&TE~{LJuQSxefC~Q z#(^>+WbSkJx-zcbqD)b*JLBeMmOf9fH{rvLckZ^|I=ap^>$E zCOQshq9~}LjwB}Hkz|U78i^%_GI-z}l%iw!W+`(ho{7ey znJ5ZfyqCUAT#9Cr5(;d4qUrddWGp^1q)q_8h{}zy@IL^YW5-xV0GSw`F3*S|A!7^~ zfNrszjd(JqW9E<%cP6^qs`inwpwx^~%aT$nO06ihEh)93)Q(cel2SWL`9v=%b%d%z ze5$E*M94TpH6btB`qXqTUywektzD)O&ZR9CsCTm+^!u0atO@8}es-ArFYA zR`%*d6H;krqUnefO{L-zrkLz81_6&o zGiiEbgZyOsaB?)>ejLOw)*g#L+b$`j9Ze+`fg4hs$~Q>kV;K-!ds-S=^faOuYo8cQ zot2%Dh`JEsk%(No3_HQa&#N$)v>(|yc9)5!nt94D)#m6j-FcATF5od6Qb~+pMjwxR z+d>7_i-vr(3Ra~i+{-n~5xS^V9W|l(I>&Nm<|%pk`4^whx?5)4Ez{PP{D)|B z{z;K4HK6MWm$G_#ZgGxNnvgD+C5WpuP)d7>z!Qwn5Y*oLLc*8_hH*MBqnGJ(yQ`q@A!UNAn zN51xJF`Fvp8L~@ue#wtVL#hz~pPkG6Yy6*pmE3=RQbJhJ zWj-fuibpNlOT&w1ktDeQJ8IRQ9p!Q@-EA?LSqwB#&FWYUWY$KOV4Y$OO9-vvM6)*Y z2jgQWGs8>fK9D#ONMWZ1VFV|NG%^_B75iJw%9cTtAQ7&lMr5)*OjM)DYBr)KRZ!zB zP&O-#)5NXT29zB}>o}r3lLN~autqXU4Pw>l{m6)DjJAro(#ng+E*#62uA3=cmn{v> zlm@5UADJzEbn>zH8d|=&<@~eX=$v+Lz8pjL(JfEaxBI5uYws|@Rv{Oc=R{mTPSbYs zLfbC(efuul^yJ)@6rg)VA?@^V8_%}epya% zD#LdzggGWw-nlw;(m9DQBmzJ^YFUs5hb6f?x92gUu>^GqKBy$A$QJgY;qkFkku>xIPQc2(s3;Md`2W=Lvzd7M*s2pq zAE(Q7HdA1pA-mk2qsw&Xhu`8Zbro;_U@ofc68P^1OUl;CyF= z$sEvmhSrL)JohMKZt#U?(Bm25oOsY=2dShCVZ%1#8Fo&nV+Xv9S=d2mkIT;n*?=wI zhX!d1%|7Y}?^pVroyMiMiJVgfmFb8FlFvfH&=dfOU3}*XMAHF2O#wck z>EOqW-CP%N-ZP2Q`sElEkWia%1MtPlTFH- zXdc$8%uMR02P+76i~8bJ@(k+z1~Yxz;ePqymmi*d_?EABx~^x|w|CmPH)k~30&{hZ z3cc@~soQzA>SkTfT_(7ybCjKr&z1SV<(L-%&(!rmJ}fT3xct>yGADv&L z-`;T6{eIyHUiU)n9=q_GzpIV?z}V$BTw_9)%Y01`2{zhLe9a{g>=p?27NhpHH9}Xj z@miCG;I@)I7V$b0_K4Q&f|+28i1Pj={LzdT0U^S|8URGd_tNG%N(>Ck|oW$qJ;cN~sI@)mELf2RF)MvnvaPs!Ba5 zZ8hc>nnZiOv=>?0hzzQ!A~{GT2+P&WHTH|q}F zYqcF(b+t+K*3Y&oq&{@9>V7kbN;-uX5rre;6i!#7a9lZs<9Z(o|KopN8;=+^G~>%C z#UNNh;MF&ru$UKXwN;|m^-dqlyFu#5t#U_})!?a0*vPs>` zVsSD{th~--BX75Kp^;JK-n$xaz-jSMQ18Ag&4PWcw&B&$S4Ok7J7#KWrPX%dWky$B zju?Vq=y@=R@a z&bi9QmsU2uZibC-PXji-Jto@t_K39c5o~+}#n(jv@O6_wu%#HauU83sYK+(Y7J?f} z_Usm~Zx{AFWWBz_Oz>_I<)3g^eo-pJ9`>x}o2QM;%(H`SP|!JRv0>09V0E zU)QtV59>Vr+p6yTb!-rG6JYC^##K&2RIg?UxO-|K%F;iop{UPLx1o?L2`V-;VbZX; zJIInUgNv94AUGGML0xIDW5amYQSdD#p%1J(MNJ>pmGmVX!Z>l|aP--@s(_JqMw5SI z2?-9Gk+XqJG7t?ARR!(#F6m^t!yZ7=$*dzV0AdTA9*#?Ks+*?nNV%gLylP$}>IfW$ zUKB{4P`7WY55+Imep-TTY`2HFT~>WV|M=)}2L)J zf2%#u!enDI6(3XNXcK>pEJE#pcgtIPK5?le>s@=(yY_PZTw`;#am!5OmMi;jHa-FiwRdBVvZOaMR5 zxzOnM>9667UI=u1h3}N?sbYWQ+haCevl+WO%%m6Wv|lR{3HCNq`A&i04uRlZR#d-k zG@#{mvtv)W?Yh@UC8fNiTqL;4-CZPJU+3Mk%W%C@Ab6Lf+irT(VgUT6O(58AB)CXK zKTB9E>B?B159}^b7-tBrR^^`HetC{hcmrVSk@Jnz;JrQq13)jN`0r3A)QC}i= z02P{&4j!sYM*1jq9?MnnMYZc#BXPZI{8<8@LXBU-hs25Q5EwxqIx?bjAlO!ufzkMA zQaT$9JOK~#=>!#smj%G{yy&Ldz1l z1f#JC##sK z$4Y8{f4Qd3?UFClcI_5ktLds^|4Hcb8~?Ki=$fGzh1W`jt{U^TG84gmfy!$Hg6m4U zI>c*Rgs$z@Yg^3(cZewebPM5i#c#$Jf^2*sR|H9Jy6w?OD*@S5j9-?o1W=W-5?%uE zAS>Zy8<)*jwms@H13FXFB8nFl%K&6df@@Q&#$B7_-ULm%RWnglH(4ZCGFJxs2N#QGeU1!U0)1(=^u(8W1{FTsUF#fd%kTxE2$#O-wRrn1=0=Q(P6pH#=i^%~y z79AyzvON+RO~%F{E=I`L{H5{ei2B4G!Nw(}GbD+RCGpr2iNumak%&aT71^4Su&GL! zv)u0}K~7=PM#{+8s%*X81RbP|WPORYI4MC{4>Gwl5+ToIVki>LWTeFLahOBVIk{pv zaVRcWl654?%JG-Jfb6U6U1R%)M!2+dc4jWRV}L7mK?IZ|2>Q5E)})s;>17Y;We=%k z@V=;JfN~zS?GC-(j=NTyDR8$8)||UlPEFc2?c4!Hm$`U0>eBShxLHj=oHX|BUBQ}ybRL^|_SL9~%xv|Rjf)&t=#5mO;NmtYQ__)vF{1{D&2bOaJ@UmdeM{ln1sSDzqOBq%q%22u zBTd+J6m68GsjHgm7emk0Y|xal95RPZaXt>Z%PVXHC0g73wf-J1wn4+7xcsZyS=d6% zWrsRq;3GeF5qC?*-fEJC_Ws8P;kEc9ypfZw!p@1@WY3A@$Vl>ZM2aiQV7k?T*clLR zBBj(P%~^~r>#~+>na!w zEf3zQMD#7&X*t8hAw@^iL>_C`uA!tFarq8aa}N?$!izZhej6=e!!2Qz^{={LabFf^ zE7~TFFS%|7wqE%{cH7?RZF}F?JR5jy(sEK+TX|m@Z zoHZz{s-4__%UwCO=DUupyX}U%?RHK51^b-0^oF+{;CcHm{ei5%?S{Wil>_H0>hS+n z*Ocqh=DE_k+x1O%T$bvh$)1-EVo}s99p|Maji5iB;&PUdcc0}h{YzB%JN&7kEU;6X zO6Dn>ZrIMR`H`R&Pc)LR(4r*%smW`Nj3lPlg??opUyDbJf@w(Fh=Ks%0gK3W_n027 z0v`@-q9hj0xr-+qzvZU-7ev!i5mx06!a@rw--mx2u6!~60_2Q|2HJY{hZ(9AoO_KrZg_1hqUkf$HiRjKw(8i^L*Aevez$gzc#3|y8It%_mS!oNT>9m9YNlg_W3{$NT5-zT_Q zVdZLtVIr7UE5^rQJRdnr#y1}Sr*KM&kvI)o+37KOoP!i>If;QvWL3G3rr}?4?i6P; zM;A<$nzEX8ROA1&qnh-MwhL`pU(<}QY1Y@AbvEB{HqVR9S@W*5S)J33yP;=v8vok1 z8xgPy^ObGSq$%zhAgDd*;(hlD0C z2O$@&n=d9%A!j0CO2jxg>!UD_zr}8PKXP_LL?F&2S`mVNZ}%AXx1IX z_mBoCsJI}7Y#P2&o{&9k3pr@xge8t*j|egu5o$0uy^H=YBN%3c}x`_YFfF) z09bZm3VTCEA-6UM%lkS?2H8=+w$t~1ixAwBBr&+8z>5rrvc!yFyXDc z3A?F^!D1c1Sb0#>idX&4f_EO>rS(4WumRGTQj!8vK=uku{KwZlcaOC*py{tTSFcKhBl(b3dMTygDw@rz$nPAl;@ zDi~K>FIeAhC>x}6z>TL;3r_}j>*u1hDM@k7^6{cPseHEab7PyVH(ez*sycL zgVSi*X~K5ub;8-b=%fSeD3>rMStLUsNvE%tBlW?b4bs6f1+$6s zkZ^DmQD~Ee4j9cnthJHbTM+J!8i|x_B%`N9OjkAzC2>^D&gmu+8y`){<|KD(OMgL+ zP4KIare(`;G)<;<>EH4~st2Dp4~&d+l|ptMA5VO3#rBNAsFcCSl3vL zpMsNJC!{11fO4`^@d6A}i(`~w7i5x!GBS)S%F2s?WRG^%QggjaHY)b<-nca=qFQrh zXGozgC4Lr?7+Is}rAoCpo#bq-RIEjp@Kl1(sNhukGlKq{GA`#6vN4sJsFdNo%Wjo$ zBkEexkq6VPf;8cjEIcdQK@!mseyWqBO?sVrvZ$@)VwEc6v4~D=+~uO2hqLn`D!P$N zfmKqFed;uiozzh%3-L4whX^9zrYxfRB}qNnuypCkja|eJ4{PgMG4>X$&$rQSnoOvq zuICykjy}6}?{_ywG#L>sCeGCE-$Mwxaz;Mf;VmEBy#3 zKyZWbb>q9$!JLV?%Hb}oDq3(dSHW&3B!_P@Pjw(Ria zzPaF|laEjJ&p6j(Fy;P>BNs-pWgBP8HqMp9a#v0{S=?ZXX62g}n7O>@#eJ|jH?~bX z>!{-u>X)`GsXw_7hPjf8No&rq-sZdQF3!4@Lq+Xbcl)%veXhPKTfcp#etWk5;hFk} zubzI}_+OmwIA`mh$oikSV1;+YoaGv$yj0y3OAYz8;)i*O6V*asJS) z@~Wxbv*oRqpSoGT^SzyWFFpCaW3L_iZshH)Q}#PnR^FT~+j^sH>y;<3o_V`!wrp_P zGkC|$8n#^7dG*QJ`p2f7wK;>)wRx_rW!BR|sB6uZwa=8b&z5bQj@{%E?arJ#r3{nA~MbvMnp zo9-~tw(UK4`CM7;#pH$LY*};G(>&v8Mxc7ux9Ns&)0O&J-_~j8*5BQtCiOFJyh5~X zxmT0+8@~1{!mMvIPT`g=@uK0xs7}{C#fo z^{r;gJG!=@=&hiCzmxsY-b(ovp|8~V!>vt#|GrY_D>wdqRS@uxY{h+k_M>W{uhRIV z8b84g`H;WuSc9i;Z#4A<+1uNS0l#Av`r3@|*o*|btmyxpQi0%do}*7cd&lqSYZc#F zYoPKLf#6nNKUlKgCjQtU>^E6|ESd?niKz2qXX&8|@yGT41ITv?`yVm?csId6sVGDF zPuc~_H~J4Yi$8S;2aC)sFb( z*SvaVeWH<;vRYlIl!6LH5xH;%y z_U3snflKW$KnqT!06k=fxePH@x5MD=g()N)DGr-Lh8;%b38EN99>u8pY4-`CB@v1# zGb|?PwJ@bDh>o;|jIceJ1}!0TIR7IK7!fp33-muRWDUdIow6;7qBOwXp!T>z6r~;S zqm8>Dg^il#vSJja1GX31$O}@~p|yf_#=0nqQZHW;MQJ_qV#vsCANtpv~3ld+>N zt@9&aYg=R&3fZ-|q2l{TV;&NfSj<72rtu!y0WFfu zm^?uz1EK11nbwpOahc8m-IAo$V{A~55m)0fOSET;b=|x+r0J{_Kbnsq-G|>QSatwP zjVWFJOw(bPN12B7C{wO=IigoV20gGY!$*ywyDENo0Cp4XFq6p7Mb)4GsF2CdQQC zcz}YXs3IGbAXF{Fa-F6lFi1BF2IzDk+4oP4k$Jy` z1lxe7M;zqGVHGWB1F1e7_fQeFSwQ5?5FBav5tKm7#^A;cn}Qo#`GHE_Kku6NtBygF z(iiD}A?+twK9%~XVT;GMwluWUoTe4!FF27%kt#Sslg)3qBB*}^9}-PcN`kiCa-u;a zz<4b1Wv$jz%}XL}n~y!O;JzWR`N<-5PQ)~kipBShe(5+s*|7-WJW7e6MWcyO*%v8`B5QRi$_L-r@_QQJ&iGD7 zt6iF=j1SGFeI9=P0<<+m5B5?<-KL4XDY8Fd2T76lT}yB+H>@b`FR8Paw!O!ZacTci z0YYoGcht{(bS~C;na4&nvb}x$vHjeZr;WOvU#1 z{A*w7ytT7)F0kR}fzGRk7evEDwNr;KubZvjHopPGoUcV+Gw4`kW$W=y{GTpe_i?U* zm9M$!Y5eGy#nlK`c9nhLsYKAFw{ote>|)=AzNy5`5)y8`WfZPlQOD(0`19vH2v;G| z72(RRvXAdRq~Rowoji(upC&cxh5Efd;X6XNX#K7T=zEPl+f3ISCEe?d*Xn%TKHIfT z#%_!K+BTuvRCH~-Nbo~JlwWTvNB*WLpwXKq0p)L61S+xF(DqHAqr1WNW{r#BbprZ) zbG^H#&hlobx5s6E%P9bU%jM|t+uo`$5L_h?>^BlzC!+pa4G#4D)&`+xqw%evh2U-G zy>8oEokGvUMQ`o01OB1KK)KC^r%S{;(yg)2K9CEYi+9|GZdJs(KSE>0BWKDaPa&+{ zdWTyXf#MJTgvgdGwIr?COg#dfZSE0xND%>;Klsut9JI3HvYd^Bc4n`g zcM!N#E<;BU0vLm&;8Mj__=k^ePIi%uwf%0eV=X@!r~sm2sb)@$e^74c`Z2|;#(5A8hFSmRg=P$&e0>bm!6(Sde_MwN_*1hlc zo!>d*?tZQPO4Dq^&S`h|)yHr%BAALCznm$^*%NeyJ2c5nshATZ5Bkd>8H=4=Gn zS!rF)K@d)SmE~Ln6%jGH0V$}UF=&aTTTV;lP&r3GxTesOc?m6<>)DY;$jVqvlt4`; zotn0)|>?QtcEmYAYls>o|UYjlz|&&%g6-vH0Sau!5CF_#!xMmYZsW5Q{{JmLHr1=4?|jMEG~Pn(f}1L-Wt zt*{pAFhXyV*W8Bz>9sBsa_i9*2*<~4YgG2L|Fzc3y|WFEOuP5Lv37=9`bvXjq^^5(v@urD~}{%vP%Wi@ge*!m~2YJq8|VB%;-PTHxKY{ zzRP^XjF541!WGm+RtJKt1lb6(vkHICL6DPqs&X!Ziip141i|)DJMRUgpok_$OSGI; zVoR1K)MX*+IVtI*fuL_M3efNbC=M!Q^eB)tN;`IX9w5gPq!RhJRq z0)~x9&pZMCPZUW1i?SSL^OSK?q?&4o=VD^4<;0jII^3+rl|~kgP2O^E+Pr6@|3K5W z1@8l?mNDCQjmMci_V>MQbDqjeqmW2_ML82nFlFx2c?UtvtTH+{cfLjgpQMcM@|^I# zid+03mhH(6;Nu&>$orMhJfHL>swh#GrYu9*IAwK|ou}*~Wj&P9o}y?fHv!2G?xj+^ zo6;?M_DjnCJ7sq$J55=^c?vFxQT9#zrTzF|I#1D=Gg1h)mDR7+g0|NMwV>^-JGG$g zP204f?Y50~DQNq{g92hiKQtqn@k28L?tl|>WzN9kmh7x`gC675wo#99YH8DBoYn>Z ziN`q6aSN^483pDhH>C>>I+?#tx5=R$x5=sPc!h%oX7=7OkQ_+G-W&&WWdQ%lfDK(O zq)on-*Cb}G7IGF|!E0iT@xnU>ZM8{+t=1YoEfm0d04Gy1M!xw~i*`vQ=4IePaFW9>GSknj0`72iQ9_yK5J@2vIzhJGuV9mc4J-;w+_?5BY Yu6aTbaH@;)yAxu@DA*Sm<@{y;7ggnyG5`Po diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/testing.cpython-314.pyc b/reflectapi-python-runtime/src/reflectapi_runtime/__pycache__/testing.cpython-314.pyc deleted file mode 100644 index 478359ee0fed5876cf0b7fe54ba0db97e1b8cd5b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 21658 zcmdUXdvF`andb~%#FGG@5MLtr5J^ZRsQ1&BEz7n@%c5yW3ptTwEChfeVhUsiL))a2 znDOqVnAGlC&Tg>=yTZ-91yARGHb_-6~aAIoVrR=e@eCBTUMGXO)V!;;X&XJ&Fva z(9s`P_xrkM1_Ou`r6hY-*Ccv+db)eM`|JMRJv+)hP61)yKmGgEHxCKI&*(-AHl7ey zWl<2Ogs>nBFA8C?U+go z!WCgtxH4STYYtcAX^meP@r{_|dRD#`Iexu-1IycjygEIvv4KWV-`~`?Rc>aZZ0Ha4 zwa6{aLbwqno2WgxHEe1V0>Xthn~-qPsPS|wo;LHRO_}!Q^`zVXjBS>lS3oPxO{A|KQK5U509n;@sU(AEoVYOQE|o6=}|c*r$*D6 z0o+>#WAbp&ta#3RVeqNw@xG^ypX?tvp_q@QCzP@?6JyCpObVJ5$Fa;rI(}+2{*vN2 z6}yyTNmO?{5z8b`jV6*KDCFgZQi;S!@|BpBRLW0NCH)>nT*t;z;bdkEZ%--}XQWsf zX-Phnlw*mQ98<(IaX#%lR$(Bn9>x8Xa6ynotTfY$HL^J@%9gMRvtwqnV+~u7wz9M> zY(u(?rOU!tYhg#55OgY)$77jHQkIj2E=~TjkYm)A88&okQd4IDsVwP)-CADfC1hnFz?k(&+f5VO*2O7sQ8SsdRVX za_lAQo!)CF^_u#8F&2L*kV(cak0di0HWrypHo%gWL(Vwu4t0kJG|Si*;%XzC<%sa2 z>EQ1RLIQb>!t>&=7#72(Ua?KMYW_KuRlIR^BBOj|DdolEyDDI5*svBa$K(vXrB#Xa z4v$_=_Fj}yv2<@D`EswsS7~f4Wk~jnu?5>Bji==lif5#_;b~OM#l z1>_cx?STBS-0#cKPBXwL!a0i zC4xi|j0oQ{7`3xv>%%B)4qL+3u&vjO^=XOl9FPRlJdBezFV$U;Tu+}MT0?6^5eq6$_6Rb;a;jo6rcyZgKL7# z+PXqf-rv4#rt7Z9+4YvgzhcEbA0x)32TJ4TQRh2iY7ru$hQ~1?@$MepLv17Kn?qZV zg^kdwZGsT%^;NUfg4U%Din=j#t$>-=}2AB7eU^?y|H(SiSR*wE zD_f$d2ER-LqHhQ*CacwcryL~vjtvB4%?IqoP#dpDrQ`VNLB&w_aF54-E$-3JxZ8Wz z!sJs0X5(R4$XGECSw!ur=fF^#b7T^+CikNUO8W-gF5-)xrdDW@IWaJzcC{-TF+tK+ zsznP$3Lr8vKMe3nVB`05=7+tTh!uY~v5WMh@ar-?1yagrz2akiFmN~zNJ|INhkpDF zJWUtzG+ioB)0N+KjCh(Zm8a?ALm<{d3zYsn;%P!iv_hf-JuTvEPC#n@5=y-)PMM#z zI>A?#3C~*gnIYksq#jfn;9G<07cnhtODS77nqJPfu-+3V`g6P(j7x3v%qxpEojGsk zg1s~A?fg~7jfZczYs5bit1NF?Ys8{;_*(z~;or#$&dBh-G7;z@An-hmoEFHGuttnb z2{-fD18_480?SxdDg+*$qdD*(98D=K|G(vM{;!YL!0`}Yvp&aT-jL(57&#v7pC9Ab z&-Rd2+KZJlAnije?WYK16QqL_9Ya(?{W*#1+-OskkbSl?{~oQ-?pl}dH?_Tc?wxaU z{>7$UIsdNTKJDMOUr?dqu>YagZ2hFQMxLH1QN2$1g*Y<2Qs) zEzjMts8qeHl&VwNIDUH2sd@xi2A$Bz!%%hTha5~lWapYemUe{QvNP;~q*<;wN!P^% zugMdXR+VUs!mIiR@X;|DN}0>4c!ud`7$Z9rizfr4LxD@lG`LzB%rlqfGNB^W`oJU} zqALmV3}Gskfl;(dbGm^XuJ{WbFCy`ysFR_F2#cDm`&THMX=j%L<;8OrbgJKq+bN+J z0#{mnBnTn8(`YnPg)lCFG=Sg^<1ZChYsJGf3{hyuXH_;!gL2*LBe^2s-iw~ zwt)4QD_-)wyQVEm_Qw34ebbgt?Dd82YMrp4RnSmzHGl+3tm|p8NITLC4QkNJH6s?{ zTorRhmN+pYIpBU%D@9QtLqF1W&@@`C+gB)>H80a;&dlz3_ta&IlB{c7pnjQEJnJLI zqBI=BU=kqJjly{hg$Kf26xJ7aBVxyWo^?|%)j-OV$<{E_>I7l|0uo!uvGhcM3r+#j z1cktI#85@DBSM;hB@H1mvUQ3p8odO4Etq$3`L#u$)AQLh?Ly5d;g-vr^Y6&|cPzPf z+zjsiUc>a0T>P1>&bmAD-m09pE$eNYee#AkxL^<73*3ihLawT+FBcyglU<}sG?phQ zVsK{4lo#ptKAVX_d;*0sG!q=+L4t8`jzK&)pCP~pugNTvcU=b_s?e)&?^zAA`sV>+ z9wMf&ctE`yGoRhLo;HPp_dK=1!dWq5)+`mU4A4q8Pi{Y*gsjaWstLIqw1Lc6GM*Yr z#Z?H0u8NAAEB2xnL%RNyO$dD!Qf#M>Q!o$11bO+oh0 zXe^{@=fn$p&}0oRv@#-Qz!)gNg4#9D>VDi3Iam+h4jMPAT2aHd3}3dNz}6zOi%PwS zr~^qF5hhG(Cg~z7E0*}^*n|{E(m>r59}r>@1ymXg(_Q+Ijgpk>K$?UWTe9AkoVO$E z?O617EvP$0eIWz%K+q+fKzXT;B9ir_XDB*JQ7c6$ie!ptFG^pd=vj&g>oJ&eb;~)r zrHFP=rVSCXWzXNSfJwMx2W`9K2A*Tlnj3S^0Kn^0EyYDDo$*XG4pX2~Hk^zlU>j3x zFycUqcj?dGq41-}iWnf$umS|)YBv)1quFH92*ZvSc7&b1R)EIE>9>_(F{vEYr71*; z8T^;@b)+V13JVOY>_Xrx0me7IL8YuiBcm~yk^ISWgE{itnftFp;#I$eU*-`+v=03u zlmUqHF88t-S19KyYnIC>Wf#iZmK~IG3ZBYk7p2^St$M|SRADQjA({e6{OoF7{U1n7 zaYMQ=W-0Ii5zC+jk4i$=q>~Wq*_t%9!~#ka0WS$H!Wq*Mu~W^xgwkYS?iDmuam1R| zNlioyn-7Bd;wHeb<&+q<;yEE?7S4OMR78we2MLrVA!3dIYzNd{kJ-*wXa&yNG*v!8 zSvJ{mTuOpV4yZKD01zXq9fGM1T4SPUS3n*V({m>kE7SZ2Ee!Y!?h*sATZ)mAm@AHh z4#mop4~*0)_OP1IS4>$SU#YCN;z3U`qv`0_umr2NL`rzcjR>Z+->38xMYO)yd!#=^ zO7ReJ)ZeDq!E!K5c7|Zu(ca!3(DcexaW>E>ES`FK>5oy0Eh^%!r-W6XV6C`q6Kb~3 z?tAa(caJVr@18o95A0a7H02vx-aYkar{+4}@0shF4=*+zoI15+smpKQcg?)C{m6IQ zulp&Z`7`K>tDEz_rkrnE*0(M1t;yH4-ga1hwyD0`<$~LPWqi@qxnSw!%Mh>CgSvpk z)gL3vAX)u|Dp_qQ*xN@$*?PfNu(@l9Q!YcUZhhBt?P0qvabXuD?P3y_Gt4|NSlV^L z9cG>vbf?$!AlHZT6-Bw_;Y#FHv3lNuM~3VR*UA-PKNePpk{Vb2b89%a z>}N{s`efJ8jLSvH>Y-T?&HU=oOq0n4Bv--~^)@5Fwrm7AxAOZFzt5wCxYvKzGxg-*B>}KgTOJoz@=} z`mrWhNh^(L_KVAOnIB+x_nFowQJZ+4`%mlrSX9`-`LwsJGws?2;S;aewRj6brAmYrH_ZDo&Uq?XbR2xb} zn8K#OIISycXe`zdF)EIm#?4VdqiEzwEkZLBpQVjJT{xa4ALK!P(2LIle?eAGAVcg7}0QGNE*GOAL1%^^1 z$q+341#>=J49hq&wqhramV)+vIEX6{LP%%RclKuq-rJ`p=98xUg49FLx z%05ZoM+v2=1SJ$Nfx>#eI`I30=idRfbhB`t_6-Z`i_~GWwhq@_>AFy|p1=SfT?<+ze!C)`r$WvVmiqBdIA|{|(Yy;i@XzJQ?&=N7hPX$tEaz%2o>(CT`i?IeUH9UZ1nKWbG|E7<}!W z^OkEeOutL^CqMI4Txri$wr4BbXX81~_9f5ux!6s&@6G;i_1~&)oqaOb{#dsCv3zyY z%=og^Tu}+BwxTlc-*U%O<|$t@3*|dd3;!Q`w%=uD+c8)M#Rv40EzpF`Udqp zv*Ayc7X*3I6g{A#p4grn_~~qq+uBL{rE_lUGF`46XLt9~XSJiARm*+oLRdWbiY^)h zTVmC&v!4ojTRhisGCHLOjV2uYw`dEi9%_Gw_6++7@24;f_IbV9>%Y^e@*gurgd^g5 zJ$q5?Cec<6KJGutKXdb=H$!^S?{(5`?kUu9(ppR|4hBvYywF{HB2Cs zekNX2>-B$9C;2PagsoQR3PsG}imp44 zE}L;>nhacduL%ceffxw3fb$r~MhjSHe^Ig#4p?p6ot9u%62fK!A{W;~#Tu#(TM7sq zjw;TQhH$HwwBq?XjE>f;#8&Fn`eg=n&1<23t{&IeH0Wx@Udxy{?0~r7E0oewMg25w z(ofTR{oK3{Vdr_`SXls3afV$QqlTUln^&zpEnElvg|wCmyCdeXCjzs*Hg{nB0Igv8 zWOtY;hv0x*q{G8;5!F-KKqNu~(qm{+dYq!KBT~xZqmWY4@?Gn=Jk)cLPDx<5#goLj zCCQ;UBTZ4^D^yrLHb9Fx=w`@@H+P9jJWeGn#HMi7@F#R{OQ3VmI!)0{8AuLURvDA0 z*kWUlfD#~jEqKWH3bjnOS?1RqWe1_4i{|5Cx20Z6N2o$e$wue2)~NhqTj}pnmU$=n zs&n1|{ujJ~Pu;}Ld1|g)dOQ7AI`6LdlRZ~nAs6MvscZW*qv?cUiA0i{>rO4e`nU;ne&IT{?Obj*CrPHp+$dx-rew>v$HSEy?))a z*mQi^VXbpcdzQ-uhbL!m%i7y=_U&2w_FFi2@kriRKXVEUsi*vxW~)QR0EDyXN5O(0 z!&?C)?uWNZxlM^SAU6!v6rX(23`m=i3J?0goRvvdYqeIdP&9XWnJx>D{|>w5D9eay zNPECg*0+)S;3x|S!q^HLp)h88P=v+26Lp!4*QVGfJS9F&E#bUG*kt4f$6y2sn~gaU z)4>-6fg6)f;usU27jcjgv*CFUp5uIyu|5n#x<=!?juO}N|AR3}1@Kr|1ol8XFubclokx2cnz zSlL#Bq}M;*!tjP4>sz(_H|M;~3*KguLFxkUZhdF#botHNx|z;*cf7M>v9@E{1?=4z z$TjT0(XfB|WWIU(+@TxI`xe}dw|s%wEjN7I=hC0}9?4g?&;HJh>K${heNufGd~-|p z+%q=<2d;Qv!D!k3{qgs|cJ*sZfumPE`R+s4dTw<0UGXgWf;YQ*-uL{KXa4f_{u}!T z7Q3FK+->=;ee}y}?5gHGy>;%8haAwfPL_{tulERP?RA$IwIz}94J`=3Gze9xLijP3) z%^}Rp3`}BW+C}Masm=dLP_x6)cPuH%6P((!rARbaBA80gQdCP(BSrApQ%x~7Nc{zV znMp+CK=I_71?INpYQa`<+XQ>dsu`(eN@0wY2V;Snht!>N(pujshhpzeBh(bjje@QG zwh7`Il__7Q6adfjy7auRJ9cowYmbW>!QtJa&cyN414s-7k=giSSZdmFY8<6DhfO$6 zjib~NVUI{=-4Qzuq+97gHJNjfwp}QrBh_TcHJE4Z$b};(JZT?PPJwbGY-LAd zZK?xkOuCd|?tqHzB^+4C%>#)kN@K}*iY&4FFgD%2%xi615fIJ5y$qK*xR>EF58)9P z&IzEn9*7eF1#qnX0*OaN@B*em<8!rO79be^F>DA*oO<1FUy z`UHXOQJ@f}CqxVBSaH%aAe`6fBECxyB+;Z$LyKRoPo9>Elp7_|^IFnd# z_skA0xqCjp>D_W$usGV*=p^5Jwwu11x5~1<0C3+g%tA}&xA!iW;pyEBaSA{19Wx6b zm@AL%H-AuDM)B5iiuZ|#i%bqQ8f@87qxu?Df~Cu5!=h~RwxMa&J{8Eh z0t>DHI}h5Db+_c)y;*nfC+=NjZTbyQmRk&n&H!oJ1_lRcB4Qiq4hh_+2;5z)$7^sX zIYM3~M{fCBmf=Nm1a!TscDamFcERacaUgXs@Cl`X#rLfCv1ZOA=3zZx8jPLhv%ABp ze><6mV9GT2!s~z#6F_X8++S+;W`{8}w;l~r+)7!1d5E7zwqJyUR}_35Kbdy8x0h&7 zXk-*#@LV5g;?5PMbAyN3d${mfWD`i*3)Qu@TeZ>DYRbAO*+mPhqoZ_ntY7X~n&@3< z7VahGLPIcDzbjk6Yrbc({_$yVzI_j5c9?KJ^;TxRhZh=q7rck(_fyh-xIjeE1PjE8 zGGxF3xA9>J)v?mni(~NMgiDZu3GH#O`G;IIFVI+aqZ1?qZ?W#A^LjhkqQO;NG?cQ_ z@^MhgNz2ED6dw#auLphkd;_h*F-d>0$?~y8%Ii8TLDs)Ao+%paNaMY~O#!|S#T}yY!Y!=R*=9}*9@vw~~H}X({owY22 z@4rOM>gIDy?%iPXk-L`unSl~?8&aHw59AOjracH!%m|s*9|HXzB4m#v!4GSm5uV0= z8^ecxpzzSj8LnhJcvYCf2c}K}ooPZVKR~Nk*-1V~223n~3D*?b37q&PavQy zA46Ha+4|mj&tm=2X)m^UZR6WteCvy|?zxMLHM^#rkU8B|SN6=fU{d?o)&73f_o`q) z>2ciw#}x;Go=)wVl-K@l2hJAAEovGtj(yZN)$z4Ot<)~6QS z&A058IeT5!UN_US(6n>OzAN7xoc;>VnCPhU9|(2!&h#yKd*^IOE!cY*veBsjFEJ1( zcTdpV5v5w!oBn^(ga1yEnE+Bn5eb7h=EfPzcyeSU8pUe6i`)zz3y*UK^M6q#ib(Rw zJc`8Us(c7JfXM`R+QB;k6OvR2LaIuIL|nP_2<*u6ereM1Bx?@}Yw{_D2lXX<{|k5J zr;{-$K75+zP5j1eqT(X!-3TAwU9Sx8`kemJFK&>ZtSf$}@%jBYj5!jP-k*~oggK)j&XkD@5TA*<#$O7RB{H&`_AVIQhSX5gtAq@%RHiLp^=vNEt@sxv#Go~Rm}NW}1ADx9dIDJeeBX~By?K_89oh-R_aaGApa4qW)W>hpvI&1(aVf{;H6 zpr^(41ki|X%W4z&*-tDy-YFc)NWp@U#KvNytD|lZu2p3%#dUE!HG)sP&=e}$HyMzj zEE^Buw$JgEtg5ZKs-A3B&)m>r74%-*qnXfqMpkUBQU)EMcS`}S14AmSRWLUA&ceh=wbWQEBBiE~8!F6`MEYSi4N@ni2(z*c z%qWave*`-UALcnK_2Mc1h0Ko;Et^GA{8ZTgUxn7639g?ATYf5pvO);)&jj~Bntea9 zwEm-T;HSdgf3UcwkN@7YQ{rvg4zYG->umv-+vmj&+>G89a9InB4I&T+qUA^EL=*J7 z(A-kW4qb|N-l=BG8l87q+k4U^!T?6`+Ih=S5pn>cSB6zf1=XrS&C)br|Or+mR_^uGKkV#RuS(@MrSgwrSvW8Ns<))lpN9BY} z2q*}5Wq$*zwgPGaPsOf&v;;`ARjAuFEK|$Z7Nt0NRhYp1_~BGeV!ZoL49o6k5L zMl&Y}_%vY0hehi=<FOlRYxa@VVF{q9P3%62PMaA?I4iSrGEylk3Ucb8skKp-EfOCI&llSyD`9 zku%q^jf&AYJ~(M!XqwXdfnN~Z PE-s_^@#FubUR?G+Zz^zH diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index aeab313d..7e495c45 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -19,88 +19,6 @@ fn sanitize_for_string_literal(text: &str) -> String { .replace('\r', "\\r") } -/// Information needed to generate a factory class later -#[derive(Clone, Debug)] -struct FactoryInfo { - enum_def: reflectapi_schema::Enum, - enum_name: String, - union_members: Vec, - is_internally_tagged: bool, -} - -/// Convert a dotted Python type reference to a valid Python identifier -/// for use as a class name (e.g., for factory classes at the top level). -/// -/// Example: `"reflectapi_demo.tests.serde.OfferKind"` → `"reflectapi_demo_tests_serde_OfferKindFactory"` -fn dotted_to_flat_identifier(dotted: &str, suffix: &str) -> String { - format!("{}{}", dotted.replace('.', "_"), suffix) -} - -/// Compute the dotted namespace prefix for a Rust qualified name. -/// -/// For `"a::b::Leaf"` returns `"a.b."`. For a single-segment name returns `""`. -fn namespace_prefix_for(original_name: &str) -> String { - let parts: Vec<&str> = original_name.split("::").collect(); - if parts.len() <= 1 { - return String::new(); - } - let ns_parts = &parts[..parts.len() - 1]; - let mut prefix = ns_parts.join("."); - prefix.push('.'); - prefix -} - -/// Convert flat union member names to dotted namespace references. -/// -/// The flat names (like `ReflectapiDemoTestsSerdeOfferKindSingle`) have the -/// PascalCase namespace prefix stripped to produce leaf names (like -/// `OfferKindSingle`), then the dotted namespace prefix is prepended to -/// produce `reflectapi_demo.tests.serde.OfferKindSingle`. -/// -/// Members that already contain a dot are left unchanged. Literal types are -/// also left unchanged since they are values, not class references. -fn prefix_union_members(members: &[String], original_name: &str) -> Vec { - let dotted_prefix = namespace_prefix_for(original_name); - if dotted_prefix.is_empty() { - return members.to_vec(); - } - - // Compute the flat PascalCase prefix that was prepended by improve_class_name. - // For "reflectapi_demo::tests::serde::OfferKind", the namespace segments are - // ["reflectapi_demo", "tests", "serde"], and the flat prefix is "ReflectapiDemoTestsSerde". - let ns_segments: Vec<&str> = original_name.split("::").collect(); - let flat_prefix: String = ns_segments[..ns_segments.len() - 1] - .iter() - .map(|seg| to_pascal_case(seg)) - .collect::>() - .join(""); - - members - .iter() - .map(|m| { - if m.contains('.') || m.starts_with("Literal[") { - m.clone() - } else { - // Strip the flat namespace prefix to get the leaf name, then - // prepend the dotted namespace prefix. - let (base, generics_suffix) = if let Some(bracket_pos) = m.find('[') { - (&m[..bracket_pos], &m[bracket_pos..]) - } else { - (m.as_str(), "") - }; - - let leaf = if base.starts_with(&flat_prefix) { - &base[flat_prefix.len()..] - } else { - base - }; - - format!("{dotted_prefix}{leaf}{generics_suffix}") - } - }) - .collect() -} - /// Configuration for Python client generation #[derive(Debug, Clone)] pub struct Config { @@ -122,7 +40,7 @@ impl Default for Config { package_name: "api_client".to_string(), generate_async: true, generate_sync: true, - generate_testing: true, + generate_testing: false, base_url: None, } } @@ -1357,9 +1275,8 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { generated_code.push("".to_string()); } - // Render all types (models and enums) without factories first + // Render all types (models and enums) let mut rendered_types = BTreeMap::new(); - let mut factory_data = Vec::new(); // Collect factory data for later generation // Sort types topologically to handle dependencies, fall back to alphabetical on circular deps let sorted_type_names = topological_sort_types(&all_type_names, &schema).unwrap_or_else(|_| { @@ -1382,17 +1299,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // TypeVars have already been collected, use empty set for rendering let mut dummy_type_vars = BTreeSet::new(); - let (rendered, factory_info) = render_type_without_factory( - type_def, - &schema, - &implemented_types, - &mut dummy_type_vars, - )?; - - // Store factory info for later generation - if let Some(info) = factory_info { - factory_data.push(info); - } + let rendered = render_type(type_def, &schema, &implemented_types, &mut dummy_type_vars)?; // Only store non-empty renders (excludes unwrapped tuple structs) if !rendered.trim().is_empty() { @@ -1496,36 +1403,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { .push(" # Some types may not have model_rebuild method".to_string()); external_types_and_rebuilds.push(" pass".to_string()); external_types_and_rebuilds.push("".to_string()); - external_types_and_rebuilds.push( - "# Factory classes (generated after model rebuild to avoid forward references)".to_string(), - ); - - // Generate all factory classes now that types are defined and rebuilt - for factory_info in &factory_data { - let mut factory_type_vars = BTreeSet::new(); - let factory_code = if factory_info.is_internally_tagged { - generate_internally_tagged_factory_class( - &factory_info.enum_def, - &factory_info.enum_name, - &factory_info.union_members, - &schema, - &implemented_types, - &mut factory_type_vars, - )? - } else { - generate_factory_class_with_representation( - &factory_info.enum_def, - &factory_info.enum_name, - &factory_info.union_members, - &factory_info.enum_def.representation, - &schema, - &implemented_types, - &mut factory_type_vars, - )? - }; - external_types_and_rebuilds.push(factory_code); - external_types_and_rebuilds.push("".to_string()); - } generated_code.push(external_types_and_rebuilds.join("\n")); @@ -1634,21 +1511,18 @@ fn infer_enum_generic_params(enum_def: &reflectapi_schema::Enum, schema: &Schema result } -fn render_type_without_factory( +fn render_type( type_def: &Type, schema: &Schema, implemented_types: &BTreeMap, used_type_vars: &mut BTreeSet, -) -> anyhow::Result<(String, Option)> { +) -> anyhow::Result { match type_def { - Type::Struct(s) => Ok(( - render_struct(s, schema, implemented_types, used_type_vars)?, - None, - )), - Type::Enum(e) => render_enum_without_factory(e, schema, implemented_types, used_type_vars), + Type::Struct(s) => render_struct(s, schema, implemented_types, used_type_vars), + Type::Enum(e) => render_enum(e, schema, implemented_types, used_type_vars), Type::Primitive(_p) => { // Primitive types are handled by implemented_types mapping - Ok((String::new(), None)) // This shouldn't be reached normally + Ok(String::new()) // This shouldn't be reached normally } } } @@ -1987,19 +1861,18 @@ fn render_struct( Ok(class_template.render()) } -fn render_enum_without_factory( +fn render_enum( enum_def: &reflectapi_schema::Enum, schema: &Schema, implemented_types: &BTreeMap, used_type_vars: &mut BTreeSet, -) -> anyhow::Result<(String, Option)> { +) -> anyhow::Result { use reflectapi_schema::{Fields, Representation}; // Check if this is a tagged enum (internally tagged) match &enum_def.representation { Representation::Internal { tag } => { - // Internally tagged enums need factories but they're generated after model rebuild - let (rendered, union_variant_names) = render_internally_tagged_enum_without_factory( + let (rendered, _union_variant_names) = render_internally_tagged_enum( enum_def, tag, schema, @@ -2007,21 +1880,11 @@ fn render_enum_without_factory( used_type_vars, )?; - // Return factory info so it can be generated later. - // Use dotted path for the enum name so factory classes can reference - // types that live inside namespace classes. - let factory_info = FactoryInfo { - enum_def: enum_def.clone(), - enum_name: type_name_to_python_ref(&enum_def.name), - union_members: prefix_union_members(&union_variant_names, &enum_def.name), - is_internally_tagged: true, - }; - - Ok((rendered, Some(factory_info))) + Ok(rendered) } Representation::Adjacent { tag, content } => { // Adjacently tagged enums are represented as { tag: "Variant", content: ... } - let (rendered, union_variant_names) = render_adjacently_tagged_enum_without_factory( + let (rendered, _union_variant_names) = render_adjacently_tagged_enum( enum_def, tag, content, @@ -2030,30 +1893,18 @@ fn render_enum_without_factory( used_type_vars, )?; - // Return factory info so it can be generated later - let factory_info = FactoryInfo { - enum_def: enum_def.clone(), - enum_name: type_name_to_python_ref(&enum_def.name), - union_members: prefix_union_members(&union_variant_names, &enum_def.name), - is_internally_tagged: false, // Adjacent tagged, not internal - }; - - Ok((rendered, Some(factory_info))) + Ok(rendered) } Representation::None => { - // Untagged enums don't use factories - let rendered = - render_untagged_enum(enum_def, schema, implemented_types, used_type_vars)?; - Ok((rendered, None)) + // Untagged enums + render_untagged_enum(enum_def, schema, implemented_types, used_type_vars) } _ => { // Check if this is a primitive-represented enum (has discriminant values) let has_discriminants = enum_def.variants.iter().any(|v| v.discriminant.is_some()); if has_discriminants { - // Primitive enums don't use factories - let rendered = render_primitive_enum(enum_def)?; - Ok((rendered, None)) + render_primitive_enum(enum_def) } else { // Check if this has complex variants (tuple or struct variants) let has_complex_variants = enum_def.variants.iter().any(|v| { @@ -2065,22 +1916,15 @@ fn render_enum_without_factory( }); if has_complex_variants { - // This is an externally tagged enum with complex variants - needs factory - let (rendered, union_members) = render_externally_tagged_enum_without_factory( + // This is an externally tagged enum with complex variants + render_externally_tagged_enum( enum_def, schema, implemented_types, used_type_vars, - )?; - let factory_info = FactoryInfo { - enum_def: enum_def.clone(), - enum_name: type_name_to_python_ref(&enum_def.name), - union_members: prefix_union_members(&union_members, &enum_def.name), - is_internally_tagged: false, - }; - Ok((rendered, Some(factory_info))) + ) } else { - // Simple string enum - no factory needed + // Simple string enum let variants = enum_def .variants .iter() @@ -2097,15 +1941,14 @@ fn render_enum_without_factory( variants, }; - let rendered = enum_template.render(); - Ok((rendered, None)) + Ok(enum_template.render()) } } } } } -fn render_adjacently_tagged_enum_without_factory( +fn render_adjacently_tagged_enum( enum_def: &reflectapi_schema::Enum, tag: &str, content: &str, @@ -2349,53 +2192,6 @@ fn generate_adjacent_serialize_cases( Ok(cases.join("\n")) } -fn render_externally_tagged_enum_without_factory( - enum_def: &reflectapi_schema::Enum, - schema: &Schema, - implemented_types: &BTreeMap, - used_type_vars: &mut BTreeSet, -) -> anyhow::Result<(String, Vec)> { - // Generate the full enum (with factory) - let full_enum = - render_externally_tagged_enum(enum_def, schema, implemented_types, used_type_vars)?; - - // Extract just the part before the factory class (more specific split) - let enum_name = improve_class_name(&enum_def.name); - let factory_class_pattern = format!("\n\nclass {enum_name}Factory:"); - let parts: Vec<&str> = full_enum.split(&factory_class_pattern).collect(); - let enum_without_factory = parts[0].to_string(); - - // Extract union member names for factory generation later - let union_variants = extract_union_members_from_enum(enum_def)?; - - Ok((enum_without_factory, union_variants)) -} - -fn extract_union_members_from_enum( - enum_def: &reflectapi_schema::Enum, -) -> anyhow::Result> { - use reflectapi_schema::Fields; - - let enum_name = improve_class_name(&enum_def.name); - let mut union_variants = Vec::new(); - - for variant in &enum_def.variants { - let variant_name = variant.name(); - match &variant.fields { - Fields::None => { - union_variants.push(format!("Literal[\"{variant_name}\"]")); - } - Fields::Unnamed(_) | Fields::Named(_) => { - let variant_class_name = - format!("{}{}Variant", enum_name, to_pascal_case(variant_name)); - union_variants.push(variant_class_name); - } - } - } - - Ok(union_variants) -} - fn render_externally_tagged_enum( enum_def: &reflectapi_schema::Enum, schema: &Schema, @@ -2618,15 +2414,6 @@ fn render_externally_tagged_enum( }; let enum_code = template.render(); - // Generate factory class for ergonomic instantiation - let factory_class_code = generate_externally_tagged_factory_class( - enum_def, - &enum_name, - schema, - implemented_types, - used_type_vars, - )?; - // Combine all parts let mut result = String::new(); @@ -2638,433 +2425,10 @@ fn render_externally_tagged_enum( // Add the enum code result.push_str(&enum_code); - result.push_str("\n\n"); - - // Add the factory code - result.push_str(&factory_class_code); Ok(result) } -fn generate_factory_class_with_representation( - enum_def: &reflectapi_schema::Enum, - enum_name: &str, - union_members: &[String], - representation: &reflectapi_schema::Representation, - schema: &Schema, - implemented_types: &BTreeMap, - used_type_vars: &mut BTreeSet, -) -> anyhow::Result { - use reflectapi_schema::Fields; - - let factory_name = dotted_to_flat_identifier(enum_name, "Factory"); - let mut class_attributes = Vec::new(); - let mut static_methods = Vec::new(); - - // Check if this enum is generic - let is_generic = !enum_def.parameters.is_empty(); - let generic_params: Vec = if is_generic { - enum_def.parameters.iter().map(|p| p.name.clone()).collect() - } else { - Vec::new() - }; - - let generic_type_params = if is_generic { - format!("[{}]", generic_params.join(", ")) - } else { - String::new() - }; - - for (i, variant) in enum_def.variants.iter().enumerate() { - let variant_class_name = &union_members[i]; - - match &variant.fields { - Fields::None => { - // For generic enums, skip unit variants as they cannot be instantiated - // (Generic externally tagged enums use Approach B which doesn't support unit variant instantiation) - if !is_generic { - // Unit variant - creation method depends on representation - match representation { - reflectapi_schema::Representation::Adjacent { tag, .. } => { - // For adjacently tagged enums, unit variants need to be created as static methods - // returning the RootModel with dictionary format that the validator expects - let method_name = - safe_python_identifier(&to_snake_case(variant.name())); - static_methods.push(format!( - r#" @staticmethod - def {}() -> {}: - '''Creates the '{}' variant of the {} enum.''' - return {}.model_validate({{"{}": "{}"}})"#, - method_name, - enum_name, - variant.name(), - enum_name, - enum_name, - tag, - variant.name() - )); - } - reflectapi_schema::Representation::External => { - // For externally tagged enums, unit variants are also static methods - let method_name = - safe_python_identifier(&to_snake_case(variant.name())); - static_methods.push(format!( - r#" @staticmethod - def {}() -> {}: - '''Creates the '{}' variant of the {} enum.''' - return {}("{}")"#, - method_name, - enum_name, - variant.name(), - enum_name, - enum_name, - variant.name() - )); - } - _ => { - // For other representations, create as class attribute directly - class_attributes.push(format!( - " {} = {}(\"{}\")", - variant.name().to_uppercase(), - enum_name, - variant.name() - )); - } - } - } - } - Fields::Unnamed(_) | Fields::Named(_) => { - // Complex variant - create static method - let method_name = safe_python_identifier(&to_snake_case(variant.name())); - let method_params = generate_factory_method_params( - variant, - schema, - implemented_types, - &generic_params, - used_type_vars, - )?; - let method_args = generate_factory_method_args(variant)?; - - // For discriminated unions, methods should return the main enum type - let (return_type, factory_body) = match representation { - reflectapi_schema::Representation::Internal { .. } - | reflectapi_schema::Representation::Adjacent { .. } - | reflectapi_schema::Representation::External => { - // For discriminated unions, return the main enum type and wrap the variant - let main_return_type = if is_generic { - format!("{enum_name}{generic_type_params}") - } else { - enum_name.to_string() - }; - let variant_type = if is_generic && !variant_class_name.contains('[') { - format!("{variant_class_name}{generic_type_params}") - } else { - variant_class_name.clone() - }; - let factory_body = - format!("return {enum_name}({variant_type}({method_args}))"); - (main_return_type, factory_body) - } - _ => { - // For other representations, return the variant type directly - let return_type = if is_generic && !variant_class_name.contains('[') { - format!("{variant_class_name}{generic_type_params}") - } else { - variant_class_name.clone() - }; - let factory_body = format!("return {return_type}({method_args})"); - (return_type, factory_body) - } - }; - - static_methods.push(format!( - r#" @staticmethod - def {}({}) -> {}: - '''Creates the '{}' variant of the {} enum.''' - {}"#, - method_name, - method_params, - return_type, - variant.name(), - enum_name, - factory_body - )); - } - } - } - - let enum_description = if enum_def.description().is_empty() { - format!("{enum_name} variants") - } else { - sanitize_description(enum_def.description()) - }; - - let mut factory_code = format!( - r#"class {factory_name}: - '''Factory class for creating {enum_name} variants with ergonomic syntax. - - {enum_description} - '''"# - ); - - if !class_attributes.is_empty() { - factory_code.push_str("\n\n"); - factory_code.push_str(&class_attributes.join("\n")); - } - - if !static_methods.is_empty() { - factory_code.push_str("\n\n"); - factory_code.push_str(&static_methods.join("\n\n")); - } - - Ok(factory_code) -} - -fn generate_internally_tagged_factory_class( - enum_def: &reflectapi_schema::Enum, - enum_name: &str, - union_variant_names: &[String], - schema: &Schema, - implemented_types: &BTreeMap, - used_type_vars: &mut BTreeSet, -) -> anyhow::Result { - use reflectapi_schema::Fields; - - let factory_name = dotted_to_flat_identifier(enum_name, "Factory"); - let mut class_attributes = Vec::new(); - let mut static_methods = Vec::new(); - - let active_generics: Vec = enum_def.parameters.iter().map(|p| p.name.clone()).collect(); - - for (i, variant) in enum_def.variants.iter().enumerate() { - let variant_name = variant.name(); - let variant_class_name = &union_variant_names[i]; - - match &variant.fields { - Fields::None => { - // Unit variant - instantiate the variant class directly - // For internally tagged enums, unit variants are BaseModel classes - class_attributes.push(format!( - " {} = {}()", - variant_name.to_uppercase(), - variant_class_name - )); - } - Fields::Unnamed(_) | Fields::Named(_) => { - // Complex variant - create static method - let method_name = safe_python_identifier(&to_snake_case(variant_name)); - let method_params = generate_factory_method_params( - variant, - schema, - implemented_types, - &active_generics, - used_type_vars, - )?; - let method_args = generate_factory_method_args(variant)?; - - static_methods.push(format!( - r#" @staticmethod - def {method_name}({method_params}) -> {variant_class_name}: - '''Creates the '{variant_name}' variant of the {enum_name} enum.''' - return {variant_class_name}({method_args})"# - )); - } - } - } - - let enum_description = if enum_def.description().is_empty() { - format!("{enum_name} variants") - } else { - sanitize_description(enum_def.description()) - }; - - let mut factory_code = format!( - r#"class {factory_name}: - '''Factory class for creating {enum_name} variants with ergonomic syntax. - - {enum_description} - '''"# - ); - - if !class_attributes.is_empty() { - factory_code.push_str("\n\n"); - factory_code.push_str(&class_attributes.join("\n")); - } - - if !static_methods.is_empty() { - factory_code.push_str("\n\n"); - factory_code.push_str(&static_methods.join("\n\n")); - } - - Ok(factory_code) -} - -fn generate_externally_tagged_factory_class( - enum_def: &reflectapi_schema::Enum, - enum_name: &str, - schema: &Schema, - implemented_types: &BTreeMap, - used_type_vars: &mut BTreeSet, -) -> anyhow::Result { - use reflectapi_schema::Fields; - - let factory_name = dotted_to_flat_identifier(enum_name, "Factory"); - let class_attributes: Vec = Vec::new(); - let mut static_methods = Vec::new(); - - let active_generics: Vec = enum_def.parameters.iter().map(|p| p.name.clone()).collect(); - - for variant in &enum_def.variants { - let variant_name = variant.name(); - - match &variant.fields { - Fields::None => { - // Skip unit variants for externally tagged enums - // They're already handled by the RootModel validator and instantiating - // them here can cause forward reference issues - // Users can create them with: EnumName("variant_name") - } - Fields::Unnamed(_) | Fields::Named(_) => { - // Complex variant - create static method that returns wrapped RootModel - let method_name = safe_python_identifier(&to_snake_case(variant_name)); - let variant_class_name = - format!("{}{}Variant", enum_name, to_pascal_case(variant_name)); - let method_params = generate_factory_method_params( - variant, - schema, - implemented_types, - &active_generics, - used_type_vars, - )?; - let method_args = generate_factory_method_args(variant)?; - - static_methods.push(format!( - " @staticmethod\n def {method_name}({method_params}) -> {enum_name}:\n \"\"\"Creates the '{variant_name}' variant of the {enum_name} enum.\"\"\"\n return {enum_name}({variant_class_name}({method_args}))" - )); - } - } - } - - let mut factory_code = format!( - "class {factory_name}:\n \"\"\"Factory class for creating {enum_name} variants with ergonomic syntax.\n\n {enum_name} variants\n \"\"\"" - ); - - if !class_attributes.is_empty() { - factory_code.push_str("\n\n"); - factory_code.push_str(&class_attributes.join("\n")); - } - - if !static_methods.is_empty() { - factory_code.push_str("\n\n"); - factory_code.push_str(&static_methods.join("\n\n")); - } - - Ok(factory_code) -} - -fn generate_factory_method_params( - variant: &reflectapi_schema::Variant, - schema: &Schema, - implemented_types: &BTreeMap, - active_generics: &[String], - used_type_vars: &mut BTreeSet, -) -> anyhow::Result { - use reflectapi_schema::Fields; - - match &variant.fields { - Fields::None => Ok(String::new()), - Fields::Unnamed(unnamed_fields) => { - let params: Vec = unnamed_fields - .iter() - .enumerate() - .map(|(i, field)| { - let param_name = format!("field_{i}"); - let type_annotation = type_ref_to_python_type( - &field.type_ref, - schema, - implemented_types, - active_generics, - used_type_vars, - ) - .unwrap_or_else(|_| "Any".to_string()); - let full_type = if field.required { - type_annotation - } else { - format!("{type_annotation} | None") - }; - if field.required { - format!("{param_name}: {full_type}") - } else { - format!("{param_name}: {full_type} = None") - } - }) - .collect(); - Ok(params.join(", ")) - } - Fields::Named(named_fields) => { - let mut params: Vec = Vec::new(); - - // Separate required and optional parameters for better ergonomics - let mut required_params: Vec = Vec::new(); - let mut optional_params: Vec = Vec::new(); - - for field in named_fields { - let param_name = safe_python_identifier(&to_snake_case(field.serde_name())); - let type_annotation = type_ref_to_python_type( - &field.type_ref, - schema, - implemented_types, - active_generics, - used_type_vars, - ) - .unwrap_or_else(|_| "Any".to_string()); - let full_type = if field.required { - type_annotation - } else { - format!("{type_annotation} | None") - }; - if field.required { - required_params.push(format!("{param_name}: {full_type}")); - } else { - optional_params.push(format!("{param_name}: {full_type} = None")); - } - } - - // Put required parameters first, then optional ones - params.extend(required_params); - params.extend(optional_params); - - Ok(params.join(", ")) - } - } -} - -fn generate_factory_method_args(variant: &reflectapi_schema::Variant) -> anyhow::Result { - use reflectapi_schema::Fields; - - match &variant.fields { - Fields::None => Ok(String::new()), - Fields::Unnamed(unnamed_fields) => { - let args: Vec = (0..unnamed_fields.len()) - .map(|i| format!("field_{i}=field_{i}")) - .collect(); - Ok(args.join(", ")) - } - Fields::Named(named_fields) => { - let args: Vec = named_fields - .iter() - .map(|field| { - let serde_name = field.serde_name(); - let param_name = safe_python_identifier(&to_snake_case(serde_name)); - let field_name = sanitize_field_name(field.name()); - format!("{field_name}={param_name}") - }) - .collect(); - Ok(args.join(", ")) - } - } -} - fn render_primitive_enum(enum_def: &reflectapi_schema::Enum) -> anyhow::Result { // Determine if this is an integer or float enum let is_float_enum = false; @@ -3099,7 +2463,7 @@ fn render_primitive_enum(enum_def: &reflectapi_schema::Enum) -> anyhow::Result String { to_snake_case(s).to_uppercase() } -fn sanitize_field_name(s: &str) -> String { - let mut result = safe_python_identifier(&to_snake_case(s)); - // Strip leading underscores - Pydantic v2 treats _-prefixed fields as private - result = result.trim_start_matches('_').to_string(); - if result.is_empty() { - // Edge case: name was all underscores - "field".to_string() - } else { - result - } -} - fn sanitize_field_name_with_alias(name: &str, serde_name: &str) -> (String, Option) { let snake_case = to_snake_case(name); let sanitized = safe_python_identifier(&snake_case); @@ -6103,68 +5452,6 @@ pub mod templates { } } - // Hybrid enum templates for Pythonic data-carrying enum variants - pub struct HybridEnumClass { - pub enum_name: String, - pub description: Option, - pub unit_variants: Vec, - pub factory_methods: Vec, - pub data_classes: Vec, - pub union_members: Vec, - pub union_name: String, - } - - impl HybridEnumClass { - pub fn render(&self) -> String { - let mut s = String::new(); - writeln!(s, "from enum import Enum").unwrap(); - writeln!(s, "from dataclasses import dataclass").unwrap(); - writeln!(s, "from typing import Union, Optional").unwrap(); - writeln!(s).unwrap(); - for data_class in &self.data_classes { - write!(s, "{data_class}").unwrap(); - writeln!(s).unwrap(); - } - writeln!(s, "class {}(str, Enum):", self.enum_name).unwrap(); - if let Some(desc) = &self.description { - let desc = super::sanitize_for_docstring(desc); - if !desc.is_empty() { - writeln!(s, " \"\"\"{desc}\"\"\"").unwrap(); - } - } - writeln!(s, " # Unit variants as enum members").unwrap(); - for variant in &self.unit_variants { - write!(s, " {} = \"{}\"", variant.name, variant.value).unwrap(); - if let Some(desc) = &variant.description { - write!(s, " # {desc}").unwrap(); - } - writeln!(s).unwrap(); - } - writeln!(s).unwrap(); - writeln!(s, " def model_dump(self):").unwrap(); - writeln!( - s, - " \"\"\"Handle serialization for simple enum values.\"\"\"" - ) - .unwrap(); - writeln!(s, " return self.value").unwrap(); - for method in &self.factory_methods { - write!(s, "{method}").unwrap(); - writeln!(s).unwrap(); - } - writeln!(s).unwrap(); - writeln!(s, "# Type annotation for the union").unwrap(); - writeln!( - s, - "{} = Union[{}]", - self.union_name, - self.union_members.join(", ") - ) - .unwrap(); - s - } - } - pub struct TupleVariantDataClass { pub name: String, pub variant_name: String, @@ -6258,21 +5545,6 @@ pub mod templates { } } - pub struct FactoryMethod { - pub method_name: String, - pub variant_name: String, - pub class_name: String, - pub parameters: Vec, - pub field_names: Vec, - pub description: Option, - } - - impl FactoryMethod { - pub fn render(&self) -> String { - self.method_name.clone() - } - } - pub struct DiscriminatedUnionEnum { pub variant_models: Vec, pub union_members: Vec, From 25352b15dc16a2e6ea914e997b6924a4e3e0cd0f Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 09:44:45 +1300 Subject: [PATCH 39/47] fix(runtime): typed list responses, typed errors, fast JSON parsing Runtime fixes: - Use Pydantic TypeAdapter for all response validation, replacing the manual isinstance/model_validate chain. This correctly handles generic types like list[Model], dict[str, Model], Union types, and plain BaseModel subclasses. - Use TypeAdapter.validate_json(bytes) for Pydantic's Rust-based fast JSON parser when raw bytes are available, falling back to validate_python(dict) otherwise. - Add error_model parameter to _make_request and _handle_error_response. When an API returns an error, the runtime attempts to deserialize the error body into the typed error model. Accessible via ApplicationError.typed_error. Codegen: - Generated _make_request calls now pass error_model= with the typed error type from the schema. Validated against Partly's core-server: - list[BillingCurrencyListItem] returns typed Pydantic models (was returning raw dicts) - CustomerGetError.typed_error = CustomerNotFoundVariant(customer_id=...) (was raw dict string) - 170 currencies validated via fast validate_json path --- reflectapi-demo/clients/python/generated.py | 14 ++ .../src/reflectapi_runtime/client.py | 167 +++++++----------- .../src/reflectapi_runtime/exceptions.py | 11 +- reflectapi/src/codegen/python.rs | 3 + 4 files changed, 86 insertions(+), 109 deletions(-) diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index 2d471b95..793f616b 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -523,6 +523,7 @@ async def check( path, params=params if params else None, response_model=None, + error_model=myapi.HealthCheckFail, ) @@ -555,6 +556,7 @@ async def create( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsCreateError, ) async def delete( @@ -590,6 +592,7 @@ async def delete( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsRemoveError, ) async def get_first( @@ -610,6 +613,7 @@ async def get_first( params=params if params else None, headers_model=headers, response_model=myapi.model.output.Pet | None, + error_model=None, ) async def list( @@ -637,6 +641,7 @@ async def list( json_model=data, headers_model=headers, response_model=myapi.proto.Paginated[myapi.model.output.Pet], + error_model=myapi.proto.PetsListError, ) async def remove( @@ -662,6 +667,7 @@ async def remove( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsRemoveError, ) async def update( @@ -687,6 +693,7 @@ async def update( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsUpdateError, ) @@ -727,6 +734,7 @@ def check( path, params=params if params else None, response_model=None, + error_model=myapi.HealthCheckFail, ) @@ -759,6 +767,7 @@ def create( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsCreateError, ) def delete( @@ -794,6 +803,7 @@ def delete( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsRemoveError, ) def get_first( @@ -814,6 +824,7 @@ def get_first( params=params if params else None, headers_model=headers, response_model=myapi.model.output.Pet | None, + error_model=None, ) def list( @@ -841,6 +852,7 @@ def list( json_model=data, headers_model=headers, response_model=myapi.proto.Paginated[myapi.model.output.Pet], + error_model=myapi.proto.PetsListError, ) def remove( @@ -866,6 +878,7 @@ def remove( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsRemoveError, ) def update( @@ -891,6 +904,7 @@ def update( json_model=data, headers_model=headers, response_model=None, + error_model=myapi.proto.PetsUpdateError, ) diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/client.py b/reflectapi-python-runtime/src/reflectapi_runtime/client.py index bee7b756..40577341 100644 --- a/reflectapi-python-runtime/src/reflectapi_runtime/client.py +++ b/reflectapi-python-runtime/src/reflectapi_runtime/client.py @@ -9,7 +9,7 @@ from typing import Any, TypeVar, overload import httpx -from pydantic import BaseModel +from pydantic import BaseModel, TypeAdapter from pydantic import ValidationError as PydanticValidationError from .auth import AuthHandler @@ -373,17 +373,35 @@ def _execute_request(self, request: httpx.Request) -> httpx.Response: return self._client.send(request) def _handle_error_response( - self, response: httpx.Response, metadata: TransportMetadata + self, + response: httpx.Response, + metadata: TransportMetadata, + error_model: type | None = None, ) -> None: - """Handle HTTP error responses (4xx, 5xx).""" + """Handle HTTP error responses (4xx, 5xx). + + If error_model is provided, attempts to deserialize the error body + into a typed Pydantic model before raising ApplicationError. + """ if response.status_code >= 400: error_data = None + typed_error = None try: error_data = response.json() except Exception: pass - raise ApplicationError.from_response(response, metadata, error_data) + # Try typed error deserialization + if error_model is not None and error_data is not None: + try: + ta = TypeAdapter(error_model) + typed_error = ta.validate_python(error_data) + except Exception: + pass # Fall back to raw error_data + + raise ApplicationError.from_response( + response, metadata, error_data, typed_error=typed_error + ) def _parse_json_response(self, response: httpx.Response) -> dict[str, Any]: """Parse JSON response with error handling.""" @@ -401,67 +419,33 @@ def _validate_response_model( response_model: type[T] | type[Any] | str | _NoValidation, metadata: TransportMetadata, ) -> ApiResponse[T] | ApiResponse[dict[str, Any]]: - """Validate response using Pydantic model.""" + """Validate response using Pydantic model via TypeAdapter. + + TypeAdapter handles all types: plain BaseModel, Generic types + (list[Model], dict[str, Model]), Union types, and primitives. + Uses validate_json for performance when raw bytes are available. + """ # Handle special cases where no validation is needed if response_model == "Any" or response_model is NO_VALIDATION: json_response = self._parse_json_response(response) return ApiResponse(json_response, metadata) - # Handle typing.Any try: if response_model is Any: json_response = self._parse_json_response(response) return ApiResponse(json_response, metadata) except Exception: - # If there's any issue with the comparison, continue with validation pass try: - # Handle Union types (like MyapiModelOutputPet | None) - import types - - if hasattr(types, "UnionType") and isinstance( - response_model, types.UnionType - ): - json_response = self._parse_json_response(response) - # For Union types, try to deserialize with each type in the union - union_args = response_model.__args__ - - # Handle None case first - if json_response is None and type(None) in union_args: - return ApiResponse(None, metadata) - - # Try each non-None type in the union - for arg_type in union_args: - if arg_type is not type(None) and hasattr( - arg_type, "model_validate" - ): - try: - validated_data = arg_type.model_validate(json_response) - return ApiResponse(validated_data, metadata) - except Exception: - continue # Try next type - - # If none of the types worked, return as dict - return ApiResponse(json_response, metadata) - - # Type guard to ensure we have a model with validation methods - if not ( - isinstance(response_model, type) - and hasattr(response_model, "model_validate") - ): - # Shouldn't happen, but fallback to JSON parsing - json_response = self._parse_json_response(response) - return ApiResponse(json_response, metadata) - - # Use model_validate_json for high-performance parsing - if hasattr(response_model, "model_validate_json"): - validated_data = response_model.model_validate_json(response.content) + ta = TypeAdapter(response_model) + # Prefer validate_json for Pydantic's fast Rust-based JSON parsing + content = response.content + if isinstance(content, (bytes, bytearray)): + validated_data = ta.validate_json(content) else: - # Fallback to old method for compatibility json_response = self._parse_json_response(response) - validated_data = response_model.model_validate(json_response) - + validated_data = ta.validate_python(json_response) return ApiResponse(validated_data, metadata) except PydanticValidationError as e: raise ValidationError( @@ -480,6 +464,7 @@ def _make_request( json_model: BaseModel | None = None, headers_model: BaseModel | None = None, response_model: type[T] | type[Any] | str | _NoValidation | None = None, + error_model: type | None = None, ) -> ApiResponse[T] | ApiResponse[dict[str, Any]]: """Make an HTTP request and return an ApiResponse.""" # Validate request parameters @@ -499,7 +484,7 @@ def _make_request( metadata = TransportMetadata.from_response(response, start_time) # Handle error responses - self._handle_error_response(response, metadata) + self._handle_error_response(response, metadata, error_model=error_model) # Validate and return response if response_model is not None: @@ -840,17 +825,30 @@ async def _execute_request(self, request: httpx.Request) -> httpx.Response: return await self._client.send(request) def _handle_error_response( - self, response: httpx.Response, metadata: TransportMetadata + self, + response: httpx.Response, + metadata: TransportMetadata, + error_model: type | None = None, ) -> None: """Handle HTTP error responses (4xx, 5xx).""" if response.status_code >= 400: error_data = None + typed_error = None try: error_data = response.json() except Exception: pass - raise ApplicationError.from_response(response, metadata, error_data) + if error_model is not None and error_data is not None: + try: + ta = TypeAdapter(error_model) + typed_error = ta.validate_python(error_data) + except Exception: + pass + + raise ApplicationError.from_response( + response, metadata, error_data, typed_error=typed_error + ) def _parse_json_response(self, response: httpx.Response) -> dict[str, Any]: """Parse JSON response with error handling.""" @@ -868,73 +866,26 @@ def _validate_response_model( response_model: type[T] | type[Any] | str | _NoValidation, metadata: TransportMetadata, ) -> ApiResponse[T] | ApiResponse[dict[str, Any]]: - """Validate response using Pydantic model.""" - # Handle special cases where no validation is needed + """Validate response using Pydantic model via TypeAdapter.""" if response_model == "Any" or response_model is NO_VALIDATION: json_response = self._parse_json_response(response) return ApiResponse(json_response, metadata) - # Handle typing.Any try: if response_model is Any: json_response = self._parse_json_response(response) return ApiResponse(json_response, metadata) except Exception: - # If there's any issue with the comparison, continue with validation pass try: - # Handle Union types (like MyapiModelOutputPet | None) - import types - - if hasattr(types, "UnionType") and isinstance( - response_model, types.UnionType - ): - json_response = self._parse_json_response(response) - # For Union types, try to deserialize with each type in the union - union_args = response_model.__args__ - - # Handle None case first - if json_response is None and type(None) in union_args: - return ApiResponse(None, metadata) - - # Try each non-None type in the union - for arg_type in union_args: - if arg_type is not type(None) and hasattr( - arg_type, "model_validate" - ): - try: - validated_data = arg_type.model_validate(json_response) - return ApiResponse(validated_data, metadata) - except Exception: - continue # Try next type - - # If none of the types worked, return as dict - return ApiResponse(json_response, metadata) - - # Type guard to ensure we have a model with validation methods - if not ( - isinstance(response_model, type) - and hasattr(response_model, "model_validate") - ): - # Shouldn't happen, but fallback to JSON parsing - json_response = self._parse_json_response(response) - return ApiResponse(json_response, metadata) - - # Use model_validate_json for high-performance parsing - if hasattr(response_model, "model_validate_json"): - content = response.content - # In tests/mocked responses, content may not be bytes/str; fall back to parsed JSON - if not isinstance(content, (bytes, bytearray, str)): - json_response = self._parse_json_response(response) - validated_data = response_model.model_validate(json_response) - else: - validated_data = response_model.model_validate_json(content) + ta = TypeAdapter(response_model) + content = response.content + if isinstance(content, (bytes, bytearray)): + validated_data = ta.validate_json(content) else: - # Fallback to old method for compatibility json_response = self._parse_json_response(response) - validated_data = response_model.model_validate(json_response) - + validated_data = ta.validate_python(json_response) return ApiResponse(validated_data, metadata) except PydanticValidationError as e: raise ValidationError( @@ -953,6 +904,7 @@ async def _make_request( json_model: BaseModel | None = None, headers_model: BaseModel | None = None, response_model: type[T] | type[Any] | str | _NoValidation | None = None, + error_model: type | None = None, ) -> ApiResponse[T] | ApiResponse[dict[str, Any]]: """Make an HTTP request and return an ApiResponse.""" # Validate request parameters @@ -972,13 +924,12 @@ async def _make_request( metadata = TransportMetadata.from_response(response, start_time) # Handle error responses - self._handle_error_response(response, metadata) + self._handle_error_response(response, metadata, error_model=error_model) # Validate and return response if response_model is not None: return self._validate_response_model(response, response_model, metadata) else: - # No response_model provided - parse JSON into dict json_response = self._parse_json_response(response) return ApiResponse(json_response, metadata) diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/exceptions.py b/reflectapi-python-runtime/src/reflectapi_runtime/exceptions.py index bd7aee40..b4e4530c 100644 --- a/reflectapi-python-runtime/src/reflectapi_runtime/exceptions.py +++ b/reflectapi-python-runtime/src/reflectapi_runtime/exceptions.py @@ -78,9 +78,11 @@ def __init__( *, metadata: TransportMetadata, error_data: Any | None = None, + typed_error: Any | None = None, ) -> None: super().__init__(message, metadata=metadata) self.error_data = error_data + self.typed_error = typed_error @property def status_code(self) -> int: @@ -93,8 +95,14 @@ def from_response( response: httpx.Response, metadata: TransportMetadata, error_data: Any | None = None, + typed_error: Any | None = None, ) -> ApplicationError: - """Create an ApplicationError from an HTTP response.""" + """Create an ApplicationError from an HTTP response. + + Args: + typed_error: If provided, the error body deserialized into the + typed error model from the API schema. Access via .typed_error. + """ message = f"API error {response.status_code}: {response.reason_phrase}" if error_data: message += f" - {error_data}" @@ -103,6 +111,7 @@ def from_response( message, metadata=metadata, error_data=error_data, + typed_error=typed_error, ) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 7e495c45..6ab1e546 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -5124,6 +5124,9 @@ pub mod templates { } else { writeln!(s, " response_model={},", function.output_type).unwrap(); } + if let Some(error_type) = &function.error_type { + writeln!(s, " error_model={error_type},").unwrap(); + } writeln!(s, " )").unwrap(); writeln!(s).unwrap(); } From 3a96505650dd8d37387f5750c464013ab72ded96 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 10:04:57 +1300 Subject: [PATCH 40/47] refactor: Python codegen driven by SemanticSchema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Python codegen now uses SemanticSchema as the primary driver for type iteration, import detection, and function ordering: - Type iteration uses semantic.types() (deterministic BTreeMap order) instead of manual topological_sort_types (removed: 118 lines) - Import detection (has_enums, has_literal, etc.) uses SemanticType pattern matching instead of raw schema.get_type() lookups - Function iteration uses semantic.functions() for ordering - Deprecation detection uses semantic function metadata The raw Schema is kept for rendering (render functions need concrete Struct/Enum/Field types). Lookups use original_name (pre-normalization qualified name like "analytics::AnalyticsEventInsertData") to find types in the consolidated raw schema. Fixed original_names capture in Normalizer: builds short→qualified name mapping from pre-normalization type names, keyed by the post-normalization short name that NamingResolutionStage produces. Validated: 220 tests pass, core-server (284 endpoints) generates valid 47K-line Python client, live API authentication works. --- reflectapi-demo/clients/python/generated.py | 311 +++++------------- ...tests__basic__reflectapi_deprecated-5.snap | 32 +- ...__reflectapi_enum_with_skip_variant-5.snap | 55 +--- ...sts__basic__reflectapi_struct_empty-5.snap | 26 +- ..._basic_field_string_reflectapi_both-5.snap | 46 +-- ...ield_string_reflectapi_both_equally-5.snap | 48 +-- ...ing_reflectapi_both_with_attributes-5.snap | 65 +--- ...ts__basic__reflectapi_struct_option-5.snap | 28 +- ...sts__basic__reflectapi_struct_tuple-5.snap | 22 -- ...tapi_struct_with_additional_derives-5.snap | 46 +-- ...ruct_with_all_primitive_type_fields-5.snap | 126 +------ ...__basic__reflectapi_struct_with_arc-5.snap | 28 +- ...ectapi_struct_with_arc_pointer_only-5.snap | 32 +- ...with_external_generic_type_fallback-5.snap | 46 +-- ...ectapi_struct_with_fixed_size_array-5.snap | 30 +- ...sic__reflectapi_struct_with_hashmap-5.snap | 28 +- ...eflectapi_struct_with_hashset_field-5.snap | 32 +- ...i_struct_with_hashset_field_generic-5.snap | 62 +--- ...asic__reflectapi_struct_with_nested-5.snap | 40 +-- ...lectapi_struct_with_nested_external-5.snap | 46 +-- ...reflectapi_struct_with_self_via_arc-5.snap | 30 +- ...__reflectapi_struct_with_skip_field-5.snap | 26 +- ...ectapi_struct_with_skip_field_input-5.snap | 55 +--- ...ctapi_struct_with_skip_field_output-5.snap | 55 +--- ...lectapi_struct_with_transform_array-5.snap | 30 +- ...flectapi_struct_with_transform_both-5.snap | 30 +- ...tapi_struct_with_transform_fallback-5.snap | 38 +-- ...ruct_with_transform_fallback_nested-5.snap | 38 +-- ...lectapi_struct_with_transform_input-5.snap | 57 +--- ...ectapi_struct_with_transform_output-5.snap | 57 +--- ...basic__reflectapi_struct_with_tuple-5.snap | 30 +- ...sic__reflectapi_struct_with_tuple12-5.snap | 30 +- ...__basic__reflectapi_struct_with_vec-5.snap | 28 +- ...reflectapi_struct_with_vec_external-5.snap | 46 +-- ...__reflectapi_struct_with_vec_nested-5.snap | 44 +-- ...sic__reflectapi_struct_with_vec_two-5.snap | 29 +- ...demo__tests__enums__enum_rename_num-5.snap | 27 +- ...lly_tagged_enum_with_tuple_variants-5.snap | 43 +-- ...ally_tagged_enum_with_unit_variants-5.snap | 46 +-- ...__struct_with_nested_generic_struct-4.snap | 18 +- ...ct_with_nested_generic_struct_twice-4.snap | 22 +- ...adj_repr_enum_with_untagged_variant-5.snap | 53 +-- ..._tests__serde__box_field_unwrapping-5.snap | 29 +- ...ectapi_demo__tests__serde__datetime-5.snap | 52 +-- ...tapi_demo__tests__serde__empty_enum-5.snap | 26 +- ...e__empty_variants_adjacently_tagged-5.snap | 126 +------ ...e__empty_variants_externally_tagged-5.snap | 128 +------ ...e__empty_variants_internally_tagged-5.snap | 64 +--- ...sts__serde__empty_variants_untagged-5.snap | 56 +--- ...xed_variant_types_internally_tagged-5.snap | 61 +--- ...api_demo__tests__serde__enum_rename-5.snap | 27 +- ...demo__tests__serde__enum_rename_all-5.snap | 26 +- ...__serde__enum_rename_all_on_variant-5.snap | 120 +------ ...s__serde__enum_rename_variant_field-5.snap | 92 +----- ...ectapi_demo__tests__serde__enum_tag-5.snap | 54 +-- ...emo__tests__serde__enum_tag_content-5.snap | 114 +------ ..._serde__enum_tag_content_rename_all-5.snap | 122 +------ ...i_demo__tests__serde__enum_untagged-5.snap | 44 +-- ..._tests__serde__enum_with_field_skip-5.snap | 86 +---- ...sts__serde__enum_with_many_variants-5.snap | 157 +-------- ...__enum_with_rename_to_invalid_chars-5.snap | 102 +----- ..._enum_with_serde_rename_on_variants-5.snap | 96 +----- ...sts__serde__enum_with_variant_other-5.snap | 93 +----- ...ests__serde__enum_with_variant_skip-5.snap | 26 +- ..._enum_with_variant_skip_deserialize-5.snap | 61 +--- ...e__enum_with_variant_skip_serialize-5.snap | 61 +--- ...__serde__enum_with_variant_untagged-5.snap | 93 +----- ..._demo__tests__serde__external_impls-5.snap | 31 +- ...s__serde__field_all_python_keywords-5.snap | 31 +- ...rde__field_names_with_special_chars-5.snap | 36 +- ...latten_adjacently_tagged_enum_field-5.snap | 109 +----- ...latten_enum_with_unit_variants_only-5.snap | 113 +------ ...latten_externally_tagged_enum_field-5.snap | 103 +----- ...s__serde__flatten_internally_tagged-5.snap | 71 +--- ...latten_internally_tagged_enum_field-5.snap | 94 +----- ...ts__serde__flatten_multiple_structs-5.snap | 54 +-- ...ten_optional_internally_tagged_enum-5.snap | 81 +---- ...n_struct_and_internal_enum_combined-5.snap | 107 +----- ..._flatten_struct_with_nested_flatten-5.snap | 51 +-- ...pi_demo__tests__serde__flatten_unit-5.snap | 68 +--- ..._serde__flatten_untagged_enum_field-5.snap | 54 +-- ...rde__generic_adjacently_tagged_enum-5.snap | 91 +---- ...rde__generic_externally_tagged_enum-5.snap | 95 +----- ...tapi_demo__tests__serde__kebab_case-5.snap | 30 +- ...__multiple_underscore_prefix_fields-5.snap | 30 +- ...de__namespace_deeply_nested_modules-5.snap | 37 +-- ...erde__namespace_single_segment_type-5.snap | 28 +- ...serde__namespace_with_numeric_start-5.snap | 31 +- ...s__serde__nested_generic_containers-5.snap | 29 +- ...rde__nested_internally_tagged_enums-5.snap | 105 +----- ...ted_internally_tagged_enums_minimal-5.snap | 52 +-- ..._newtype_variants_adjacently_tagged-5.snap | 153 +-------- ..._newtype_variants_externally_tagged-5.snap | 157 +-------- ..._newtype_variants_internally_tagged-5.snap | 71 +--- ...emo__tests__serde__option_of_option-5.snap | 28 +- ...sts__serde__self_referential_struct-5.snap | 29 +- ...i_demo__tests__serde__struct_rename-5.snap | 26 +- ...mo__tests__serde__struct_rename_all-5.snap | 30 +- ...erde__struct_rename_all_differently-5.snap | 59 +--- ...erde__struct_rename_all_pascal_case-5.snap | 40 +-- ...__tests__serde__struct_rename_field-5.snap | 51 +-- ...repr_transparent_generic_inner_type-5.snap | 28 +- ...__tests__serde__struct_with_flatten-5.snap | 40 +-- ...serde__struct_with_flatten_optional-5.snap | 50 +-- ..._with_flatten_optional_and_required-5.snap | 73 +--- ...struct_with_rename_to_invalid_chars-5.snap | 38 +-- ...e__struct_with_rename_to_kebab_case-5.snap | 30 +- ...s__serde__struct_with_serde_default-5.snap | 57 +--- ...ests__serde__struct_with_serde_skip-5.snap | 26 +- ..._struct_with_serde_skip_deserialize-5.snap | 63 +--- ...e__struct_with_serde_skip_serialize-5.snap | 63 +--- ...struct_with_serde_skip_serialize_if-5.snap | 65 +--- ...ectapi_demo__tests__serde__timezone-5.snap | 28 +- reflectapi-schema/src/normalize.rs | 66 +++- reflectapi/src/codegen/python.rs | 263 +++++---------- 115 files changed, 771 insertions(+), 6191 deletions(-) diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index 793f616b..295a2c43 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -43,13 +43,6 @@ class MyapiHealthCheckFail(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) -class MyapiProtoPetsRemoveError(str, Enum): - """Generated enum.""" - - NOT_FOUND = "NotFound" - NOT_AUTHORIZED = "NotAuthorized" - - class MyapiProtoHeaders(BaseModel): """Generated data model.""" @@ -66,6 +59,57 @@ class MyapiProtoInternalError(BaseModel): message: str +class MyapiProtoPaginated(BaseModel, Generic[T]): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + items: list[T] = Field(description="slice of a collection") + cursor: str | None = Field(default=None, description="cursor for getting next page") + + +class MyapiProtoPetsListRequest(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + limit: int | None = None + cursor: str | None = None + + +class MyapiProtoPetsRemoveRequest(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str = Field(description="identity") + + +class MyapiProtoPetsUpdateRequest(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str = Field(description="identity") + kind: myapi.model.Kind | None = Field( + default=None, description="kind of pet, non nullable in the model" + ) + age: ReflectapiOption[int] = Field( + default=None, description="age of the pet, nullable in the model" + ) + behaviors: ReflectapiOption[list[myapi.model.Behavior]] = Field( + default=None, description="behaviors of the pet, nullable in the model" + ) + + +class MyapiProtoValidationA(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + message: str + + class MyapiProtoPetsCreateErrorInvalidIdentityVariant(BaseModel): """InvalidIdentity variant""" @@ -122,40 +166,6 @@ def _serialize_externally_tagged(self): ) -class MyapiProtoPetsRemoveRequest(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str = Field(description="identity") - - -class MyapiProtoValidationA(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - message: str - - -class MyapiProtoPaginated(BaseModel, Generic[T]): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - items: list[T] = Field(description="slice of a collection") - cursor: str | None = Field(default=None, description="cursor for getting next page") - - -class MyapiProtoPetsListRequest(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - limit: int | None = None - cursor: str | None = None - - class MyapiProtoPetsListErrorInvalidCursor(BaseModel): """Generated data model.""" @@ -198,65 +208,11 @@ class MyapiProtoPetsListError(RootModel): ] -class MyapiProtoValidationErrorValidationAVariant(BaseModel): - """ValidationA variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: myapi.proto.ValidationA - - -# Externally tagged enum using RootModel -MyapiProtoValidationErrorVariants = MyapiProtoValidationErrorValidationAVariant - - -class MyapiProtoValidationError(RootModel[MyapiProtoValidationErrorVariants]): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance(data, MyapiProtoValidationErrorValidationAVariant): - return data - - # Handle JSON data (for deserialization) - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "ValidationA": - return MyapiProtoValidationErrorValidationAVariant(field_0=value) - - raise ValueError(f"Unknown variant for MyapiProtoValidationError: {data}") - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance(self.root, MyapiProtoValidationErrorValidationAVariant): - return {"ValidationA": self.root.field_0} - - raise ValueError( - f"Cannot serialize MyapiProtoValidationError variant: {type(self.root)}" - ) - - -class MyapiProtoPetsUpdateRequest(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) +class MyapiProtoPetsRemoveError(str, Enum): + """Generated enum.""" - name: str = Field(description="identity") - kind: myapi.model.Kind | None = Field( - default=None, description="kind of pet, non nullable in the model" - ) - age: ReflectapiOption[int] = Field( - default=None, description="age of the pet, nullable in the model" - ) - behaviors: ReflectapiOption[list[myapi.model.Behavior]] = Field( - default=None, description="behaviors of the pet, nullable in the model" - ) + NOT_FOUND = "NotFound" + NOT_AUTHORIZED = "NotAuthorized" class MyapiProtoPetsUpdateErrorValidationVariant(BaseModel): @@ -315,140 +271,50 @@ def _serialize_externally_tagged(self): ) -class MyapiModelBehaviorAggressiveVariant(BaseModel): - """Aggressive variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: float = Field(description="aggressiveness level") - field_1: str = Field(description="some notes") - - -class MyapiModelBehaviorOtherVariant(BaseModel): - """Other variant""" +class MyapiProtoValidationErrorValidationAVariant(BaseModel): + """ValidationA variant""" model_config = ConfigDict(extra="ignore", populate_by_name=True) - description: str = Field(description="Custom provided description of a behavior") - notes: str | None = Field( - default=None, description="Additional notes\nUp to a user to put free text here" - ) + field_0: myapi.proto.ValidationA # Externally tagged enum using RootModel -MyapiModelBehaviorVariants = Union[ - Literal["Calm"], MyapiModelBehaviorAggressiveVariant, MyapiModelBehaviorOtherVariant -] +MyapiProtoValidationErrorVariants = MyapiProtoValidationErrorValidationAVariant -class MyapiModelBehavior(RootModel[MyapiModelBehaviorVariants]): +class MyapiProtoValidationError(RootModel[MyapiProtoValidationErrorVariants]): """Externally tagged enum""" @model_validator(mode="before") @classmethod def _validate_externally_tagged(cls, data): # Handle direct variant instances (for programmatic creation) - if isinstance(data, MyapiModelBehaviorAggressiveVariant): - return data - if isinstance(data, MyapiModelBehaviorOtherVariant): + if isinstance(data, MyapiProtoValidationErrorValidationAVariant): return data # Handle JSON data (for deserialization) - if isinstance(data, str) and data == "Calm": - return data if isinstance(data, dict): if len(data) != 1: raise ValueError("Externally tagged enum must have exactly one key") key, value = next(iter(data.items())) - if key == "Aggressive": - if isinstance(value, list): - return MyapiModelBehaviorAggressiveVariant( - field_0=value[0], field_1=value[1] - ) - else: - raise ValueError("Expected list for tuple variant Aggressive") - if key == "Other": - return MyapiModelBehaviorOtherVariant(**value) - - raise ValueError(f"Unknown variant for MyapiModelBehavior: {data}") + if key == "ValidationA": + return MyapiProtoValidationErrorValidationAVariant(field_0=value) + + raise ValueError(f"Unknown variant for MyapiProtoValidationError: {data}") @model_serializer def _serialize_externally_tagged(self): - if self.root == "Calm": - return "Calm" - if isinstance(self.root, MyapiModelBehaviorAggressiveVariant): - return {"Aggressive": [self.root.field_0, self.root.field_1]} - if isinstance(self.root, MyapiModelBehaviorOtherVariant): - return {"Other": self.root.model_dump()} + if isinstance(self.root, MyapiProtoValidationErrorValidationAVariant): + return {"ValidationA": self.root.field_0} raise ValueError( - f"Cannot serialize MyapiModelBehavior variant: {type(self.root)}" + f"Cannot serialize MyapiProtoValidationError variant: {type(self.root)}" ) -class MyapiModelKindDog(BaseModel): - """A dog""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["dog"] = Field(default="dog", description="Discriminator field") - breed: str = Field(description="breed of the dog") - - -class MyapiModelKindCat(BaseModel): - """A cat""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["cat"] = Field(default="cat", description="Discriminator field") - lives: int = Field(description="lives left") - - -class MyapiModelKindBird(BaseModel): - """Test for unit variants in internally tagged enums""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["bird"] = Field(default="bird", description="Discriminator field") - - -class MyapiModelKind(RootModel): - root: Annotated[ - Union[MyapiModelKindDog, MyapiModelKindCat, MyapiModelKindBird], - Field(discriminator="type"), - ] - - -class MyapiModelInputPet(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str = Field(description="identity") - kind: myapi.model.Kind = Field(description="kind of pet") - age: int | None = Field(default=None, description="age of the pet") - updated_at: datetime | None = None - behaviors: list[myapi.model.Behavior] | None = Field( - default=None, description="behaviors of the pet" - ) - - -class MyapiModelOutputPet(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str = Field(description="identity") - kind: myapi.model.Kind = Field(description="kind of pet") - age: int | None = Field(default=None, description="age of the pet") - updated_at: datetime - behaviors: list[myapi.model.Behavior] | None = Field( - default=None, description="behaviors of the pet" - ) - - # Namespace classes for dotted access to types class myapi: """Namespace for myapi types.""" @@ -458,47 +324,26 @@ class myapi: class proto: """Namespace for proto types.""" - PetsRemoveError = MyapiProtoPetsRemoveError Headers = MyapiProtoHeaders InternalError = MyapiProtoInternalError + Paginated = MyapiProtoPaginated + PetsListRequest = MyapiProtoPetsListRequest + PetsRemoveRequest = MyapiProtoPetsRemoveRequest + PetsUpdateRequest = MyapiProtoPetsUpdateRequest + ValidationA = MyapiProtoValidationA PetsCreateErrorInvalidIdentityVariant = ( MyapiProtoPetsCreateErrorInvalidIdentityVariant ) PetsCreateError = MyapiProtoPetsCreateError - PetsRemoveRequest = MyapiProtoPetsRemoveRequest - ValidationA = MyapiProtoValidationA - Paginated = MyapiProtoPaginated - PetsListRequest = MyapiProtoPetsListRequest PetsListErrorInvalidCursor = MyapiProtoPetsListErrorInvalidCursor PetsListErrorUnauthorized = MyapiProtoPetsListErrorUnauthorized PetsListErrorInternal = MyapiProtoPetsListErrorInternal PetsListError = MyapiProtoPetsListError - ValidationErrorValidationAVariant = MyapiProtoValidationErrorValidationAVariant - ValidationError = MyapiProtoValidationError - PetsUpdateRequest = MyapiProtoPetsUpdateRequest + PetsRemoveError = MyapiProtoPetsRemoveError PetsUpdateErrorValidationVariant = MyapiProtoPetsUpdateErrorValidationVariant PetsUpdateError = MyapiProtoPetsUpdateError - - class model: - """Namespace for model types.""" - - BehaviorAggressiveVariant = MyapiModelBehaviorAggressiveVariant - BehaviorOtherVariant = MyapiModelBehaviorOtherVariant - Behavior = MyapiModelBehavior - KindDog = MyapiModelKindDog - KindCat = MyapiModelKindCat - KindBird = MyapiModelKindBird - Kind = MyapiModelKind - - class input: - """Namespace for input types.""" - - Pet = MyapiModelInputPet - - class output: - """Namespace for output types.""" - - Pet = MyapiModelOutputPet + ValidationErrorValidationAVariant = MyapiProtoValidationErrorValidationAVariant + ValidationError = MyapiProtoValidationError class AsyncHealthClient: @@ -932,10 +777,6 @@ def __init__( # Rebuild models to resolve forward references try: myapi.HealthCheckFail.model_rebuild() - myapi.model.Behavior.model_rebuild() - myapi.model.Kind.model_rebuild() - myapi.model.input.Pet.model_rebuild() - myapi.model.output.Pet.model_rebuild() myapi.proto.Headers.model_rebuild() myapi.proto.InternalError.model_rebuild() myapi.proto.Paginated.model_rebuild() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap index 2b48ac12..709db049 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < StructWithDeprecatedField > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,31 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicStructWithDeprecatedField(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - g: int = Field(serialization_alias="_g", validation_alias="_g") - h: int = Field(serialization_alias="_h", validation_alias="_h") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - StructWithDeprecatedField = ( - ReflectapiDemoTestsBasicStructWithDeprecatedField - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -89,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -132,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -143,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.StructWithDeprecatedField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap index a173e238..eb9e22ae 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestEnumWithSkipVariant > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,45 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant(str, Enum): - """Generated enum.""" - - A = "A" - I = "I" - - -class ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant(str, Enum): - """Generated enum.""" - - A = "A" - O = "O" - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - class input: - """Namespace for input types.""" - - TestEnumWithSkipVariant = ( - ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant - ) - - class output: - """Namespace for output types.""" - - TestEnumWithSkipVariant = ( - ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -72,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: """ @@ -106,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -117,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: """ @@ -151,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -162,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant.model_rebuild() - reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap index e56f49e5..321c4406 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructEmpty > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,25 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructEmpty(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructEmpty = ReflectapiDemoTestsBasicTestStructEmpty - - class AsyncInoutClient: """Async client for inout operations.""" @@ -83,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -126,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -137,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructEmpty.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap index 92636fb6..a287711f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructOneBasicFieldStringReflectBoth > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: str = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructOneBasicFieldStringReflectBoth = ( - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -55,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: """ Args: @@ -91,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -102,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: """ Args: @@ -138,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -149,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap index 80344d68..03933819 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructOneBasicFieldStringReflectBothEqually\n> ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,31 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( - BaseModel -): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructOneBasicFieldStringReflectBothEqually = ( - ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -57,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually]: """ Args: @@ -93,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -104,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually]: """ Args: @@ -140,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -151,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap index 6aa11c0d..089419f3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: <\nTestStructOneBasicFieldStringReflectBothDifferently > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,47 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently( - BaseModel -): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -class ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently( - BaseModel -): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - class input: - """Namespace for input types.""" - - TestStructOneBasicFieldStringReflectBothDifferently = ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently - - class output: - """Namespace for output types.""" - - TestStructOneBasicFieldStringReflectBothDifferently = ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently - - class AsyncInoutClient: """Async client for inout operations.""" @@ -73,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently - ]: + data: Optional[reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently]: """ Args: @@ -109,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -120,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently - ]: + data: Optional[reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently]: """ Args: @@ -156,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -167,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() - reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap index b963cb4d..3a2c0939 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructOption > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,27 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructOption(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int | None = Field(default=None, serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructOption = ReflectapiDemoTestsBasicTestStructOption - - class AsyncInoutClient: """Async client for inout operations.""" @@ -86,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -129,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -140,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructOption.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap index 1ddc86bf..ad5ef2e0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap @@ -24,27 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructTuple(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - 0: int - 1: str - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - TestStructTuple = ReflectapiDemoTestsBasicTestStructTuple - - class AsyncInoutClient: """Async client for inout operations.""" @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructTuple.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap index c74b896e..b4f072a4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,43 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicX(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsBasicY(str, Enum): - """Generated enum.""" - - Y = "Y" - - -class ReflectapiDemoTestsBasicTest(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - us: list[None] - xs: list[reflectapi_demo.tests.basic.X] - ys: list[reflectapi_demo.tests.basic.Y] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - X = ReflectapiDemoTestsBasicX - Y = ReflectapiDemoTestsBasicY - Test = ReflectapiDemoTestsBasicTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -102,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -145,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -156,9 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.Test.model_rebuild() - reflectapi_demo.tests.basic.X.model_rebuild() - reflectapi_demo.tests.basic.Y.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap index 2dba8821..dbfa4998 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithAllPrimitiveTypeFields > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,117 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f_u8: int = Field(serialization_alias="_f_u8", validation_alias="_f_u8") - f_u16: int = Field(serialization_alias="_f_u16", validation_alias="_f_u16") - f_u32: int = Field(serialization_alias="_f_u32", validation_alias="_f_u32") - f_u64: int = Field(serialization_alias="_f_u64", validation_alias="_f_u64") - f_u128: U128 = Field(serialization_alias="_f_u128", validation_alias="_f_u128") - f_usize: int = Field(serialization_alias="_f_usize", validation_alias="_f_usize") - f_i8: int = Field(serialization_alias="_f_i8", validation_alias="_f_i8") - f_i16: int = Field(serialization_alias="_f_i16", validation_alias="_f_i16") - f_i32: int = Field(serialization_alias="_f_i32", validation_alias="_f_i32") - f_i64: int = Field(serialization_alias="_f_i64", validation_alias="_f_i64") - f_i128: I128 = Field(serialization_alias="_f_i128", validation_alias="_f_i128") - f_isize: int = Field(serialization_alias="_f_isize", validation_alias="_f_isize") - f_f32: float = Field(serialization_alias="_f_f32", validation_alias="_f_f32") - f_f64: float = Field(serialization_alias="_f_f64", validation_alias="_f_f64") - f_bool: bool = Field(serialization_alias="_f_bool", validation_alias="_f_bool") - f_char: Char = Field(serialization_alias="_f_char", validation_alias="_f_char") - f_str: str = Field(serialization_alias="_f_str", validation_alias="_f_str") - f_unit: None = Field(serialization_alias="_f_unit", validation_alias="_f_unit") - f_option: int | None = Field( - default=None, serialization_alias="_f_option", validation_alias="_f_option" - ) - f_vec: bytes = Field(serialization_alias="_f_vec", validation_alias="_f_vec") - f_hashmap: dict[int, str] = Field( - serialization_alias="_f_hashmap", validation_alias="_f_hashmap" - ) - f_hashset: bytes = Field( - serialization_alias="_f_hashset", validation_alias="_f_hashset" - ) - f_tuple: std.tuple.Tuple2[int, str] = Field( - serialization_alias="_f_tuple", validation_alias="_f_tuple" - ) - f_tuple3: std.tuple.Tuple3[int, str, int] = Field( - serialization_alias="_f_tuple3", validation_alias="_f_tuple3" - ) - f_tuple4: std.tuple.Tuple4[int, str, int, str] = Field( - serialization_alias="_f_tuple4", validation_alias="_f_tuple4" - ) - f_tuple5: std.tuple.Tuple5[int, str, int, str, int] = Field( - serialization_alias="_f_tuple5", validation_alias="_f_tuple5" - ) - f_tuple6: std.tuple.Tuple6[int, str, int, str, int, str] = Field( - serialization_alias="_f_tuple6", validation_alias="_f_tuple6" - ) - f_tuple7: std.tuple.Tuple7[int, str, int, str, int, str, int] = Field( - serialization_alias="_f_tuple7", validation_alias="_f_tuple7" - ) - f_tuple8: std.tuple.Tuple8[int, str, int, str, int, str, int, str] = Field( - serialization_alias="_f_tuple8", validation_alias="_f_tuple8" - ) - f_tuple9: std.tuple.Tuple9[int, str, int, str, int, str, int, str, int] = Field( - serialization_alias="_f_tuple9", validation_alias="_f_tuple9" - ) - f_tuple10: std.tuple.Tuple10[int, str, int, str, int, str, int, str, int, str] = ( - Field(serialization_alias="_f_tuple10", validation_alias="_f_tuple10") - ) - f_tuple11: std.tuple.Tuple11[ - int, str, int, str, int, str, int, str, int, str, int - ] = Field(serialization_alias="_f_tuple11", validation_alias="_f_tuple11") - f_tuple12: std.tuple.Tuple12[ - int, str, int, str, int, str, int, str, int, str, int, str - ] = Field(serialization_alias="_f_tuple12", validation_alias="_f_tuple12") - f_array: bytes = Field(serialization_alias="_f_array", validation_alias="_f_array") - f_pointer_box: int = Field( - serialization_alias="_f_pointer_box", validation_alias="_f_pointer_box" - ) - f_pointer_arc: int = Field( - serialization_alias="_f_pointer_arc", validation_alias="_f_pointer_arc" - ) - f_pointer_cell: int = Field( - serialization_alias="_f_pointer_cell", validation_alias="_f_pointer_cell" - ) - f_pointer_refcell: int = Field( - serialization_alias="_f_pointer_refcell", validation_alias="_f_pointer_refcell" - ) - f_pointer_mutex: int = Field( - serialization_alias="_f_pointer_mutex", validation_alias="_f_pointer_mutex" - ) - f_pointer_rwlock: int = Field( - serialization_alias="_f_pointer_rwlock", validation_alias="_f_pointer_rwlock" - ) - f_pointer_weak: int = Field( - serialization_alias="_f_pointer_weak", validation_alias="_f_pointer_weak" - ) - f_phantomdata: std.marker.PhantomData[int] = Field( - serialization_alias="_f_phantomdata", validation_alias="_f_phantomdata" - ) - f_infallible: ReflectapiInfallible = Field( - serialization_alias="_f_infallible", validation_alias="_f_infallible" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithAllPrimitiveTypeFields = ( - ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -144,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields - ] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: """ @@ -178,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -189,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields - ] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: """ @@ -223,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -234,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap index 6198c9ba..64e87361 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithArc > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,27 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithArc(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithArc = ReflectapiDemoTestsBasicTestStructWithArc - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithArc.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap index 349f3e11..852640ef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithArcPointerOnly > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,31 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithArcPointerOnly(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f_pointer_arc: int = Field( - serialization_alias="_f_pointer_arc", validation_alias="_f_pointer_arc" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithArcPointerOnly = ( - ReflectapiDemoTestsBasicTestStructWithArcPointerOnly - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -89,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -132,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -143,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithArcPointerOnly.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap index 08c1e54f..446fa4f1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithExternalGenericTypeFallback > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - data: dict[str, int] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithExternalGenericTypeFallback = ( - ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -55,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: """ Args: @@ -91,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -102,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: """ Args: @@ -138,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -149,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap index 768e792d..897a9c6f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithFixedSizeArray > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithFixedSizeArray(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: bytes = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithFixedSizeArray = ( - ReflectapiDemoTestsBasicTestStructWithFixedSizeArray - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithFixedSizeArray.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap index af88c353..6e39e6bd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithHashMap > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,27 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithHashMap(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: dict[int, str] = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithHashMap = ReflectapiDemoTestsBasicTestStructWithHashMap - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithHashMap.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap index 2e2f5355..df60d1d8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithHashSetField > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,31 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithHashSetField(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f_hashset: bytes = Field( - serialization_alias="_f_hashset", validation_alias="_f_hashset" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithHashSetField = ( - ReflectapiDemoTestsBasicTestStructWithHashSetField - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -89,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -132,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -143,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithHashSetField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap index c70a1727..bc20277c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithHashSetFieldGeneric:: >\n()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,37 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -# Type variables for generic types - - -G = TypeVar("G") - - -class ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric(BaseModel, Generic[G]): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f_hashset: list[G] = Field( - serialization_alias="_f_hashset", validation_alias="_f_hashset" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithHashSetFieldGeneric = ( - ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -63,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]]: """ Args: @@ -85,9 +50,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[ - str - ], + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str], ) @@ -101,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -112,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] - ]: + data: Optional[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]] = None, + ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]]: """ Args: @@ -134,9 +94,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[ - str - ], + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str], ) @@ -150,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -161,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap index 1e7da03a..73cc2287 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithNested > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,38 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: str = Field(serialization_alias="_f", validation_alias="_f") - - -class ReflectapiDemoTestsBasicTestStructWithNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: reflectapi_demo.tests.basic.TestStructNested = Field( - serialization_alias="_f", validation_alias="_f" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructNested = ReflectapiDemoTestsBasicTestStructNested - TestStructWithNested = ReflectapiDemoTestsBasicTestStructWithNested - - class AsyncInoutClient: """Async client for inout operations.""" @@ -96,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -139,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -150,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructNested.model_rebuild() - reflectapi_demo.tests.basic.TestStructWithNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap index d870dc9b..5e48d09d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithNestedExternal > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,44 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: str = Field(serialization_alias="_f", validation_alias="_f") - - -class ReflectapiDemoTestsBasicTestStructWithNestedExternal(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: reflectapi_demo.tests.test_lib.TestStructNested = Field( - serialization_alias="_f", validation_alias="_f" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class test_lib: - """Namespace for test_lib types.""" - - TestStructNested = ReflectapiDemoTestsTestLibTestStructNested - - class basic: - """Namespace for basic types.""" - - TestStructWithNestedExternal = ( - ReflectapiDemoTestsBasicTestStructWithNestedExternal - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -102,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -145,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -156,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithNestedExternal.model_rebuild() - reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap index a4bfe6ac..0fe369ab 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSelfViaArc > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithSelfViaArc(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: reflectapi_demo.tests.basic.TestStructWithSelfViaArc = Field( - serialization_alias="_f", validation_alias="_f" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithSelfViaArc = ReflectapiDemoTestsBasicTestStructWithSelfViaArc - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithSelfViaArc.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap index 7b3fd545..9a0810c6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSkipField > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,25 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithSkipField(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithSkipField = ReflectapiDemoTestsBasicTestStructWithSkipField - - class AsyncInoutClient: """Async client for inout operations.""" @@ -83,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -126,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -137,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithSkipField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap index 9d3a79c6..604b4045 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSkipFieldInput > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,45 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - class input: - """Namespace for input types.""" - - TestStructWithSkipFieldInput = ( - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput - ) - - class output: - """Namespace for output types.""" - - TestStructWithSkipFieldInput = ( - ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -71,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: """ @@ -105,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -116,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: """ @@ -150,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -161,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput.model_rebuild() - reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap index f0375847..661a67f8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSkipFieldOutput > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,45 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - class output: - """Namespace for output types.""" - - TestStructWithSkipFieldOutput = ( - ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput - ) - - class input: - """Namespace for input types.""" - - TestStructWithSkipFieldOutput = ( - ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -71,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: """ @@ -105,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -116,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: """ @@ -150,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -161,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput.model_rebuild() - reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap index 3f9fe9e1..cc144302 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformArray > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithTransformArray(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: bytes = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithTransformArray = ( - ReflectapiDemoTestsBasicTestStructWithTransformArray - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithTransformArray.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap index 4d2e1a35..823e5ad7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformBoth > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithTransformBoth(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithTransformBoth = ( - ReflectapiDemoTestsBasicTestStructWithTransformBoth - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithTransformBoth.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap index b78a0a63..6f0fb494 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformFallback > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithTransformFallback(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithTransformFallback = ( - ReflectapiDemoTestsBasicTestStructWithTransformFallback - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -55,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithTransformFallback - ] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallback] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: """ @@ -89,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -100,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithTransformFallback - ] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallback] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: """ @@ -134,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -145,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithTransformFallback.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap index 7105a5cb..a904af22 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformFallbackNested > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithTransformFallbackNested = ( - ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -55,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested - ] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: """ @@ -89,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -100,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested - ] = None, + data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: """ @@ -134,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -145,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap index 6b581971..d6e21838 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformInput > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,47 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicInputTestStructWithTransformInput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -class ReflectapiDemoTestsBasicOutputTestStructWithTransformInput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - class input: - """Namespace for input types.""" - - TestStructWithTransformInput = ( - ReflectapiDemoTestsBasicInputTestStructWithTransformInput - ) - - class output: - """Namespace for output types.""" - - TestStructWithTransformInput = ( - ReflectapiDemoTestsBasicOutputTestStructWithTransformInput - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -73,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithTransformInput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformInput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: """ @@ -107,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -118,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithTransformInput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformInput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: """ @@ -152,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -163,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.input.TestStructWithTransformInput.model_rebuild() - reflectapi_demo.tests.basic.output.TestStructWithTransformInput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap index eab7e5f0..3aec3862 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformOutput > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,47 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicInputTestStructWithTransformOutput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -class ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - class input: - """Namespace for input types.""" - - TestStructWithTransformOutput = ( - ReflectapiDemoTestsBasicInputTestStructWithTransformOutput - ) - - class output: - """Namespace for output types.""" - - TestStructWithTransformOutput = ( - ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -73,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithTransformOutput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformOutput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: """ @@ -107,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -118,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.basic.input.TestStructWithTransformOutput - ] = None, + data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformOutput] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: """ @@ -152,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -163,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.input.TestStructWithTransformOutput.model_rebuild() - reflectapi_demo.tests.basic.output.TestStructWithTransformOutput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap index efdf9c74..4fe831b3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTuple > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithTuple(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: std.tuple.Tuple2[int, str] = Field( - serialization_alias="_f", validation_alias="_f" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithTuple = ReflectapiDemoTestsBasicTestStructWithTuple - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithTuple.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap index 7a06506a..c9ac5e11 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTuple12 > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithTuple12(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: std.tuple.Tuple12[int, str, int, str, int, str, int, str, int, str, int, str] = ( - Field(serialization_alias="_f", validation_alias="_f") - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithTuple12 = ReflectapiDemoTestsBasicTestStructWithTuple12 - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithTuple12.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap index 6462325e..c551cda5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVec > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,27 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithVec(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: bytes = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithVec = ReflectapiDemoTestsBasicTestStructWithVec - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithVec.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap index 676211e9..1c8f9831 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVecExternal > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,44 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: str = Field(serialization_alias="_f", validation_alias="_f") - - -class ReflectapiDemoTestsBasicTestStructWithVecExternal(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: list[reflectapi_demo.tests.test_lib.TestStructNested] = Field( - serialization_alias="_f", validation_alias="_f" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class test_lib: - """Namespace for test_lib types.""" - - TestStructNested = ReflectapiDemoTestsTestLibTestStructNested - - class basic: - """Namespace for basic types.""" - - TestStructWithVecExternal = ( - ReflectapiDemoTestsBasicTestStructWithVecExternal - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -102,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -145,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -156,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithVecExternal.model_rebuild() - reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap index 3cfaa45e..adb472eb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVecNested > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,42 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: str = Field(serialization_alias="_f", validation_alias="_f") - - -class ReflectapiDemoTestsBasicTestStructWithVecNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: list[list[reflectapi_demo.tests.test_lib.TestStructNested]] = Field( - serialization_alias="_f", validation_alias="_f" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class test_lib: - """Namespace for test_lib types.""" - - TestStructNested = ReflectapiDemoTestsTestLibTestStructNested - - class basic: - """Namespace for basic types.""" - - TestStructWithVecNested = ReflectapiDemoTestsBasicTestStructWithVecNested - - class AsyncInoutClient: """Async client for inout operations.""" @@ -100,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -143,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -154,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithVecNested.model_rebuild() - reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap index 3ab55f37..65668416 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVecTwo > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,28 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsBasicTestStructWithVecTwo(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: bytes = Field(serialization_alias="_f", validation_alias="_f") - f2: list[int] = Field(serialization_alias="_f2", validation_alias="_f2") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class basic: - """Namespace for basic types.""" - - TestStructWithVecTwo = ReflectapiDemoTestsBasicTestStructWithVecTwo - - class AsyncInoutClient: """Async client for inout operations.""" @@ -86,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -129,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -140,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.basic.TestStructWithVecTwo.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap index 1948e8f5..6f2aa406 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/enums.rs expression: "super :: into_python_code :: < Nums > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,26 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsEnumsNums(str, Enum): - """Generated enum.""" - - ZERO = "0" - A = "A" - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class enums: - """Namespace for enums types.""" - - Nums = ReflectapiDemoTestsEnumsNums - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.enums.Nums.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap index 051d6de2..449e63da 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/enums.rs expression: "super :: into_python_code :: < E > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,41 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsEnumsA(str, Enum): - """Generated enum.""" - - X = "X" - Y = "Y" - - -class ReflectapiDemoTestsEnumsEA(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["a"] = Field(default="a", description="Discriminator field") - value: reflectapi_demo.tests.enums.A = Field(description="Tuple variant value") - - -class ReflectapiDemoTestsEnumsE(RootModel): - root: Annotated[Union[ReflectapiDemoTestsEnumsEA], Field(discriminator="type")] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class enums: - """Namespace for enums types.""" - - A = ReflectapiDemoTestsEnumsA - EA = ReflectapiDemoTestsEnumsEA - E = ReflectapiDemoTestsEnumsE - - class AsyncInoutClient: """Async client for inout operations.""" @@ -100,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -143,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -154,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.enums.A.model_rebuild() - reflectapi_demo.tests.enums.E.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap index 1b463415..a1370231 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/enums.rs expression: "super :: into_python_code :: < A > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,45 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsEnumsAX(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["X"] = Field(default="X", description="Discriminator field") - - -class ReflectapiDemoTestsEnumsAY(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Y"] = Field(default="Y", description="Discriminator field") - value: None = Field(description="Tuple variant value") - - -class ReflectapiDemoTestsEnumsA(RootModel): - root: Annotated[ - Union[ReflectapiDemoTestsEnumsAX, ReflectapiDemoTestsEnumsAY], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class enums: - """Namespace for enums types.""" - - AX = ReflectapiDemoTestsEnumsAX - AY = ReflectapiDemoTestsEnumsAY - A = ReflectapiDemoTestsEnumsA - - class AsyncInoutClient: """Async client for inout operations.""" @@ -104,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -147,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -158,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.enums.A.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap index 36d1a325..f201fb14 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap @@ -30,22 +30,22 @@ from reflectapi_runtime import ReflectapiInfallible A = TypeVar("A") -class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[A]): +class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct(BaseModel): """Generated data model.""" model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: A = Field(serialization_alias="_f", validation_alias="_f") + f: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[ + reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[int] + ] = Field(serialization_alias="_f", validation_alias="_f") -class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct(BaseModel): +class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[A]): """Generated data model.""" model_config = ConfigDict(extra="ignore", populate_by_name=True) - f: reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[ - reflectapi_demo.tests.generics.TestStructWithSimpleGeneric[int] - ] = Field(serialization_alias="_f", validation_alias="_f") + f: A = Field(serialization_alias="_f", validation_alias="_f") # Namespace classes for dotted access to types @@ -58,12 +58,12 @@ class reflectapi_demo: class generics: """Namespace for generics types.""" - TestStructWithSimpleGeneric = ( - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric - ) TestStructWithNestedGenericStruct = ( ReflectapiDemoTestsGenericsTestStructWithNestedGenericStruct ) + TestStructWithSimpleGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric + ) class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap index d978ef7b..d8d5c976 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap @@ -30,14 +30,6 @@ from reflectapi_runtime import ReflectapiInfallible A = TypeVar("A") -class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[A]): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: A = Field(serialization_alias="_f", validation_alias="_f") - - class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice(BaseModel): """Generated data model.""" @@ -51,6 +43,14 @@ class ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice(BaseMode ) +class ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric(BaseModel, Generic[A]): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: A = Field(serialization_alias="_f", validation_alias="_f") + + # Namespace classes for dotted access to types class reflectapi_demo: """Namespace for reflectapi_demo types.""" @@ -61,12 +61,12 @@ class reflectapi_demo: class generics: """Namespace for generics types.""" - TestStructWithSimpleGeneric = ( - ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric - ) TestStructWithNestedGenericStructTwice = ( ReflectapiDemoTestsGenericsTestStructWithNestedGenericStructTwice ) + TestStructWithSimpleGeneric = ( + ReflectapiDemoTestsGenericsTestStructWithSimpleGeneric + ) class AsyncInputClient: diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap index dc4aa178..fc618aef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,52 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestVariant1(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Variant1"] = Field( - default="Variant1", description="Discriminator field" - ) - field_name: int - - -class ReflectapiDemoTestsSerdeTestVariant2(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Variant2"] = Field( - default="Variant2", description="Discriminator field" - ) - value: str = Field(description="Tuple variant value") - - -class ReflectapiDemoTestsSerdeTest(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeTestVariant1, ReflectapiDemoTestsSerdeTestVariant2 - ], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestVariant1 = ReflectapiDemoTestsSerdeTestVariant1 - TestVariant2 = ReflectapiDemoTestsSerdeTestVariant2 - Test = ReflectapiDemoTestsSerdeTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -111,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -154,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -165,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap index a5d61b6b..d81bde03 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TreeNode > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,28 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTreeNode(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - label: str - child: reflectapi_demo.tests.serde.TreeNode | None = None - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TreeNode = ReflectapiDemoTestsSerdeTreeNode - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TreeNode.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap index 98b2b12d..6a8762cd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStruct > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,51 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class StdTimeDuration(BaseModel): - """Time duration type""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - secs: int - nanos: int - - -class ReflectapiDemoTestsSerdeTestStruct(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - duration: timedelta - naive_time: str - naive_date: date - naive_datetime: datetime - date_time_fixed_offset: datetime - date_time_utc: datetime - date_time_local: datetime - - -# Namespace classes for dotted access to types -class std: - """Namespace for std types.""" - - class time: - """Namespace for time types.""" - - Duration = StdTimeDuration - - -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStruct = ReflectapiDemoTestsSerdeTestStruct - - class AsyncInoutClient: """Async client for inout operations.""" @@ -110,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -153,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -164,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap index 8a352b63..8f3ebfd7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Never > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,25 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeNever(str, Enum): - """Generated enum.""" - - pass - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Never = ReflectapiDemoTestsSerdeNever - - class AsyncInoutClient: """Async client for inout operations.""" @@ -84,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -127,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -138,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Never.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index d63abfef..bf04a937 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsAdjacentlyTagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,108 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant( - BaseModel -): - """EmptyUnit variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant( - BaseModel -): - """EmptyStruct variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -# Adjacently tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedVariants = Union[ - Literal["Empty"], - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant, - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant, -] - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged( - RootModel[ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedVariants] -): - """Adjacently tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_adjacently_tagged(cls, data): - # Handle direct variant instances - if isinstance( - data, - ( - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant, - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant, - ), - ): - return data - if isinstance(data, dict): - tag = data.get("t") - content = data.get("c") - if tag is None: - raise ValueError("Missing tag field 't'") - if content is None and tag not in ("Empty"): - raise ValueError("Missing content field 'c' for tag: {}".format(tag)) - # Dispatch based on tag - if tag == "Empty": - return "Empty" - if tag == "EmptyUnit": - if isinstance(content, list): - return ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant() - else: - raise ValueError("Expected list for tuple variant EmptyUnit") - if tag == "EmptyStruct": - return ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant( - **content - ) - raise ValueError( - "Unknown variant for ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged: {}".format( - data - ) - ) - - @model_serializer - def _serialize_adjacently_tagged(self): - if self.root == "Empty": - return {"t": "Empty"} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant, - ): - return {"t": "EmptyUnit", "c": []} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant, - ): - return {"t": "EmptyStruct", "c": self.root.model_dump()} - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant - TestEmptyVariantsAdjacentlyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant - TestEmptyVariantsAdjacentlyTagged = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -142,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: """ @@ -176,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -187,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: """ @@ -221,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -232,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap index 4d550211..0b7d2bd0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsExternallyTagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,110 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant( - BaseModel -): - """EmptyUnit variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant( - BaseModel -): - """EmptyStruct variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedVariants = Union[ - Literal["Empty"], - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant, - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant, -] - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged( - RootModel[ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedVariants] -): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance( - data, - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant, - ): - return data - if isinstance( - data, - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant, - ): - return data - - # Handle JSON data (for deserialization) - if isinstance(data, str) and data == "Empty": - return data - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "EmptyUnit": - if isinstance(value, list): - return ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant() - else: - raise ValueError("Expected list for tuple variant EmptyUnit") - if key == "EmptyStruct": - return ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant( - **value - ) - - raise ValueError( - f"Unknown variant for ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged: {data}" - ) - - @model_serializer - def _serialize_externally_tagged(self): - if self.root == "Empty": - return "Empty" - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant, - ): - return {"EmptyUnit": []} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant, - ): - return {"EmptyStruct": self.root.model_dump()} - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEmptyVariantsExternallyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant - TestEmptyVariantsExternallyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant - TestEmptyVariantsExternallyTagged = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -144,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: """ @@ -178,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -189,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: """ @@ -223,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -234,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap index f19658fb..f32f61e7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsInterallyTagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,55 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Empty"] = Field(default="Empty", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["EmptyStruct"] = Field( - default="EmptyStruct", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty, - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct, - ], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEmptyVariantsInterallyTaggedEmpty = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty - ) - TestEmptyVariantsInterallyTaggedEmptyStruct = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct - ) - TestEmptyVariantsInterallyTagged = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -82,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: """ @@ -116,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -127,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: """ @@ -161,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -172,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap index 7d9d642c..64fb3aba 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsUntagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,55 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyUnit(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyStruct(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged = Union[ - ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty, - ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyUnit, - ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyStruct, -] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEmptyVariantsUntaggedEmpty = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty - ) - TestEmptyVariantsUntaggedEmptyUnit = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyUnit - ) - TestEmptyVariantsUntaggedEmptyStruct = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyStruct - ) - TestEmptyVariantsUntagged = ( - ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -114,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -157,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -168,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEmptyVariantsUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap index e1208878..8e3d9b0b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Mixed > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,60 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeMixedUnit(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Unit"] = Field(default="Unit", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeMixedWrap(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Wrap"] = Field(default="Wrap", description="Discriminator field") - value: str - - -class ReflectapiDemoTestsSerdeMixedFull(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Full"] = Field(default="Full", description="Discriminator field") - x: int - y: int - - -class ReflectapiDemoTestsSerdeMixed(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeMixedUnit, - ReflectapiDemoTestsSerdeMixedWrap, - ReflectapiDemoTestsSerdeMixedFull, - ], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - MixedUnit = ReflectapiDemoTestsSerdeMixedUnit - MixedWrap = ReflectapiDemoTestsSerdeMixedWrap - MixedFull = ReflectapiDemoTestsSerdeMixedFull - Mixed = ReflectapiDemoTestsSerdeMixed - - class AsyncInoutClient: """Async client for inout operations.""" @@ -119,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -162,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -173,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Mixed.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap index ad07a023..e3455372 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRename > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,26 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeMyEnum(str, Enum): - """Generated enum.""" - - V1 = "V1" - V2 = "V2" - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - MyEnum = ReflectapiDemoTestsSerdeMyEnum - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.MyEnum.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap index 3123173f..52c64064 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRenameAll > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,25 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumRenameAll(str, Enum): - """Generated enum.""" - - FIELD_NAME = "fieldName" - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumRenameAll = ReflectapiDemoTestsSerdeTestEnumRenameAll - - class AsyncInoutClient: """Async client for inout operations.""" @@ -84,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -127,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -138,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap index 69e84b15..9ea9e83f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRenameAllOnVariant > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,110 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant(BaseModel): - """Variant1 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="fieldName", validation_alias="fieldName" - ) - - -class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant(BaseModel): - """Variant2 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: int - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariants = Union[ - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant, - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant, -] - - -class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( - RootModel[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariants] -): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance( - data, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant - ): - return data - if isinstance( - data, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant - ): - return data - - # Handle JSON data (for deserialization) - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Variant1": - return ( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant( - **value - ) - ) - if key == "Variant2": - return ( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant( - field_0=value - ) - ) - - raise ValueError( - f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: {data}" - ) - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance( - self.root, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant - ): - return {"Variant1": self.root.model_dump()} - if isinstance( - self.root, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant - ): - return {"Variant2": self.root.field_0} - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumRenameAllOnVariantVariant1Variant = ( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant - ) - TestEnumRenameAllOnVariantVariant2Variant = ( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant - ) - TestEnumRenameAllOnVariant = ( - ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -176,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -219,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -230,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap index 4e6bce2a..9454e9b0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRenameVariantField > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,82 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant(BaseModel): - """Variant2 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - variant2_field_name: int - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariants = ( - ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant -) - - -class ReflectapiDemoTestsSerdeTestEnumRenameVariantField( - RootModel[ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariants] -): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance( - data, ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant - ): - return data - - # Handle JSON data (for deserialization) - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Variant2": - return ( - ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant( - **value - ) - ) - - raise ValueError( - f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumRenameVariantField: {data}" - ) - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance( - self.root, ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant - ): - return {"Variant2": self.root.model_dump()} - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumRenameVariantField variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumRenameVariantFieldVariant2Variant = ( - ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant - ) - TestEnumRenameVariantField = ( - ReflectapiDemoTestsSerdeTestEnumRenameVariantField - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -148,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -191,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -202,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumRenameVariantField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap index 233b7903..23b6c0a2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumTag > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,53 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumTagVariant1(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Variant1"] = Field( - default="Variant1", description="Discriminator field" - ) - field_name: int - - -class ReflectapiDemoTestsSerdeTestEnumTagVariant2(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Variant2"] = Field( - default="Variant2", description="Discriminator field" - ) - field_name: int - - -class ReflectapiDemoTestsSerdeTestEnumTag(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeTestEnumTagVariant1, - ReflectapiDemoTestsSerdeTestEnumTagVariant2, - ], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumTagVariant1 = ReflectapiDemoTestsSerdeTestEnumTagVariant1 - TestEnumTagVariant2 = ReflectapiDemoTestsSerdeTestEnumTagVariant2 - TestEnumTag = ReflectapiDemoTestsSerdeTestEnumTag - - class AsyncInoutClient: """Async client for inout operations.""" @@ -112,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -155,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -166,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumTag.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index 73a06da1..b6384737 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumTagContent > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,104 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant(BaseModel): - """Variant1 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int - - -class ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant(BaseModel): - """Variant2 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: int - - -# Adjacently tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumTagContentVariants = Union[ - ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant, - ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant, -] - - -class ReflectapiDemoTestsSerdeTestEnumTagContent( - RootModel[ReflectapiDemoTestsSerdeTestEnumTagContentVariants] -): - """Adjacently tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_adjacently_tagged(cls, data): - # Handle direct variant instances - if isinstance( - data, - ( - ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant, - ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant, - ), - ): - return data - if isinstance(data, dict): - tag = data.get("type") - content = data.get("content") - if tag is None: - raise ValueError("Missing tag field 'type'") - if content is None and tag not in (): - raise ValueError( - "Missing content field 'content' for tag: {}".format(tag) - ) - # Dispatch based on tag - if tag == "Variant1": - return ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant( - **content - ) - if tag == "Variant2": - return ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant( - field_0=content - ) - raise ValueError( - "Unknown variant for ReflectapiDemoTestsSerdeTestEnumTagContent: {}".format( - data - ) - ) - - @model_serializer - def _serialize_adjacently_tagged(self): - if isinstance( - self.root, ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant - ): - return {"type": "Variant1", "content": self.root.model_dump()} - if isinstance( - self.root, ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant - ): - return {"type": "Variant2", "content": self.root.field_0} - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumTagContent variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumTagContentVariant1Variant = ( - ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant - ) - TestEnumTagContentVariant2Variant = ( - ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant - ) - TestEnumTagContent = ReflectapiDemoTestsSerdeTestEnumTagContent - - class AsyncInoutClient: """Async client for inout operations.""" @@ -170,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -213,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -224,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumTagContent.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index edfd1d7c..18dbbe9e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumTagContentRenameAll > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,112 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant(BaseModel): - """variant1 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int - - -class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant(BaseModel): - """variant2 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: int - - -# Adjacently tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariants = Union[ - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant, - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant, -] - - -class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( - RootModel[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariants] -): - """Adjacently tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_adjacently_tagged(cls, data): - # Handle direct variant instances - if isinstance( - data, - ( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant, - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant, - ), - ): - return data - if isinstance(data, dict): - tag = data.get("type") - content = data.get("content") - if tag is None: - raise ValueError("Missing tag field 'type'") - if content is None and tag not in (): - raise ValueError( - "Missing content field 'content' for tag: {}".format(tag) - ) - # Dispatch based on tag - if tag == "variant1": - return ( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant( - **content - ) - ) - if tag == "variant2": - return ( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant( - field_0=content - ) - ) - raise ValueError( - "Unknown variant for ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: {}".format( - data - ) - ) - - @model_serializer - def _serialize_adjacently_tagged(self): - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant, - ): - return {"type": "variant1", "content": self.root.model_dump()} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant, - ): - return {"type": "variant2", "content": self.root.field_0} - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumTagContentRenameAllVariant1Variant = ( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant - ) - TestEnumTagContentRenameAllVariant2Variant = ( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant - ) - TestEnumTagContentRenameAll = ( - ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -178,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -221,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -232,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumTagContentRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap index 1cfab641..be18fb61 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumUntagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,43 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: int - - -class ReflectapiDemoTestsSerdeTestEnumUntaggedVariant2(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int - - -ReflectapiDemoTestsSerdeTestEnumUntagged = Union[ - ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1, - ReflectapiDemoTestsSerdeTestEnumUntaggedVariant2, -] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumUntaggedVariant1 = ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1 - TestEnumUntaggedVariant2 = ReflectapiDemoTestsSerdeTestEnumUntaggedVariant2 - TestEnumUntagged = ReflectapiDemoTestsSerdeTestEnumUntagged - - class AsyncInoutClient: """Async client for inout operations.""" @@ -102,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -145,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -156,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap index cc65c97b..92ed9e66 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithFieldSkip > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,76 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant(BaseModel): - """Variant1 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariants = ( - ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant -) - - -class ReflectapiDemoTestsSerdeTestEnumWithFieldSkip( - RootModel[ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariants] -): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance( - data, ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant - ): - return data - - # Handle JSON data (for deserialization) - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Variant1": - return ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant( - **value - ) - - raise ValueError( - f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithFieldSkip: {data}" - ) - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance( - self.root, ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant - ): - return {"Variant1": self.root.model_dump()} - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithFieldSkip variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumWithFieldSkipVariant1Variant = ( - ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant - ) - TestEnumWithFieldSkip = ReflectapiDemoTestsSerdeTestEnumWithFieldSkip - - class AsyncInoutClient: """Async client for inout operations.""" @@ -142,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -185,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -196,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumWithFieldSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap index 7563f4d0..f16e37f3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < LargeEnum > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,156 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeLargeEnumAlpha(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Alpha"] = Field(default="Alpha", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeLargeEnumBeta(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Beta"] = Field(default="Beta", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeLargeEnumGamma(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Gamma"] = Field(default="Gamma", description="Discriminator field") - x: int - - -class ReflectapiDemoTestsSerdeLargeEnumDelta(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Delta"] = Field(default="Delta", description="Discriminator field") - value: str - - -class ReflectapiDemoTestsSerdeLargeEnumEpsilon(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Epsilon"] = Field( - default="Epsilon", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeLargeEnumZeta(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Zeta"] = Field(default="Zeta", description="Discriminator field") - y: bool - - -class ReflectapiDemoTestsSerdeLargeEnumEta(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Eta"] = Field(default="Eta", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeLargeEnumTheta(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Theta"] = Field(default="Theta", description="Discriminator field") - value: int - - -class ReflectapiDemoTestsSerdeLargeEnumIota(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Iota"] = Field(default="Iota", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeLargeEnumKappa(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Kappa"] = Field(default="Kappa", description="Discriminator field") - z: float - - -class ReflectapiDemoTestsSerdeLargeEnumLambda(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Lambda"] = Field(default="Lambda", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeLargeEnumMu(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Mu"] = Field(default="Mu", description="Discriminator field") - w: str - v: int - - -class ReflectapiDemoTestsSerdeLargeEnum(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeLargeEnumAlpha, - ReflectapiDemoTestsSerdeLargeEnumBeta, - ReflectapiDemoTestsSerdeLargeEnumGamma, - ReflectapiDemoTestsSerdeLargeEnumDelta, - ReflectapiDemoTestsSerdeLargeEnumEpsilon, - ReflectapiDemoTestsSerdeLargeEnumZeta, - ReflectapiDemoTestsSerdeLargeEnumEta, - ReflectapiDemoTestsSerdeLargeEnumTheta, - ReflectapiDemoTestsSerdeLargeEnumIota, - ReflectapiDemoTestsSerdeLargeEnumKappa, - ReflectapiDemoTestsSerdeLargeEnumLambda, - ReflectapiDemoTestsSerdeLargeEnumMu, - ], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - LargeEnumAlpha = ReflectapiDemoTestsSerdeLargeEnumAlpha - LargeEnumBeta = ReflectapiDemoTestsSerdeLargeEnumBeta - LargeEnumGamma = ReflectapiDemoTestsSerdeLargeEnumGamma - LargeEnumDelta = ReflectapiDemoTestsSerdeLargeEnumDelta - LargeEnumEpsilon = ReflectapiDemoTestsSerdeLargeEnumEpsilon - LargeEnumZeta = ReflectapiDemoTestsSerdeLargeEnumZeta - LargeEnumEta = ReflectapiDemoTestsSerdeLargeEnumEta - LargeEnumTheta = ReflectapiDemoTestsSerdeLargeEnumTheta - LargeEnumIota = ReflectapiDemoTestsSerdeLargeEnumIota - LargeEnumKappa = ReflectapiDemoTestsSerdeLargeEnumKappa - LargeEnumLambda = ReflectapiDemoTestsSerdeLargeEnumLambda - LargeEnumMu = ReflectapiDemoTestsSerdeLargeEnumMu - LargeEnum = ReflectapiDemoTestsSerdeLargeEnum - - class AsyncInoutClient: """Async client for inout operations.""" @@ -215,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -258,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -269,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.LargeEnum.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index 19d8b3bc..f8dea8f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithRenameToInvalidChars > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,84 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant( - BaseModel -): - """Variant1 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="field-name&&", validation_alias="field-name&&") - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants = ( - ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant -) - - -class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars( - RootModel[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants] -): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance( - data, - ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant, - ): - return data - - # Handle JSON data (for deserialization) - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Variant1": - return ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant( - **value - ) - - raise ValueError( - f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars: {data}" - ) - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant, - ): - return {"Variant1": self.root.model_dump()} - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumWithRenameToInvalidCharsVariant1Variant = ( - ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant - ) - TestEnumWithRenameToInvalidChars = ( - ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -118,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ @@ -152,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -163,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ @@ -197,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -208,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap index aa75d7bf..3a273658 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Action > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,86 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeActionCreateItemVariant(BaseModel): - """create_item variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - - -class ReflectapiDemoTestsSerdeActionDeleteItemVariant(BaseModel): - """delete_item variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - id: int - - -# Adjacently tagged enum using RootModel -ReflectapiDemoTestsSerdeActionVariants = Union[ - ReflectapiDemoTestsSerdeActionCreateItemVariant, - ReflectapiDemoTestsSerdeActionDeleteItemVariant, -] - - -class ReflectapiDemoTestsSerdeAction(RootModel[ReflectapiDemoTestsSerdeActionVariants]): - """Adjacently tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_adjacently_tagged(cls, data): - # Handle direct variant instances - if isinstance( - data, - ( - ReflectapiDemoTestsSerdeActionCreateItemVariant, - ReflectapiDemoTestsSerdeActionDeleteItemVariant, - ), - ): - return data - if isinstance(data, dict): - tag = data.get("kind") - content = data.get("data") - if tag is None: - raise ValueError("Missing tag field 'kind'") - if content is None and tag not in (): - raise ValueError("Missing content field 'data' for tag: {}".format(tag)) - # Dispatch based on tag - if tag == "create_item": - return ReflectapiDemoTestsSerdeActionCreateItemVariant(**content) - if tag == "delete_item": - return ReflectapiDemoTestsSerdeActionDeleteItemVariant(**content) - raise ValueError( - "Unknown variant for ReflectapiDemoTestsSerdeAction: {}".format(data) - ) - - @model_serializer - def _serialize_adjacently_tagged(self): - if isinstance(self.root, ReflectapiDemoTestsSerdeActionCreateItemVariant): - return {"kind": "create_item", "data": self.root.model_dump()} - if isinstance(self.root, ReflectapiDemoTestsSerdeActionDeleteItemVariant): - return {"kind": "delete_item", "data": self.root.model_dump()} - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeAction variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - ActionCreateItemVariant = ReflectapiDemoTestsSerdeActionCreateItemVariant - ActionDeleteItemVariant = ReflectapiDemoTestsSerdeActionDeleteItemVariant - Action = ReflectapiDemoTestsSerdeAction - - class AsyncInoutClient: """Async client for inout operations.""" @@ -152,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -195,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -206,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Action.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap index a9ad367b..99b12fb2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantOther > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,83 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["V0"] = Field(default="V0", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther(RootModel): - root: Annotated[ - Union[ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0], - Field(discriminator="type"), - ] - - -class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["V0"] = Field(default="V0", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Variant1"] = Field( - default="Variant1", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0, - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1, - ], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestEnumWithVariantOtherV0 = ( - ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0 - ) - TestEnumWithVariantOther = ( - ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther - ) - - class output: - """Namespace for output types.""" - - TestEnumWithVariantOtherV0 = ( - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0 - ) - TestEnumWithVariantOtherVariant1 = ( - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1 - ) - TestEnumWithVariantOther = ( - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -110,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestEnumWithVariantOther - ] = None, + data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantOther] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: """ @@ -144,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -155,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestEnumWithVariantOther - ] = None, + data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantOther] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: """ @@ -189,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -200,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestEnumWithVariantOther.model_rebuild() - reflectapi_demo.tests.serde.output.TestEnumWithVariantOther.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap index 59dff440..a2ed9ff0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantSkip > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,25 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumWithVariantSkip(str, Enum): - """Generated enum.""" - - pass - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumWithVariantSkip = ReflectapiDemoTestsSerdeTestEnumWithVariantSkip - - class AsyncInoutClient: """Async client for inout operations.""" @@ -84,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -127,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -138,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumWithVariantSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap index 4eb469d2..ca0b10b3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantSkipDeserialize > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,43 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize(str, Enum): - """Generated enum.""" - - pass - - -class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize(str, Enum): - """Generated enum.""" - - _VARIANT1 = "_Variant1" - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestEnumWithVariantSkipDeserialize = ( - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize - ) - - class output: - """Namespace for output types.""" - - TestEnumWithVariantSkipDeserialize = ( - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -70,12 +33,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: """ Args: @@ -106,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -117,12 +77,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: """ Args: @@ -153,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -164,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize.model_rebuild() - reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap index 06027402..5bbad23c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantSkipSerialize > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,43 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize(str, Enum): - """Generated enum.""" - - VARIANT1 = "Variant1" - - -class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize(str, Enum): - """Generated enum.""" - - pass - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestEnumWithVariantSkipSerialize = ( - ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize - ) - - class output: - """Namespace for output types.""" - - TestEnumWithVariantSkipSerialize = ( - ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -70,12 +33,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: """ Args: @@ -106,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -117,12 +77,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: """ Args: @@ -153,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -164,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize.model_rebuild() - reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap index 2886e42f..30d84b2b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantUntagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,83 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant(BaseModel): - """Variant1 variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: int - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariants = ( - ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant -) - - -class ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged( - RootModel[ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariants] -): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance( - data, ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant - ): - return data - - # Handle JSON data (for deserialization) - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Variant1": - return ( - ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant( - field_0=value - ) - ) - - raise ValueError( - f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged: {data}" - ) - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant, - ): - return {"Variant1": self.root.field_0} - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestEnumWithVariantUntaggedVariant1Variant = ( - ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant - ) - TestEnumWithVariantUntagged = ( - ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -149,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -192,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -203,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestEnumWithVariantUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap index 63214b5b..8f1138f2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,30 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTest(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - index_map: dict[int, int] - index_set: list[str] - url: str - json: Any - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Test = ReflectapiDemoTestsSerdeTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -88,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -131,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -142,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap index bfa982b5..ee2fb055 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Keywords > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,30 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeKeywords(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type_: str = Field(serialization_alias="type", validation_alias="type") - class_: str = Field(serialization_alias="class", validation_alias="class") - from_: str = Field(serialization_alias="from", validation_alias="from") - import_: str = Field(serialization_alias="import", validation_alias="import") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Keywords = ReflectapiDemoTestsSerdeKeywords - - class AsyncInoutClient: """Async client for inout operations.""" @@ -88,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -131,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -142,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Keywords.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap index c8998f4d..11808732 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < SpecialNames > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,35 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeSpecialNames(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - content_type: str = Field( - serialization_alias="Content-Type", validation_alias="Content-Type" - ) - nested_key: str = Field( - serialization_alias="x.nested.key", validation_alias="x.nested.key" - ) - has_spaces: int = Field( - serialization_alias="has spaces", validation_alias="has spaces" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - SpecialNames = ReflectapiDemoTestsSerdeSpecialNames - - class AsyncInoutClient: """Async client for inout operations.""" @@ -93,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -136,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -147,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.SpecialNames.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index e80f95d1..11b6972f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Message > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,98 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdePayloadTextVariant(BaseModel): - """Text variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - body: str - - -class ReflectapiDemoTestsSerdePayloadBinaryVariant(BaseModel): - """Binary variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - size: int - - -# Adjacently tagged enum using RootModel -ReflectapiDemoTestsSerdePayloadVariants = Union[ - ReflectapiDemoTestsSerdePayloadTextVariant, - ReflectapiDemoTestsSerdePayloadBinaryVariant, -] - - -class ReflectapiDemoTestsSerdePayload( - RootModel[ReflectapiDemoTestsSerdePayloadVariants] -): - """Adjacently tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_adjacently_tagged(cls, data): - # Handle direct variant instances - if isinstance( - data, - ( - ReflectapiDemoTestsSerdePayloadTextVariant, - ReflectapiDemoTestsSerdePayloadBinaryVariant, - ), - ): - return data - if isinstance(data, dict): - tag = data.get("kind") - content = data.get("data") - if tag is None: - raise ValueError("Missing tag field 'kind'") - if content is None and tag not in (): - raise ValueError("Missing content field 'data' for tag: {}".format(tag)) - # Dispatch based on tag - if tag == "Text": - return ReflectapiDemoTestsSerdePayloadTextVariant(**content) - if tag == "Binary": - return ReflectapiDemoTestsSerdePayloadBinaryVariant(**content) - raise ValueError( - "Unknown variant for ReflectapiDemoTestsSerdePayload: {}".format(data) - ) - - @model_serializer - def _serialize_adjacently_tagged(self): - if isinstance(self.root, ReflectapiDemoTestsSerdePayloadTextVariant): - return {"kind": "Text", "data": self.root.model_dump()} - if isinstance(self.root, ReflectapiDemoTestsSerdePayloadBinaryVariant): - return {"kind": "Binary", "data": self.root.model_dump()} - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdePayload variant: {type(self.root)}" - ) - - -class ReflectapiDemoTestsSerdeMessage(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - id: str - payload: reflectapi_demo.tests.serde.Payload - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - PayloadTextVariant = ReflectapiDemoTestsSerdePayloadTextVariant - PayloadBinaryVariant = ReflectapiDemoTestsSerdePayloadBinaryVariant - Payload = ReflectapiDemoTestsSerdePayload - Message = ReflectapiDemoTestsSerdeMessage - - class AsyncInoutClient: """Async client for inout operations.""" @@ -164,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -207,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -218,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Message.model_rebuild() - reflectapi_demo.tests.serde.Payload.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap index c993000b..b1400265 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Item > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,111 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeStatusActive(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - status: Literal["Active"] = Field( - default="Active", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeStatusInactive(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - status: Literal["Inactive"] = Field( - default="Inactive", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeStatusPending(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - status: Literal["Pending"] = Field( - default="Pending", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeStatus(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeStatusActive, - ReflectapiDemoTestsSerdeStatusInactive, - ReflectapiDemoTestsSerdeStatusPending, - ], - Field(discriminator="status"), - ] - - -class ReflectapiDemoTestsSerdeItemActive(BaseModel): - """'Active' variant of ReflectapiDemoTestsSerdeItem""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - status: Literal["Active"] = Field( - default="Active", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeItemInactive(BaseModel): - """'Inactive' variant of ReflectapiDemoTestsSerdeItem""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - status: Literal["Inactive"] = Field( - default="Inactive", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeItemPending(BaseModel): - """'Pending' variant of ReflectapiDemoTestsSerdeItem""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - status: Literal["Pending"] = Field( - default="Pending", description="Discriminator field" - ) - - -class ReflectapiDemoTestsSerdeItem(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeItemActive, - ReflectapiDemoTestsSerdeItemInactive, - ReflectapiDemoTestsSerdeItemPending, - ], - Field(discriminator="status"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - StatusActive = ReflectapiDemoTestsSerdeStatusActive - StatusInactive = ReflectapiDemoTestsSerdeStatusInactive - StatusPending = ReflectapiDemoTestsSerdeStatusPending - Status = ReflectapiDemoTestsSerdeStatus - ItemActive = ReflectapiDemoTestsSerdeItemActive - ItemInactive = ReflectapiDemoTestsSerdeItemInactive - ItemPending = ReflectapiDemoTestsSerdeItemPending - Item = ReflectapiDemoTestsSerdeItem - - class AsyncInoutClient: """Async client for inout operations.""" @@ -170,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -213,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -224,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Item.model_rebuild() - reflectapi_demo.tests.serde.Status.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap index 2fad2b20..8d554ed4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Drawing > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,92 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeShapeCircleVariant(BaseModel): - """Circle variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - radius: float - - -class ReflectapiDemoTestsSerdeShapeRectVariant(BaseModel): - """Rect variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - width: float - height: float - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeShapeVariants = Union[ - ReflectapiDemoTestsSerdeShapeCircleVariant, ReflectapiDemoTestsSerdeShapeRectVariant -] - - -class ReflectapiDemoTestsSerdeShape(RootModel[ReflectapiDemoTestsSerdeShapeVariants]): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance(data, ReflectapiDemoTestsSerdeShapeCircleVariant): - return data - if isinstance(data, ReflectapiDemoTestsSerdeShapeRectVariant): - return data - - # Handle JSON data (for deserialization) - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Circle": - return ReflectapiDemoTestsSerdeShapeCircleVariant(**value) - if key == "Rect": - return ReflectapiDemoTestsSerdeShapeRectVariant(**value) - - raise ValueError(f"Unknown variant for ReflectapiDemoTestsSerdeShape: {data}") - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance(self.root, ReflectapiDemoTestsSerdeShapeCircleVariant): - return {"Circle": self.root.model_dump()} - if isinstance(self.root, ReflectapiDemoTestsSerdeShapeRectVariant): - return {"Rect": self.root.model_dump()} - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeShape variant: {type(self.root)}" - ) - - -class ReflectapiDemoTestsSerdeDrawing(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - shape: reflectapi_demo.tests.serde.Shape - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - ShapeCircleVariant = ReflectapiDemoTestsSerdeShapeCircleVariant - ShapeRectVariant = ReflectapiDemoTestsSerdeShapeRectVariant - Shape = ReflectapiDemoTestsSerdeShape - Drawing = ReflectapiDemoTestsSerdeDrawing - - class AsyncInoutClient: """Async client for inout operations.""" @@ -158,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -201,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -212,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Drawing.model_rebuild() - reflectapi_demo.tests.serde.Shape.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap index fbcba807..fc618aef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,67 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -# Type variables for generic types - - -Additional = TypeVar("Additional") - -Payload = TypeVar("Payload") - - -class ReflectapiDemoTestsSerdeS(BaseModel, Generic[Payload, Additional]): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeA(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - a: int - - -class ReflectapiDemoTestsSerdeB(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - b: int - - -class ReflectapiDemoTestsSerdeTestS(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["S"] = Field(default="S", description="Discriminator field") - payload: Annotated[Any, "External type: Payload"] - additional: Annotated[Any, "External type: Additional"] - - -class ReflectapiDemoTestsSerdeTest(RootModel): - root: Annotated[Union[ReflectapiDemoTestsSerdeTestS], Field(discriminator="type")] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - S = ReflectapiDemoTestsSerdeS - A = ReflectapiDemoTestsSerdeA - B = ReflectapiDemoTestsSerdeB - TestS = ReflectapiDemoTestsSerdeTestS - Test = ReflectapiDemoTestsSerdeTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -126,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -169,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -180,10 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.A.model_rebuild() - reflectapi_demo.tests.serde.B.model_rebuild() - reflectapi_demo.tests.serde.S.model_rebuild() - reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index 3a45e12b..e7f23bad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Offer > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,92 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeOfferKindSingle(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Single"] = Field(default="Single", description="Discriminator field") - business: str - - -class ReflectapiDemoTestsSerdeOfferKindGroup(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Group"] = Field(default="Group", description="Discriminator field") - count: int - - -class ReflectapiDemoTestsSerdeOfferKind(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeOfferKindSingle, - ReflectapiDemoTestsSerdeOfferKindGroup, - ], - Field(discriminator="type"), - ] - - -class ReflectapiDemoTestsSerdeOfferSingle(BaseModel): - """'Single' variant of ReflectapiDemoTestsSerdeOffer""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - id: str - type_: Literal["Single"] = Field( - default="Single", - serialization_alias="type", - validation_alias="type", - description="Discriminator field", - ) - business: str - - -class ReflectapiDemoTestsSerdeOfferGroup(BaseModel): - """'Group' variant of ReflectapiDemoTestsSerdeOffer""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - id: str - type_: Literal["Group"] = Field( - default="Group", - serialization_alias="type", - validation_alias="type", - description="Discriminator field", - ) - count: int - - -class ReflectapiDemoTestsSerdeOffer(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeOfferSingle, - ReflectapiDemoTestsSerdeOfferGroup, - ], - Field(discriminator="type_"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - OfferKindSingle = ReflectapiDemoTestsSerdeOfferKindSingle - OfferKindGroup = ReflectapiDemoTestsSerdeOfferKindGroup - OfferKind = ReflectapiDemoTestsSerdeOfferKind - OfferSingle = ReflectapiDemoTestsSerdeOfferSingle - OfferGroup = ReflectapiDemoTestsSerdeOfferGroup - Offer = ReflectapiDemoTestsSerdeOffer - - class AsyncInoutClient: """Async client for inout operations.""" @@ -151,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -194,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -205,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Offer.model_rebuild() - reflectapi_demo.tests.serde.OfferKind.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap index 4b126e61..da003cf0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Document > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,51 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTimestamps(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - created_at: str - updated_at: str - - -class ReflectapiDemoTestsSerdeMetadata(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - author: str - version: int - - -class ReflectapiDemoTestsSerdeDocument(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - title: str - created_at: str - updated_at: str - author: str - version: int - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Timestamps = ReflectapiDemoTestsSerdeTimestamps - Metadata = ReflectapiDemoTestsSerdeMetadata - Document = ReflectapiDemoTestsSerdeDocument - - class AsyncInoutClient: """Async client for inout operations.""" @@ -109,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -152,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -163,9 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Document.model_rebuild() - reflectapi_demo.tests.serde.Metadata.model_rebuild() - reflectapi_demo.tests.serde.Timestamps.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap index 5f61ed83..ebb6e36f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Task > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,79 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdePriorityHigh(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - kind: Literal["High"] = Field(default="High", description="Discriminator field") - deadline: str - - -class ReflectapiDemoTestsSerdePriorityLow(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - kind: Literal["Low"] = Field(default="Low", description="Discriminator field") - - -class ReflectapiDemoTestsSerdePriority(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdePriorityHigh, ReflectapiDemoTestsSerdePriorityLow - ], - Field(discriminator="kind"), - ] - - -class ReflectapiDemoTestsSerdeTaskHigh(BaseModel): - """'High' variant of ReflectapiDemoTestsSerdeTask""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - title: str - kind: Literal["High"] = Field(default="High", description="Discriminator field") - deadline: str - - -class ReflectapiDemoTestsSerdeTaskLow(BaseModel): - """'Low' variant of ReflectapiDemoTestsSerdeTask""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - title: str - kind: Literal["Low"] = Field(default="Low", description="Discriminator field") - - -class ReflectapiDemoTestsSerdeTask(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeTaskHigh, - ReflectapiDemoTestsSerdeTaskLow, - ], - Field(discriminator="kind"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - PriorityHigh = ReflectapiDemoTestsSerdePriorityHigh - PriorityLow = ReflectapiDemoTestsSerdePriorityLow - Priority = ReflectapiDemoTestsSerdePriority - TaskHigh = ReflectapiDemoTestsSerdeTaskHigh - TaskLow = ReflectapiDemoTestsSerdeTaskLow - Task = ReflectapiDemoTestsSerdeTask - - class AsyncInoutClient: """Async client for inout operations.""" @@ -138,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -181,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -192,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Priority.model_rebuild() - reflectapi_demo.tests.serde.Task.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap index 759d81bc..5ed42854 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Post > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,104 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeAudit(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - modified_by: str - - -class ReflectapiDemoTestsSerdeContentText(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Text"] = Field(default="Text", description="Discriminator field") - body: str - - -class ReflectapiDemoTestsSerdeContentImage(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["Image"] = Field(default="Image", description="Discriminator field") - url: str - width: int - - -class ReflectapiDemoTestsSerdeContent(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdeContentText, ReflectapiDemoTestsSerdeContentImage - ], - Field(discriminator="type"), - ] - - -class ReflectapiDemoTestsSerdePostText(BaseModel): - """'Text' variant of ReflectapiDemoTestsSerdePost""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - id: str - modified_by: str - type_: Literal["Text"] = Field( - default="Text", - serialization_alias="type", - validation_alias="type", - description="Discriminator field", - ) - body: str - - -class ReflectapiDemoTestsSerdePostImage(BaseModel): - """'Image' variant of ReflectapiDemoTestsSerdePost""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - id: str - modified_by: str - type_: Literal["Image"] = Field( - default="Image", - serialization_alias="type", - validation_alias="type", - description="Discriminator field", - ) - url: str - width: int - - -class ReflectapiDemoTestsSerdePost(RootModel): - root: Annotated[ - Union[ - ReflectapiDemoTestsSerdePostText, - ReflectapiDemoTestsSerdePostImage, - ], - Field(discriminator="type_"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Audit = ReflectapiDemoTestsSerdeAudit - ContentText = ReflectapiDemoTestsSerdeContentText - ContentImage = ReflectapiDemoTestsSerdeContentImage - Content = ReflectapiDemoTestsSerdeContent - PostText = ReflectapiDemoTestsSerdePostText - PostImage = ReflectapiDemoTestsSerdePostImage - Post = ReflectapiDemoTestsSerdePost - - class AsyncInoutClient: """Async client for inout operations.""" @@ -163,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -206,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -217,9 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Audit.model_rebuild() - reflectapi_demo.tests.serde.Content.model_rebuild() - reflectapi_demo.tests.serde.Post.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap index a0506c13..6c2d6b3f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Outer > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,48 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInner(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - z: str - - -class ReflectapiDemoTestsSerdeMiddle(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - y: int - z: str - - -class ReflectapiDemoTestsSerdeOuter(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - x: str - y: int - z: str - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Inner = ReflectapiDemoTestsSerdeInner - Middle = ReflectapiDemoTestsSerdeMiddle - Outer = ReflectapiDemoTestsSerdeOuter - - class AsyncInoutClient: """Async client for inout operations.""" @@ -106,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -149,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -160,9 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Inner.model_rebuild() - reflectapi_demo.tests.serde.Middle.model_rebuild() - reflectapi_demo.tests.serde.Outer.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap index 2986ef9b..cfee4fbd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < S > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,42 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -# Type variables for generic types - - -Additional = TypeVar("Additional") - -Payload = TypeVar("Payload") - - -class ReflectapiDemoTestsSerdeS(BaseModel, Generic[Payload, Additional]): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeK(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - a: int - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - S = ReflectapiDemoTestsSerdeS - K = ReflectapiDemoTestsSerdeK - - class AsyncInoutClient: """Async client for inout operations.""" @@ -68,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] - ]: + data: Optional[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]]: """ Args: @@ -90,9 +50,7 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.serde.S[ - reflectapi_demo.tests.serde.K, None - ], + response_model=reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None], ) @@ -106,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -117,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] - ]: + data: Optional[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]]: """ Args: @@ -139,9 +94,7 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.serde.S[ - reflectapi_demo.tests.serde.K, None - ], + response_model=reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None], ) @@ -155,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -166,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.K.model_rebuild() - reflectapi_demo.tests.serde.S.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap index 2b611666..76d7ad0e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Cell > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,52 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeValueNum(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - value: float - - -class ReflectapiDemoTestsSerdeValueText(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - text: str - - -ReflectapiDemoTestsSerdeValue = Union[ - ReflectapiDemoTestsSerdeValueNum, ReflectapiDemoTestsSerdeValueText -] - - -class ReflectapiDemoTestsSerdeCell(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - label: str - content: reflectapi_demo.tests.serde.Value - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - ValueNum = ReflectapiDemoTestsSerdeValueNum - ValueText = ReflectapiDemoTestsSerdeValueText - Value = ReflectapiDemoTestsSerdeValue - Cell = ReflectapiDemoTestsSerdeCell - - class AsyncInoutClient: """Async client for inout operations.""" @@ -111,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -154,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -165,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Cell.model_rebuild() - reflectapi_demo.tests.serde.Value.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap index f0785457..ef10993b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Tagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,81 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -# Type variables for generic types - - -T = TypeVar("T") - - -class ReflectapiDemoTestsSerdeTaggedItemVariant(BaseModel, Generic[T]): - """Item variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: T - - -# Adjacently tagged enum using RootModel -ReflectapiDemoTestsSerdeTaggedVariants = Union[ - ReflectapiDemoTestsSerdeTaggedItemVariant, Literal["Nothing"] -] - - -class ReflectapiDemoTestsSerdeTagged( - RootModel[ReflectapiDemoTestsSerdeTaggedVariants], Generic[T] -): - """Adjacently tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_adjacently_tagged(cls, data): - # Handle direct variant instances - if isinstance(data, (ReflectapiDemoTestsSerdeTaggedItemVariant)): - return data - if isinstance(data, dict): - tag = data.get("t") - content = data.get("c") - if tag is None: - raise ValueError("Missing tag field 't'") - if content is None and tag not in ("Nothing"): - raise ValueError("Missing content field 'c' for tag: {}".format(tag)) - # Dispatch based on tag - if tag == "Item": - return ReflectapiDemoTestsSerdeTaggedItemVariant(field_0=content) - if tag == "Nothing": - return "Nothing" - raise ValueError( - "Unknown variant for ReflectapiDemoTestsSerdeTagged: {}".format(data) - ) - - @model_serializer - def _serialize_adjacently_tagged(self): - if isinstance(self.root, ReflectapiDemoTestsSerdeTaggedItemVariant): - return {"t": "Item", "c": self.root.field_0} - if self.root == "Nothing": - return {"t": "Nothing"} - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTagged variant: {type(self.root)}" - ) - - def __class_getitem__(cls, params): - return cls - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TaggedItemVariant = ReflectapiDemoTestsSerdeTaggedItemVariant - Tagged = ReflectapiDemoTestsSerdeTagged - - class AsyncInoutClient: """Async client for inout operations.""" @@ -147,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -190,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -201,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Tagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap index 4b46cf16..0fd0452b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Wrapper > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,85 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -# Type variables for generic types - - -T = TypeVar("T") - - -T = TypeVar("T") - - -class ReflectapiDemoTestsSerdeWrapperValueVariant(BaseModel, Generic[T]): - """Value variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: T - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeWrapperVariants = Union[ - ReflectapiDemoTestsSerdeWrapperValueVariant[T], Literal["Empty"] -] - - -class ReflectapiDemoTestsSerdeWrapper( - RootModel[ReflectapiDemoTestsSerdeWrapperVariants], Generic[T] -): - """Externally tagged enum""" - - @classmethod - def __class_getitem__(cls, params): - return cls - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance(data, ReflectapiDemoTestsSerdeWrapperValueVariant): - return data - - # Handle JSON data (for deserialization) - if isinstance(data, str) and data == "Empty": - return data - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "Value": - return ReflectapiDemoTestsSerdeWrapperValueVariant(field_0=value) - - raise ValueError(f"Unknown variant for ReflectapiDemoTestsSerdeWrapper: {data}") - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance(self.root, ReflectapiDemoTestsSerdeWrapperValueVariant): - return {"Value": self.root.field_0} - if self.root == "Empty": - return "Empty" - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeWrapper variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - WrapperValueVariant = ReflectapiDemoTestsSerdeWrapperValueVariant - Wrapper = ReflectapiDemoTestsSerdeWrapper - - class AsyncInoutClient: """Async client for inout operations.""" @@ -151,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -194,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -205,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Wrapper.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap index f3a9a9c0..8f1138f2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTest(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="field-name", validation_alias="field-name" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Test = ReflectapiDemoTestsSerdeTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap index 9d66aa03..1b9df25f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Underscored > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeUnderscored(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - single: int = Field(serialization_alias="_single", validation_alias="_single") - double: str = Field(serialization_alias="__double", validation_alias="__double") - triple: bool = Field(serialization_alias="___triple", validation_alias="___triple") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Underscored = ReflectapiDemoTestsSerdeUnderscored - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Underscored.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap index 0d8d3a50..263f0ad4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < deep::nested::inner::DeepType > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,36 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeDeepNestedInnerDeepType(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - data: str - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class deep: - """Namespace for deep types.""" - - class nested: - """Namespace for nested types.""" - - class inner: - """Namespace for inner types.""" - - DeepType = ReflectapiDemoTestsSerdeDeepNestedInnerDeepType - - class AsyncInoutClient: """Async client for inout operations.""" @@ -94,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -137,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -148,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.deep.nested.inner.DeepType.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap index 68877877..2199fad3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < SimpleTopLevel > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,27 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeSimpleTopLevel(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - value: int - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - SimpleTopLevel = ReflectapiDemoTestsSerdeSimpleTopLevel - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.SimpleTopLevel.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap index c6e1187f..6ba0bd1a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TypeWithNumbers > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,30 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTypeWithNumbers(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_123: str = Field(serialization_alias="123start", validation_alias="123start") - kebab_field: int = Field( - serialization_alias="kebab-field", validation_alias="kebab-field" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TypeWithNumbers = ReflectapiDemoTestsSerdeTypeWithNumbers - - class AsyncInoutClient: """Async client for inout operations.""" @@ -88,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -131,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -142,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TypeWithNumbers.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap index 24676488..6aa80a0e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Complex > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,28 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeComplex(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - matrix: list[list[int]] - lookup: dict[str, list[int | None]] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Complex = ReflectapiDemoTestsSerdeComplex - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Complex.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap index 77cb56bb..fc618aef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,102 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeV2C(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["C"] = Field(default="C", description="Discriminator field") - c: int - - -class ReflectapiDemoTestsSerdeV2D(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["D"] = Field(default="D", description="Discriminator field") - d: int - - -class ReflectapiDemoTestsSerdeV2(RootModel): - root: Annotated[ - Union[ReflectapiDemoTestsSerdeV2C, ReflectapiDemoTestsSerdeV2D], - Field(discriminator="type"), - ] - - -class ReflectapiDemoTestsSerdeV1A(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["A"] = Field(default="A", description="Discriminator field") - a: int - - -class ReflectapiDemoTestsSerdeV1B(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["B"] = Field(default="B", description="Discriminator field") - b: int - - -class ReflectapiDemoTestsSerdeV1(RootModel): - root: Annotated[ - Union[ReflectapiDemoTestsSerdeV1A, ReflectapiDemoTestsSerdeV1B], - Field(discriminator="type"), - ] - - -class ReflectapiDemoTestsSerdeTestV1(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - version: Literal["v1"] = Field(default="v1", description="Discriminator field") - value: reflectapi_demo.tests.serde.V1 = Field(description="Tuple variant value") - - -class ReflectapiDemoTestsSerdeTestV2(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - version: Literal["v2"] = Field(default="v2", description="Discriminator field") - value: reflectapi_demo.tests.serde.V2 = Field(description="Tuple variant value") - - -class ReflectapiDemoTestsSerdeTest(RootModel): - root: Annotated[ - Union[ReflectapiDemoTestsSerdeTestV1, ReflectapiDemoTestsSerdeTestV2], - Field(discriminator="version"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - V2C = ReflectapiDemoTestsSerdeV2C - V2D = ReflectapiDemoTestsSerdeV2D - V2 = ReflectapiDemoTestsSerdeV2 - V1A = ReflectapiDemoTestsSerdeV1A - V1B = ReflectapiDemoTestsSerdeV1B - V1 = ReflectapiDemoTestsSerdeV1 - TestV1 = ReflectapiDemoTestsSerdeTestV1 - TestV2 = ReflectapiDemoTestsSerdeTestV2 - Test = ReflectapiDemoTestsSerdeTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -161,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -204,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -215,9 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Test.model_rebuild() - reflectapi_demo.tests.serde.V1.model_rebuild() - reflectapi_demo.tests.serde.V2.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap index 8983c931..fc618aef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,50 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeV1A(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["A"] = Field(default="A", description="Discriminator field") - a: int - - -class ReflectapiDemoTestsSerdeV1(RootModel): - root: Annotated[Union[ReflectapiDemoTestsSerdeV1A], Field(discriminator="type")] - - -class ReflectapiDemoTestsSerdeTestV1(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - version: Literal["v1"] = Field(default="v1", description="Discriminator field") - value: reflectapi_demo.tests.serde.V1 = Field(description="Tuple variant value") - - -class ReflectapiDemoTestsSerdeTest(RootModel): - root: Annotated[ - Union[ReflectapiDemoTestsSerdeTestV1], Field(discriminator="version") - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - V1A = ReflectapiDemoTestsSerdeV1A - V1 = ReflectapiDemoTestsSerdeV1 - TestV1 = ReflectapiDemoTestsSerdeTestV1 - Test = ReflectapiDemoTestsSerdeTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -109,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -152,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -163,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Test.model_rebuild() - reflectapi_demo.tests.serde.V1.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index 115ec490..b0306ec4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestNewtypeVariantsAdjacentlyTagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,135 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant(BaseModel): - """int variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: int - - -class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant( - BaseModel -): - """string variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: str - - -class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant(BaseModel): - """bool variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: bool - - -# Adjacently tagged enum using RootModel -ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedVariants = Union[ - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant, - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant, - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant, - Literal["unit"], -] - - -class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( - RootModel[ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedVariants] -): - """Adjacently tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_adjacently_tagged(cls, data): - # Handle direct variant instances - if isinstance( - data, - ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant, - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant, - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant, - ), - ): - return data - if isinstance(data, dict): - tag = data.get("t") - content = data.get("c") - if tag is None: - raise ValueError("Missing tag field 't'") - if content is None and tag not in ("unit"): - raise ValueError("Missing content field 'c' for tag: {}".format(tag)) - # Dispatch based on tag - if tag == "int": - return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant( - field_0=content - ) - if tag == "string": - return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant( - field_0=content - ) - if tag == "bool": - return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant( - field_0=content - ) - if tag == "unit": - return "unit" - raise ValueError( - "Unknown variant for ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: {}".format( - data - ) - ) - - @model_serializer - def _serialize_adjacently_tagged(self): - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant, - ): - return {"t": "int", "c": self.root.field_0} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant, - ): - return {"t": "string", "c": self.root.field_0} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant, - ): - return {"t": "bool", "c": self.root.field_0} - if self.root == "unit": - return {"t": "unit"} - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestNewtypeVariantsAdjacentlyTaggedIntVariant = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant - ) - TestNewtypeVariantsAdjacentlyTaggedStringVariant = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant - ) - TestNewtypeVariantsAdjacentlyTaggedBoolVariant = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant - ) - TestNewtypeVariantsAdjacentlyTagged = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -169,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: """ @@ -203,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -214,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: """ @@ -248,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -259,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index d6d24b76..c74a247f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestNewtypeVariantsExternallyTagged > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -17,14 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import ( - BaseModel, - ConfigDict, - PrivateAttr, - RootModel, - model_serializer, - model_validator, -) +from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -32,139 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant(BaseModel): - """int variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: int - - -class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant( - BaseModel -): - """string variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: str - - -class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant(BaseModel): - """bool variant""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_0: bool - - -# Externally tagged enum using RootModel -ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedVariants = Union[ - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant, - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant, - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant, - Literal["unit"], -] - - -class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( - RootModel[ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedVariants] -): - """Externally tagged enum""" - - @model_validator(mode="before") - @classmethod - def _validate_externally_tagged(cls, data): - # Handle direct variant instances (for programmatic creation) - if isinstance( - data, ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant - ): - return data - if isinstance( - data, - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant, - ): - return data - if isinstance( - data, ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant - ): - return data - - # Handle JSON data (for deserialization) - if isinstance(data, str) and data == "unit": - return data - - if isinstance(data, dict): - if len(data) != 1: - raise ValueError("Externally tagged enum must have exactly one key") - - key, value = next(iter(data.items())) - if key == "int": - return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant( - field_0=value - ) - if key == "string": - return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant( - field_0=value - ) - if key == "bool": - return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant( - field_0=value - ) - - raise ValueError( - f"Unknown variant for ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: {data}" - ) - - @model_serializer - def _serialize_externally_tagged(self): - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant, - ): - return {"int": self.root.field_0} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant, - ): - return {"string": self.root.field_0} - if isinstance( - self.root, - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant, - ): - return {"bool": self.root.field_0} - if self.root == "unit": - return "unit" - - raise ValueError( - f"Cannot serialize ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged variant: {type(self.root)}" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestNewtypeVariantsExternallyTaggedIntVariant = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant - ) - TestNewtypeVariantsExternallyTaggedStringVariant = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant - ) - TestNewtypeVariantsExternallyTaggedBoolVariant = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant - ) - TestNewtypeVariantsExternallyTagged = ( - ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -173,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: """ @@ -207,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -218,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: """ @@ -252,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -263,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap index 952ee48f..96708a1e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Enum > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,68 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeStrukt2(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - c: int - d: int - - -class ReflectapiDemoTestsSerdeStrukt1(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - a: int - b: int - - -class ReflectapiDemoTestsSerdeEnumA(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["a"] = Field(default="a", description="Discriminator field") - a: int - b: int - - -class ReflectapiDemoTestsSerdeEnumB(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - type: Literal["b"] = Field(default="b", description="Discriminator field") - c: int - d: int - - -class ReflectapiDemoTestsSerdeEnum(RootModel): - root: Annotated[ - Union[ReflectapiDemoTestsSerdeEnumA, ReflectapiDemoTestsSerdeEnumB], - Field(discriminator="type"), - ] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Strukt2 = ReflectapiDemoTestsSerdeStrukt2 - Strukt1 = ReflectapiDemoTestsSerdeStrukt1 - EnumA = ReflectapiDemoTestsSerdeEnumA - EnumB = ReflectapiDemoTestsSerdeEnumB - Enum = ReflectapiDemoTestsSerdeEnum - - class AsyncInoutClient: """Async client for inout operations.""" @@ -127,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -170,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -181,9 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Enum.model_rebuild() - reflectapi_demo.tests.serde.Strukt1.model_rebuild() - reflectapi_demo.tests.serde.Strukt2.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap index a34a7a72..c32d9e38 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Nested > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,27 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - value: str | None | None = None - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Nested = ReflectapiDemoTestsSerdeNested - - class AsyncInoutClient: """Async client for inout operations.""" @@ -86,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -129,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -140,7 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Nested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap index a0db04e6..275902e6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Category > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,28 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeCategory(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - name: str - subcategories: list[reflectapi_demo.tests.serde.Category] - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Category = ReflectapiDemoTestsSerdeCategory - - class AsyncInoutClient: """Async client for inout operations.""" @@ -86,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -129,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -140,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Category.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap index 5c8a4930..2d40ae65 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRename > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,25 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeMyStruct(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - MyStruct = ReflectapiDemoTestsSerdeMyStruct - - class AsyncInoutClient: """Async client for inout operations.""" @@ -83,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -126,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -137,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.MyStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap index 02ff4550..7b776b48 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameAll > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="fieldName", validation_alias="fieldName" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStructRenameAll = ReflectapiDemoTestsSerdeTestStructRenameAll - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStructRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap index 80891709..cebc9f26 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameAllDifferently > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,49 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int - - -class ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="fieldName", validation_alias="fieldName" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestStructRenameAllDifferently = ( - ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently - ) - - class output: - """Namespace for output types.""" - - TestStructRenameAllDifferently = ( - ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -75,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently - ] = None, + data: Optional[reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: """ @@ -109,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -120,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently - ] = None, + data: Optional[reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: """ @@ -154,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -165,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently.model_rebuild() - reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap index 9a265517..2e3657bc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameAllPascalCase > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,31 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="FieldName", validation_alias="FieldName" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStructRenameAllPascalCase = ( - ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -57,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructRenameAllPascalCase - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: """ @@ -91,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -102,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructRenameAllPascalCase - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: """ @@ -136,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -147,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStructRenameAllPascalCase.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap index be4a501d..c141d994 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameField > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,49 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestStructRenameField(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="fieldName", validation_alias="fieldName" - ) - - -class ReflectapiDemoTestsSerdeOutputTestStructRenameField(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestStructRenameField = ( - ReflectapiDemoTestsSerdeInputTestStructRenameField - ) - - class output: - """Namespace for output types.""" - - TestStructRenameField = ( - ReflectapiDemoTestsSerdeOutputTestStructRenameField - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -107,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -150,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -161,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestStructRenameField.model_rebuild() - reflectapi_demo.tests.serde.output.TestStructRenameField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap index 28ca6e4c..8f1138f2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,27 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTest(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - inner: bytes - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - Test = ReflectapiDemoTestsSerdeTest - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap index 8aff4f19..faff7100 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithFlatten > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,38 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int - - -class ReflectapiDemoTestsSerdeTestStructWithFlatten(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStructWithFlattenNested = ( - ReflectapiDemoTestsSerdeTestStructWithFlattenNested - ) - TestStructWithFlatten = ReflectapiDemoTestsSerdeTestStructWithFlatten - - class AsyncInoutClient: """Async client for inout operations.""" @@ -96,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -139,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -150,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStructWithFlatten.model_rebuild() - reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap index 104dae7e..007aa73b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithFlattenOptional > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,40 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int - - -class ReflectapiDemoTestsSerdeTestStructWithFlattenOptional(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int | None = None - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStructWithFlattenNested = ( - ReflectapiDemoTestsSerdeTestStructWithFlattenNested - ) - TestStructWithFlattenOptional = ( - ReflectapiDemoTestsSerdeTestStructWithFlattenOptional - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -67,9 +33,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructWithFlattenOptional - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptional] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: """ @@ -101,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -112,9 +77,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructWithFlattenOptional - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptional] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: """ @@ -146,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -157,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() - reflectapi_demo.tests.serde.TestStructWithFlattenOptional.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap index 98a5635c..458e538a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithFlattenOptionalAndRequired > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,54 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="fieldName", validation_alias="fieldName" - ) - - -class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int - - -class ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int | None = None - field_name: int = Field( - serialization_alias="fieldName", validation_alias="fieldName" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStructRenameAll = ReflectapiDemoTestsSerdeTestStructRenameAll - TestStructWithFlattenNested = ( - ReflectapiDemoTestsSerdeTestStructWithFlattenNested - ) - TestStructWithFlattenOptionalAndRequired = ( - ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -81,12 +33,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired - ]: + data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: """ Args: @@ -117,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,12 +77,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired - ]: + data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: """ Args: @@ -164,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -175,9 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStructRenameAll.model_rebuild() - reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() - reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap index c3d0523b..9e9605c5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithRenameToInvalidChars > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="field-name&&", validation_alias="field-name&&") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStructWithRenameToInvalidChars = ( - ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -55,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: """ @@ -89,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -100,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars - ] = None, + data: Optional[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: """ @@ -134,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -145,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap index d9057077..2759d22e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithRenameToKebabCase > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,29 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeStructName(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - field_name: int = Field( - serialization_alias="field-name", validation_alias="field-name" - ) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - StructName = ReflectapiDemoTestsSerdeStructName - - class AsyncInoutClient: """Async client for inout operations.""" @@ -87,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -130,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -141,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.StructName.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap index 2d286947..b032e97e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeDefault > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,47 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int | None = None - - -class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestStructWithSerdeDefault = ( - ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault - ) - - class output: - """Namespace for output types.""" - - TestStructWithSerdeDefault = ( - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -73,9 +32,7 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault - ] = None, + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: """ @@ -107,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -118,9 +76,7 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault - ] = None, + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: """ @@ -152,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -163,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault.model_rebuild() - reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap index 08d9fcb9..580da73c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkip > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,25 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStructWithSerdeSkip(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStructWithSerdeSkip = ReflectapiDemoTestsSerdeTestStructWithSerdeSkip - - class AsyncInoutClient: """Async client for inout operations.""" @@ -83,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -126,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -137,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStructWithSerdeSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap index e501631f..5e618fe2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkipDeserialize > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,45 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestStructWithSerdeSkipDeserialize = ( - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize - ) - - class output: - """Namespace for output types.""" - - TestStructWithSerdeSkipDeserialize = ( - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -71,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: """ Args: @@ -107,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -118,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: """ Args: @@ -154,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -165,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize.model_rebuild() - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap index ec3e73c4..50ad47bf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkipSerialize > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,45 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - -class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int = Field(serialization_alias="_f", validation_alias="_f") - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class output: - """Namespace for output types.""" - - TestStructWithSerdeSkipSerialize = ( - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize - ) - - class input: - """Namespace for input types.""" - - TestStructWithSerdeSkipSerialize = ( - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -71,12 +32,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: """ Args: @@ -107,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -118,12 +76,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: """ Args: @@ -154,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -165,8 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize.model_rebuild() - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap index 937a231b..819a9fdf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkipSerializeIf > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -25,47 +25,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int | None = None - - -class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - f: int | None = None - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - class input: - """Namespace for input types.""" - - TestStructWithSerdeSkipSerializeIf = ( - ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf - ) - - class output: - """Namespace for output types.""" - - TestStructWithSerdeSkipSerializeIf = ( - ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf - ) - - class AsyncInoutClient: """Async client for inout operations.""" @@ -74,12 +33,8 @@ class AsyncInoutClient: async def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: """ Args: @@ -110,6 +65,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -121,12 +77,8 @@ class InoutClient: def test( self, - data: Optional[ - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf - ] = None, - ) -> ApiResponse[ - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf - ]: + data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf] = None, + ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: """ Args: @@ -157,6 +109,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -168,8 +121,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf.model_rebuild() - reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap index 0b680853..e5934192 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStruct > ()" --- -""" +''' Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -""" +''' from __future__ import annotations @@ -24,27 +24,6 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible -class ReflectapiDemoTestsSerdeTestStruct(BaseModel): - """Generated data model.""" - - model_config = ConfigDict(extra="ignore", populate_by_name=True) - - timezone: str - - -# Namespace classes for dotted access to types -class reflectapi_demo: - """Namespace for reflectapi_demo types.""" - - class tests: - """Namespace for tests types.""" - - class serde: - """Namespace for serde types.""" - - TestStruct = ReflectapiDemoTestsSerdeTestStruct - - class AsyncInoutClient: """Async client for inout operations.""" @@ -85,6 +64,7 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = AsyncInoutClient(self) @@ -128,6 +108,7 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) + self.inout = InoutClient(self) @@ -139,7 +120,6 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: - reflectapi_demo.tests.serde.TestStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index d79fb660..dd232b14 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -773,30 +773,60 @@ impl Normalizer { // Phase 0: Ensure all symbols have unique, stable IDs crate::ids::ensure_symbol_ids(&mut schema); - // Snapshot original type names before the pipeline transforms them. - // NamingResolutionStage strips module paths, so we need to preserve - // the pre-normalization qualified names for codegen backends. - let original_names: HashMap = schema + // Capture original type names BEFORE the pipeline transforms them. + // Key: SymbolId path (stable across renames). Value: original name. + // SymbolId is set by ensure_symbol_ids and stays stable even after + // NamingResolutionStage changes the type's name and id.path. + // Wait — rename_type updates id.path too. So we need a different + // stable key. Use the original name itself as both key and value, + // indexed by a generated sequential ID. + let mut pre_norm_by_index: Vec = Vec::new(); + // Also build a map from pre-norm name to index + let mut pre_norm_index: HashMap = HashMap::new(); + for (i, t) in schema .input_types .types() .chain(schema.output_types.types()) - .map(|t| { - let name = t.name().to_string(); - // The id.path at this point is the original qualified path - // (set by ensure_symbol_ids, before NamingResolution) - let original = match t { - Type::Primitive(p) => p.id.qualified_name(), - Type::Struct(s) => s.id.qualified_name(), - Type::Enum(e) => e.id.qualified_name(), - }; - (name, original) - }) - .collect(); + .enumerate() + { + let name = t.name().to_string(); + pre_norm_index.insert(name.clone(), i); + pre_norm_by_index.push(name); + } - // Phase 0.5: Run the standard normalization pipeline (type consolidation, - // naming resolution, circular dependency resolution) before symbol discovery + // Phase 0.5: Run the standard normalization pipeline NormalizationPipeline::standard().run(&mut schema)?; + // After the pipeline, types may have been renamed AND reordered. + // TypeConsolidation merges input+output into input_types. + // NamingResolution strips module paths. + // We can't match by position. Instead, match by the type's + // content (fields, variants) — but that's expensive. + // Simpler: just store the post-norm name as the key and + // the pre-norm name as the value. Since both input and output + // had consolidate_types run, the pre-norm name IS the + // fully-qualified name that the raw Schema has. + // + // Actually: the pre_norm_index keys are the pre-normalization + // names. NamingResolution transforms those into short names. + // The mapping we need is: short_name → qualified_name. + // We can't build this after the pipeline because we don't know + // which pre-norm name became which post-norm name. + // + // The real solution: have NamingResolutionStage record its + // name mappings. For now, build the reverse mapping from + // the NamingResolution logic: short name is the last :: + // segment of the qualified name. If unique, maps 1:1. + let mut original_names: HashMap = HashMap::new(); + for pre_name in &pre_norm_by_index { + // NamingResolution strips to last :: segment + let short = pre_name.split("::").last().unwrap_or(pre_name); + // Only set if not already taken (first wins for collisions) + original_names + .entry(short.to_string()) + .or_insert_with(|| pre_name.clone()); + } + // Phase 1: Symbol Discovery self.discover_symbols(&schema)?; diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 6ab1e546..d625d72a 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, BTreeSet, HashSet, VecDeque}; +use std::collections::{BTreeMap, BTreeSet, HashSet}; use crate::{Schema, TypeReference}; use reflectapi_schema::{Function, Type}; @@ -196,128 +196,7 @@ fn generate_optimized_imports(imports: &templates::Imports) -> String { /// * `type_names` - List of type names to sort /// * `schema` - Schema containing type definitions and their dependencies /// -/// # Returns -/// * `Ok(Vec)` - Types sorted in dependency order (dependencies first) -/// * `Err` - If circular dependencies are detected in the type graph -fn topological_sort_types(type_names: &[String], schema: &Schema) -> anyhow::Result> { - let mut dependencies: BTreeMap> = BTreeMap::new(); - let mut in_degree: BTreeMap = BTreeMap::new(); - - // Initialize in-degree count for all types - for type_name in type_names { - in_degree.insert(type_name.clone(), 0); - dependencies.insert(type_name.clone(), BTreeSet::new()); - } - - // Build dependency graph - if A depends on B, then B must be defined before A - for type_name in type_names { - if let Some(type_def) = schema.get_type(type_name) { - let deps = collect_type_dependencies(type_def, type_names); - for dep in &deps { - if type_names.contains(dep) && dep != type_name { - // type_name depends on dep, so dep must come before type_name - dependencies.get_mut(type_name).unwrap().insert(dep.clone()); - *in_degree.get_mut(type_name).unwrap() += 1; - } - } - } - } - - // Kahn's algorithm for topological sorting - let mut queue: VecDeque = VecDeque::new(); - let mut result = Vec::new(); - - // Start with types that have no dependencies - for (type_name, °ree) in &in_degree { - if degree == 0 { - queue.push_back(type_name.clone()); - } - } - - while let Some(current) = queue.pop_front() { - result.push(current.clone()); - - // Reduce in-degree for types that depend on the current type - for other_type in type_names { - if dependencies.get(other_type).unwrap().contains(¤t) { - *in_degree.get_mut(other_type).unwrap() -= 1; - if in_degree[other_type] == 0 { - queue.push_back(other_type.clone()); - } - } - } - } - - // Check for cycles - if result.len() != type_names.len() { - let remaining: Vec<_> = type_names.iter().filter(|n| !result.contains(n)).collect(); - return Err(anyhow::anyhow!( - "Circular dependency detected in types: {:?}", - remaining - )); - } - - Ok(result) -} - -/// Collect all type dependencies for a given type -fn collect_type_dependencies(type_def: &Type, available_types: &[String]) -> BTreeSet { - let mut deps = BTreeSet::new(); - - match type_def { - Type::Struct(struct_def) => { - for field in struct_def.fields.iter() { - collect_type_ref_dependencies(&field.type_ref, &mut deps, available_types); - } - } - Type::Enum(enum_def) => { - for variant in &enum_def.variants { - match &variant.fields { - reflectapi_schema::Fields::Named(fields) => { - for field in fields { - collect_type_ref_dependencies( - &field.type_ref, - &mut deps, - available_types, - ); - } - } - reflectapi_schema::Fields::Unnamed(fields) => { - for field in fields { - collect_type_ref_dependencies( - &field.type_ref, - &mut deps, - available_types, - ); - } - } - reflectapi_schema::Fields::None => {} - } - } - } - Type::Primitive(_) => {} - } - - deps -} - -/// Recursively collect type reference dependencies -fn collect_type_ref_dependencies( - type_ref: &TypeReference, - deps: &mut BTreeSet, - available_types: &[String], -) { - if available_types.contains(&type_ref.name) { - deps.insert(type_ref.name.clone()); - } - - // Handle generic arguments - for param in &type_ref.arguments { - collect_type_ref_dependencies(param, deps, available_types); - } -} - -/// Collect all TypeVars used by a type +/// Collect all TypeVars used by a type. fn collect_type_vars_from_type( type_def: &Type, schema: &Schema, @@ -1137,10 +1016,26 @@ fn modules_from_rendered_types( pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let implemented_types = build_implemented_types(); - // Consolidate types (merge input/output typespaces, deduplicate) - let all_type_names = schema.consolidate_types(); + // Build the semantic IR FIRST — from the original schema before + // consolidate_types mutates it. The Normalizer runs its own + // TypeConsolidation + NamingResolution internally. + let semantic = reflectapi_schema::Normalizer::new() + .normalize(&schema) + .map_err(|errors| { + anyhow::anyhow!( + "Schema normalization failed: {}", + errors + .iter() + .map(|e| e.to_string()) + .collect::>() + .join("; ") + ) + })?; - // Validate all type references exist + // Now consolidate the raw schema — needed for legacy rendering functions + // that still use schema.get_type(). This must happen AFTER the Normalizer + // clones the original schema. + let all_type_names = schema.consolidate_types(); validate_type_references(&schema)?; let mut generated_code = Vec::new(); @@ -1150,36 +1045,30 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { package_name: config.package_name.clone(), }; generated_code.push(file_header.render()); - let has_enums = all_type_names.iter().any(|name| { - if let Some(type_def) = schema.get_type(name) { - matches!(type_def, reflectapi_schema::Type::Enum(_)) - } else { - false - } - }); + // Use the semantic IR for import detection — iterate types once, + // matching on SemanticType which provides the fully resolved view. + let has_enums = semantic + .types() + .any(|t| matches!(t, reflectapi_schema::SemanticType::Enum(_))); - // Check if we need Literal import and Field discriminator (for tagged enums) let (has_literal, has_discriminated_unions, has_externally_tagged_enums) = { let mut has_literal = false; let mut has_discriminated_unions = false; let mut has_externally_tagged_enums = false; - for name in &all_type_names { - if let Some(reflectapi_schema::Type::Enum(enum_def)) = schema.get_type(name) { - match enum_def.representation { + for sem_type in semantic.types() { + if let reflectapi_schema::SemanticType::Enum(sem_enum) = sem_type { + match &sem_enum.representation { reflectapi_schema::Representation::Internal { .. } => { has_literal = true; has_discriminated_unions = true; } reflectapi_schema::Representation::External | reflectapi_schema::Representation::Adjacent { .. } => { - // Check if this enum has complex variants that need RootModel - let has_complex_variants = - enum_def.variants.iter().any(|v| match &v.fields { - reflectapi_schema::Fields::Named(_) => true, - reflectapi_schema::Fields::Unnamed(fields) => !fields.is_empty(), - reflectapi_schema::Fields::None => false, - }); + let has_complex_variants = sem_enum + .variants + .values() + .any(|v| !matches!(v.field_style, reflectapi_schema::FieldStyle::Unit)); if has_complex_variants { has_externally_tagged_enums = true; } @@ -1205,8 +1094,8 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let has_reflectapi_infallible = schema_uses_type(&schema, &all_type_names, "reflectapi::Infallible"); - // Check if we need warnings import (for deprecated functions) - let has_warnings = schema.functions().any(|f| f.deprecation_note.is_some()); + // Use semantic IR for function introspection + let has_warnings = semantic.functions().any(|f| f.deprecation_note.is_some()); // Check if we need datetime imports (for chrono and time types) let has_datetime = check_datetime_usage(&schema, &all_type_names); @@ -1246,19 +1135,23 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { "std::option::Option", ]; - // Collect TypeVars used across all types + // Collect TypeVars used across all types, using semantic IR ordering let mut used_type_vars: BTreeSet = BTreeSet::new(); - // Use topological sort if possible, fall back to alphabetical on circular dependencies - let sorted_type_names = topological_sort_types(&all_type_names, &schema).unwrap_or_else(|_| { - let mut sorted = all_type_names.clone(); - sorted.sort(); - sorted - }); - for original_type_name in &sorted_type_names { - if runtime_provided_types.contains(&original_type_name.as_str()) { + for sem_type in semantic.types() { + let original_name = sem_type.original_name(); + let resolved_name = sem_type.name(); + if runtime_provided_types.contains(&original_name) + || runtime_provided_types.contains(&resolved_name) + { continue; } - let type_def = schema.get_type(original_type_name).unwrap(); + let type_def = match schema + .get_type(original_name) + .or_else(|| schema.get_type(resolved_name)) + { + Some(t) => t, + None => continue, + }; // Collect TypeVars from this type collect_type_vars_from_type(type_def, &schema, &implemented_types, &mut used_type_vars)?; @@ -1278,24 +1171,32 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Render all types (models and enums) let mut rendered_types = BTreeMap::new(); - // Sort types topologically to handle dependencies, fall back to alphabetical on circular deps - let sorted_type_names = topological_sort_types(&all_type_names, &schema).unwrap_or_else(|_| { - // Circular dependencies detected, use alphabetical order - let mut sorted = all_type_names.clone(); - sorted.sort(); - sorted - }); - - // Track the insertion order so the module tree preserves topological ordering. + // Use SemanticSchema for type ordering — it provides deterministic + // BTreeMap ordering from the Normalizer's dependency analysis. + // Look up original names to find raw types in the Schema for rendering. let mut rendered_original_names_in_order: Vec = Vec::new(); - for original_type_name in sorted_type_names { - // Skip types provided by the runtime - if runtime_provided_types.contains(&original_type_name.as_str()) { + for sem_type in semantic.types() { + let original_type_name = sem_type.original_name().to_string(); + let resolved_name = sem_type.name().to_string(); + + if runtime_provided_types.contains(&original_type_name.as_str()) + || runtime_provided_types.contains(&resolved_name.as_str()) + { continue; } - let type_def = schema.get_type(&original_type_name).unwrap(); + // Look up the raw Type for rendering. Try original name first + // (pre-normalization, with module prefix), then resolved name. + let type_def = match schema + .get_type(&original_type_name) + .or_else(|| schema.get_type(&resolved_name)) + { + Some(t) => t, + None => { + continue; + } + }; // TypeVars have already been collected, use empty set for rendering let mut dummy_type_vars = BTreeSet::new(); @@ -1320,25 +1221,27 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // TypeVar declarations are now generated at the top of the file (after imports) - // Generate client class with nested method organization - let functions_by_name: BTreeMap = + // Generate client class with nested method organization. + // Use SemanticSchema for deterministic function ordering, but + // look up raw Function objects for rendering (render_function + // needs the raw TypeReference fields). + let raw_functions_by_name: BTreeMap = schema.functions().map(|f| (f.name.clone(), f)).collect(); - // Group functions by their prefix and separate top-level functions let mut function_groups: BTreeMap> = BTreeMap::new(); let mut top_level_functions: Vec = Vec::new(); - for function_schema in functions_by_name.values() { + for sem_func in semantic.functions() { + let function_schema = match raw_functions_by_name.get(&sem_func.name) { + Some(f) => f, + None => continue, // Skip functions not in raw schema (shouldn't happen) + }; let rendered_function = render_function(function_schema, &schema, &implemented_types)?; // Check for grouping patterns: underscore or dot notation - if let Some(separator_pos) = function_schema - .name - .find('_') - .or_else(|| function_schema.name.find('.')) - { - let group_name = &function_schema.name[..separator_pos]; - let method_name = &function_schema.name[separator_pos + 1..]; + if let Some(separator_pos) = sem_func.name.find('_').or_else(|| sem_func.name.find('.')) { + let group_name = &sem_func.name[..separator_pos]; + let method_name = &sem_func.name[separator_pos + 1..]; // Create a modified function with the shortened name for nested access let mut nested_function = rendered_function.clone(); From 0a70e9defe21e1441a6e0a19603af65c2db284b7 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 11:07:11 +1300 Subject: [PATCH 41/47] refactor: Python codegen fully driven by SemanticSchema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Python codegen now uses SemanticSchema as the single source of truth for type iteration, with the raw Schema providing concrete type data for rendering. Architecture: - NormalizationPipeline::for_codegen() runs only CircularDependency detection (no TypeConsolidation, no NamingResolution) - schema.consolidate_types() runs first, then Normalizer builds SemanticSchema from the consolidated schema - Since NamingResolution is skipped, SemanticType.name() matches the raw Schema's names exactly — no name-domain mismatch - Removed all original_name bridging logic TypeVar collision fix: - Detects when TypeVar names (e.g., Identity) collide with class names and renames them with _T_ prefix (_T_Identity) - rename_type_params_in_schema() propagates renames through all type parameter declarations and type references Validated: 220 tests pass, core-server (284 endpoints, 59K lines) generates valid Python, live API authentication works. --- reflectapi-demo/clients/python/generated.py | 159 ++++++++++ ...tests__basic__reflectapi_deprecated-5.snap | 32 +- ...__basic__reflectapi_enum_documented-4.snap | 3 - ...__reflectapi_enum_with_skip_variant-5.snap | 55 +++- ...sts__basic__reflectapi_struct_empty-5.snap | 26 +- ..._basic_field_string_reflectapi_both-5.snap | 46 ++- ...ield_string_reflectapi_both_equally-5.snap | 48 ++- ...ing_reflectapi_both_with_attributes-5.snap | 65 +++- ...ts__basic__reflectapi_struct_option-5.snap | 28 +- ...sts__basic__reflectapi_struct_tuple-5.snap | 22 ++ ...tapi_struct_with_additional_derives-5.snap | 46 ++- ...ruct_with_all_primitive_type_fields-5.snap | 126 +++++++- ...__basic__reflectapi_struct_with_arc-5.snap | 28 +- ...ectapi_struct_with_arc_pointer_only-5.snap | 32 +- ...with_external_generic_type_fallback-5.snap | 46 ++- ...ectapi_struct_with_fixed_size_array-5.snap | 30 +- ...sic__reflectapi_struct_with_hashmap-5.snap | 28 +- ...eflectapi_struct_with_hashset_field-5.snap | 32 +- ...i_struct_with_hashset_field_generic-5.snap | 62 +++- ...asic__reflectapi_struct_with_nested-5.snap | 40 ++- ...lectapi_struct_with_nested_external-5.snap | 46 ++- ...reflectapi_struct_with_self_via_arc-5.snap | 30 +- ...__reflectapi_struct_with_skip_field-5.snap | 26 +- ...ectapi_struct_with_skip_field_input-5.snap | 55 +++- ...ctapi_struct_with_skip_field_output-5.snap | 55 +++- ...lectapi_struct_with_transform_array-5.snap | 30 +- ...flectapi_struct_with_transform_both-5.snap | 30 +- ...tapi_struct_with_transform_fallback-5.snap | 38 ++- ...ruct_with_transform_fallback_nested-5.snap | 38 ++- ...lectapi_struct_with_transform_input-5.snap | 57 +++- ...ectapi_struct_with_transform_output-5.snap | 57 +++- ...basic__reflectapi_struct_with_tuple-5.snap | 30 +- ...sic__reflectapi_struct_with_tuple12-5.snap | 30 +- ...__basic__reflectapi_struct_with_vec-5.snap | 28 +- ...reflectapi_struct_with_vec_external-5.snap | 46 ++- ...__reflectapi_struct_with_vec_nested-5.snap | 44 ++- ...sic__reflectapi_struct_with_vec_two-5.snap | 29 +- ...demo__tests__enums__enum_rename_num-5.snap | 27 +- ...o__tests__enums__enum_with_generics-4.snap | 3 - ...nums__enum_with_generics_and_fields-4.snap | 3 - ...enerics_and_fields_and_named_fields-4.snap | 3 - ...lly_tagged_enum_with_tuple_variants-5.snap | 43 ++- ...ally_tagged_enum_with_unit_variants-5.snap | 46 ++- ...adj_repr_enum_with_untagged_variant-5.snap | 53 +++- ..._tests__serde__box_field_unwrapping-5.snap | 29 +- ...ectapi_demo__tests__serde__datetime-5.snap | 52 +++- ...tapi_demo__tests__serde__empty_enum-5.snap | 26 +- ...e__empty_variants_adjacently_tagged-5.snap | 126 +++++++- ...e__empty_variants_externally_tagged-5.snap | 128 +++++++- ...e__empty_variants_internally_tagged-5.snap | 64 +++- ...sts__serde__empty_variants_untagged-5.snap | 56 +++- ...xed_variant_types_internally_tagged-5.snap | 61 +++- ...api_demo__tests__serde__enum_rename-5.snap | 27 +- ...demo__tests__serde__enum_rename_all-5.snap | 26 +- ...__serde__enum_rename_all_on_variant-5.snap | 120 ++++++- ...s__serde__enum_rename_variant_field-5.snap | 92 +++++- ...ectapi_demo__tests__serde__enum_tag-5.snap | 54 +++- ...emo__tests__serde__enum_tag_content-5.snap | 114 ++++++- ..._serde__enum_tag_content_rename_all-5.snap | 122 +++++++- ...i_demo__tests__serde__enum_untagged-5.snap | 44 ++- ..._tests__serde__enum_with_field_skip-5.snap | 86 ++++- ...sts__serde__enum_with_many_variants-5.snap | 157 +++++++++- ...__enum_with_rename_to_invalid_chars-5.snap | 102 +++++- ..._enum_with_serde_rename_on_variants-5.snap | 96 +++++- ...sts__serde__enum_with_variant_other-5.snap | 93 +++++- ...ests__serde__enum_with_variant_skip-5.snap | 26 +- ..._enum_with_variant_skip_deserialize-5.snap | 61 +++- ...e__enum_with_variant_skip_serialize-5.snap | 61 +++- ...__serde__enum_with_variant_untagged-5.snap | 93 +++++- ..._demo__tests__serde__external_impls-5.snap | 31 +- ...s__serde__field_all_python_keywords-5.snap | 31 +- ...rde__field_names_with_special_chars-5.snap | 36 ++- ...latten_adjacently_tagged_enum_field-5.snap | 109 ++++++- ...latten_enum_with_unit_variants_only-5.snap | 113 ++++++- ...latten_externally_tagged_enum_field-5.snap | 103 +++++- ...s__serde__flatten_internally_tagged-5.snap | 71 ++++- ...latten_internally_tagged_enum_field-5.snap | 94 +++++- ...ts__serde__flatten_multiple_structs-5.snap | 54 +++- ...ten_optional_internally_tagged_enum-5.snap | 81 ++++- ...n_struct_and_internal_enum_combined-5.snap | 107 ++++++- ..._flatten_struct_with_nested_flatten-5.snap | 51 ++- ...pi_demo__tests__serde__flatten_unit-5.snap | 68 +++- ..._serde__flatten_untagged_enum_field-5.snap | 54 +++- ...rde__generic_adjacently_tagged_enum-5.snap | 91 +++++- ...rde__generic_externally_tagged_enum-5.snap | 92 +++++- ...tapi_demo__tests__serde__kebab_case-5.snap | 30 +- ...__multiple_underscore_prefix_fields-5.snap | 30 +- ...de__namespace_deeply_nested_modules-5.snap | 37 ++- ...erde__namespace_single_segment_type-5.snap | 28 +- ...serde__namespace_with_numeric_start-5.snap | 31 +- ...s__serde__nested_generic_containers-5.snap | 29 +- ...rde__nested_internally_tagged_enums-5.snap | 105 ++++++- ...ted_internally_tagged_enums_minimal-5.snap | 52 +++- ..._newtype_variants_adjacently_tagged-5.snap | 153 ++++++++- ..._newtype_variants_externally_tagged-5.snap | 157 +++++++++- ..._newtype_variants_internally_tagged-5.snap | 71 ++++- ...emo__tests__serde__option_of_option-5.snap | 28 +- ...sts__serde__self_referential_struct-5.snap | 29 +- ...i_demo__tests__serde__struct_rename-5.snap | 26 +- ...mo__tests__serde__struct_rename_all-5.snap | 30 +- ...erde__struct_rename_all_differently-5.snap | 59 +++- ...erde__struct_rename_all_pascal_case-5.snap | 40 ++- ...__tests__serde__struct_rename_field-5.snap | 51 ++- ...repr_transparent_generic_inner_type-5.snap | 28 +- ...__tests__serde__struct_with_flatten-5.snap | 40 ++- ...serde__struct_with_flatten_optional-5.snap | 50 ++- ..._with_flatten_optional_and_required-5.snap | 73 ++++- ...struct_with_rename_to_invalid_chars-5.snap | 38 ++- ...e__struct_with_rename_to_kebab_case-5.snap | 30 +- ...s__serde__struct_with_serde_default-5.snap | 57 +++- ...ests__serde__struct_with_serde_skip-5.snap | 26 +- ..._struct_with_serde_skip_deserialize-5.snap | 63 +++- ...e__struct_with_serde_skip_serialize-5.snap | 63 +++- ...struct_with_serde_skip_serialize_if-5.snap | 65 +++- ...ectapi_demo__tests__serde__timezone-5.snap | 28 +- reflectapi-schema/src/normalize.rs | 84 +++-- reflectapi/src/codegen/python.rs | 294 +++++++++++++----- 117 files changed, 6142 insertions(+), 686 deletions(-) diff --git a/reflectapi-demo/clients/python/generated.py b/reflectapi-demo/clients/python/generated.py index 295a2c43..4b59f5c4 100644 --- a/reflectapi-demo/clients/python/generated.py +++ b/reflectapi-demo/clients/python/generated.py @@ -43,6 +43,140 @@ class MyapiHealthCheckFail(BaseModel): model_config = ConfigDict(extra="ignore", populate_by_name=True) +class MyapiModelBehaviorAggressiveVariant(BaseModel): + """Aggressive variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: float = Field(description="aggressiveness level") + field_1: str = Field(description="some notes") + + +class MyapiModelBehaviorOtherVariant(BaseModel): + """Other variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + description: str = Field(description="Custom provided description of a behavior") + notes: str | None = Field( + default=None, description="Additional notes\nUp to a user to put free text here" + ) + + +# Externally tagged enum using RootModel +MyapiModelBehaviorVariants = Union[ + Literal["Calm"], MyapiModelBehaviorAggressiveVariant, MyapiModelBehaviorOtherVariant +] + + +class MyapiModelBehavior(RootModel[MyapiModelBehaviorVariants]): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance(data, MyapiModelBehaviorAggressiveVariant): + return data + if isinstance(data, MyapiModelBehaviorOtherVariant): + return data + + # Handle JSON data (for deserialization) + if isinstance(data, str) and data == "Calm": + return data + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Aggressive": + if isinstance(value, list): + return MyapiModelBehaviorAggressiveVariant( + field_0=value[0], field_1=value[1] + ) + else: + raise ValueError("Expected list for tuple variant Aggressive") + if key == "Other": + return MyapiModelBehaviorOtherVariant(**value) + + raise ValueError(f"Unknown variant for MyapiModelBehavior: {data}") + + @model_serializer + def _serialize_externally_tagged(self): + if self.root == "Calm": + return "Calm" + if isinstance(self.root, MyapiModelBehaviorAggressiveVariant): + return {"Aggressive": [self.root.field_0, self.root.field_1]} + if isinstance(self.root, MyapiModelBehaviorOtherVariant): + return {"Other": self.root.model_dump()} + + raise ValueError( + f"Cannot serialize MyapiModelBehavior variant: {type(self.root)}" + ) + + +class MyapiModelKindDog(BaseModel): + """A dog""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["dog"] = Field(default="dog", description="Discriminator field") + breed: str = Field(description="breed of the dog") + + +class MyapiModelKindCat(BaseModel): + """A cat""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["cat"] = Field(default="cat", description="Discriminator field") + lives: int = Field(description="lives left") + + +class MyapiModelKindBird(BaseModel): + """Test for unit variants in internally tagged enums""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["bird"] = Field(default="bird", description="Discriminator field") + + +class MyapiModelKind(RootModel): + root: Annotated[ + Union[MyapiModelKindDog, MyapiModelKindCat, MyapiModelKindBird], + Field(discriminator="type"), + ] + + +class MyapiModelInputPet(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str = Field(description="identity") + kind: myapi.model.Kind = Field(description="kind of pet") + age: int | None = Field(default=None, description="age of the pet") + updated_at: datetime | None = None + behaviors: list[myapi.model.Behavior] | None = Field( + default=None, description="behaviors of the pet" + ) + + +class MyapiModelOutputPet(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str = Field(description="identity") + kind: myapi.model.Kind = Field(description="kind of pet") + age: int | None = Field(default=None, description="age of the pet") + updated_at: datetime + behaviors: list[myapi.model.Behavior] | None = Field( + default=None, description="behaviors of the pet" + ) + + class MyapiProtoHeaders(BaseModel): """Generated data model.""" @@ -321,6 +455,27 @@ class myapi: HealthCheckFail = MyapiHealthCheckFail + class model: + """Namespace for model types.""" + + BehaviorAggressiveVariant = MyapiModelBehaviorAggressiveVariant + BehaviorOtherVariant = MyapiModelBehaviorOtherVariant + Behavior = MyapiModelBehavior + KindDog = MyapiModelKindDog + KindCat = MyapiModelKindCat + KindBird = MyapiModelKindBird + Kind = MyapiModelKind + + class input: + """Namespace for input types.""" + + Pet = MyapiModelInputPet + + class output: + """Namespace for output types.""" + + Pet = MyapiModelOutputPet + class proto: """Namespace for proto types.""" @@ -777,6 +932,10 @@ def __init__( # Rebuild models to resolve forward references try: myapi.HealthCheckFail.model_rebuild() + myapi.model.Behavior.model_rebuild() + myapi.model.Kind.model_rebuild() + myapi.model.input.Pet.model_rebuild() + myapi.model.output.Pet.model_rebuild() myapi.proto.Headers.model_rebuild() myapi.proto.InternalError.model_rebuild() myapi.proto.Paginated.model_rebuild() diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap index 709db049..2b48ac12 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < StructWithDeprecatedField > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,31 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicStructWithDeprecatedField(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + g: int = Field(serialization_alias="_g", validation_alias="_g") + h: int = Field(serialization_alias="_h", validation_alias="_h") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + StructWithDeprecatedField = ( + ReflectapiDemoTestsBasicStructWithDeprecatedField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +89,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +132,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +143,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.StructWithDeprecatedField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap index 3798706e..d71903cc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap @@ -38,9 +38,6 @@ from reflectapi_runtime import ReflectapiInfallible T = TypeVar("T") -T = TypeVar("T") - - class ReflectapiDemoTestsBasicTestEnumDocumentedVariant1Variant(BaseModel, Generic[T]): """Variant1 variant""" diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap index eb9e22ae..a173e238 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestEnumWithSkipVariant > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,45 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant(str, Enum): + """Generated enum.""" + + A = "A" + I = "I" + + +class ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant(str, Enum): + """Generated enum.""" + + A = "A" + O = "O" + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithSkipVariant = ( + ReflectapiDemoTestsBasicInputTestEnumWithSkipVariant + ) + + class output: + """Namespace for output types.""" + + TestEnumWithSkipVariant = ( + ReflectapiDemoTestsBasicOutputTestEnumWithSkipVariant + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +72,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: """ @@ -65,7 +106,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +117,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant]: """ @@ -109,7 +151,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +162,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.input.TestEnumWithSkipVariant.model_rebuild() + reflectapi_demo.tests.basic.output.TestEnumWithSkipVariant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap index 321c4406..e56f49e5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructEmpty > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,25 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructEmpty(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructEmpty = ReflectapiDemoTestsBasicTestStructEmpty + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +83,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +126,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +137,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructEmpty.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap index a287711f..92636fb6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructOneBasicFieldStringReflectBoth > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: str = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldStringReflectBoth = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBoth + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +55,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth + ]: """ Args: @@ -64,7 +91,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +102,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth + ]: """ Args: @@ -108,7 +138,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +149,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBoth.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap index 03933819..80344d68 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructOneBasicFieldStringReflectBothEqually\n> ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,31 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually( + BaseModel +): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOneBasicFieldStringReflectBothEqually = ( + ReflectapiDemoTestsBasicTestStructOneBasicFieldStringReflectBothEqually + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +57,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually + ]: """ Args: @@ -64,7 +93,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +104,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually + ]: """ Args: @@ -108,7 +140,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +151,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructOneBasicFieldStringReflectBothEqually.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap index 089419f3..6aa11c0d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: <\nTestStructOneBasicFieldStringReflectBothDifferently > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,47 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently( + BaseModel +): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +class ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently( + BaseModel +): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructOneBasicFieldStringReflectBothDifferently = ReflectapiDemoTestsBasicInputTestStructOneBasicFieldStringReflectBothDifferently + + class output: + """Namespace for output types.""" + + TestStructOneBasicFieldStringReflectBothDifferently = ReflectapiDemoTestsBasicOutputTestStructOneBasicFieldStringReflectBothDifferently + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +73,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently]: + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently + ]: """ Args: @@ -64,7 +109,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +120,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently]: + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently + ]: """ Args: @@ -108,7 +156,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +167,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.input.TestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructOneBasicFieldStringReflectBothDifferently.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap index 3a2c0939..b963cb4d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructOption > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructOption(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int | None = Field(default=None, serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructOption = ReflectapiDemoTestsBasicTestStructOption + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +86,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +129,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructOption.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap index ad5ef2e0..1ddc86bf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap @@ -24,6 +24,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructTuple(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + 0: int + 1: str + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + TestStructTuple = ReflectapiDemoTestsBasicTestStructTuple + + class AsyncInoutClient: """Async client for inout operations.""" @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructTuple.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap index b4f072a4..b460da78 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,43 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTest(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + us: list[None] + xs: list[reflectapi_demo.tests.basic.X] + ys: list[reflectapi_demo.tests.basic.Y] + + +class ReflectapiDemoTestsBasicX(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsBasicY(str, Enum): + """Generated enum.""" + + Y = "Y" + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + Test = ReflectapiDemoTestsBasicTest + X = ReflectapiDemoTestsBasicX + Y = ReflectapiDemoTestsBasicY + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +102,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +145,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +156,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.Test.model_rebuild() + reflectapi_demo.tests.basic.X.model_rebuild() + reflectapi_demo.tests.basic.Y.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap index dbfa4998..2dba8821 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithAllPrimitiveTypeFields > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,117 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f_u8: int = Field(serialization_alias="_f_u8", validation_alias="_f_u8") + f_u16: int = Field(serialization_alias="_f_u16", validation_alias="_f_u16") + f_u32: int = Field(serialization_alias="_f_u32", validation_alias="_f_u32") + f_u64: int = Field(serialization_alias="_f_u64", validation_alias="_f_u64") + f_u128: U128 = Field(serialization_alias="_f_u128", validation_alias="_f_u128") + f_usize: int = Field(serialization_alias="_f_usize", validation_alias="_f_usize") + f_i8: int = Field(serialization_alias="_f_i8", validation_alias="_f_i8") + f_i16: int = Field(serialization_alias="_f_i16", validation_alias="_f_i16") + f_i32: int = Field(serialization_alias="_f_i32", validation_alias="_f_i32") + f_i64: int = Field(serialization_alias="_f_i64", validation_alias="_f_i64") + f_i128: I128 = Field(serialization_alias="_f_i128", validation_alias="_f_i128") + f_isize: int = Field(serialization_alias="_f_isize", validation_alias="_f_isize") + f_f32: float = Field(serialization_alias="_f_f32", validation_alias="_f_f32") + f_f64: float = Field(serialization_alias="_f_f64", validation_alias="_f_f64") + f_bool: bool = Field(serialization_alias="_f_bool", validation_alias="_f_bool") + f_char: Char = Field(serialization_alias="_f_char", validation_alias="_f_char") + f_str: str = Field(serialization_alias="_f_str", validation_alias="_f_str") + f_unit: None = Field(serialization_alias="_f_unit", validation_alias="_f_unit") + f_option: int | None = Field( + default=None, serialization_alias="_f_option", validation_alias="_f_option" + ) + f_vec: bytes = Field(serialization_alias="_f_vec", validation_alias="_f_vec") + f_hashmap: dict[int, str] = Field( + serialization_alias="_f_hashmap", validation_alias="_f_hashmap" + ) + f_hashset: bytes = Field( + serialization_alias="_f_hashset", validation_alias="_f_hashset" + ) + f_tuple: std.tuple.Tuple2[int, str] = Field( + serialization_alias="_f_tuple", validation_alias="_f_tuple" + ) + f_tuple3: std.tuple.Tuple3[int, str, int] = Field( + serialization_alias="_f_tuple3", validation_alias="_f_tuple3" + ) + f_tuple4: std.tuple.Tuple4[int, str, int, str] = Field( + serialization_alias="_f_tuple4", validation_alias="_f_tuple4" + ) + f_tuple5: std.tuple.Tuple5[int, str, int, str, int] = Field( + serialization_alias="_f_tuple5", validation_alias="_f_tuple5" + ) + f_tuple6: std.tuple.Tuple6[int, str, int, str, int, str] = Field( + serialization_alias="_f_tuple6", validation_alias="_f_tuple6" + ) + f_tuple7: std.tuple.Tuple7[int, str, int, str, int, str, int] = Field( + serialization_alias="_f_tuple7", validation_alias="_f_tuple7" + ) + f_tuple8: std.tuple.Tuple8[int, str, int, str, int, str, int, str] = Field( + serialization_alias="_f_tuple8", validation_alias="_f_tuple8" + ) + f_tuple9: std.tuple.Tuple9[int, str, int, str, int, str, int, str, int] = Field( + serialization_alias="_f_tuple9", validation_alias="_f_tuple9" + ) + f_tuple10: std.tuple.Tuple10[int, str, int, str, int, str, int, str, int, str] = ( + Field(serialization_alias="_f_tuple10", validation_alias="_f_tuple10") + ) + f_tuple11: std.tuple.Tuple11[ + int, str, int, str, int, str, int, str, int, str, int + ] = Field(serialization_alias="_f_tuple11", validation_alias="_f_tuple11") + f_tuple12: std.tuple.Tuple12[ + int, str, int, str, int, str, int, str, int, str, int, str + ] = Field(serialization_alias="_f_tuple12", validation_alias="_f_tuple12") + f_array: bytes = Field(serialization_alias="_f_array", validation_alias="_f_array") + f_pointer_box: int = Field( + serialization_alias="_f_pointer_box", validation_alias="_f_pointer_box" + ) + f_pointer_arc: int = Field( + serialization_alias="_f_pointer_arc", validation_alias="_f_pointer_arc" + ) + f_pointer_cell: int = Field( + serialization_alias="_f_pointer_cell", validation_alias="_f_pointer_cell" + ) + f_pointer_refcell: int = Field( + serialization_alias="_f_pointer_refcell", validation_alias="_f_pointer_refcell" + ) + f_pointer_mutex: int = Field( + serialization_alias="_f_pointer_mutex", validation_alias="_f_pointer_mutex" + ) + f_pointer_rwlock: int = Field( + serialization_alias="_f_pointer_rwlock", validation_alias="_f_pointer_rwlock" + ) + f_pointer_weak: int = Field( + serialization_alias="_f_pointer_weak", validation_alias="_f_pointer_weak" + ) + f_phantomdata: std.marker.PhantomData[int] = Field( + serialization_alias="_f_phantomdata", validation_alias="_f_phantomdata" + ) + f_infallible: ReflectapiInfallible = Field( + serialization_alias="_f_infallible", validation_alias="_f_infallible" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithAllPrimitiveTypeFields = ( + ReflectapiDemoTestsBasicTestStructWithAllPrimitiveTypeFields + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +144,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: """ @@ -65,7 +178,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +189,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields]: """ @@ -109,7 +223,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +234,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithAllPrimitiveTypeFields.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap index 64e87361..6198c9ba 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithArc > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithArc(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithArc = ReflectapiDemoTestsBasicTestStructWithArc + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithArc.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap index 852640ef..349f3e11 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithArcPointerOnly > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,31 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithArcPointerOnly(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f_pointer_arc: int = Field( + serialization_alias="_f_pointer_arc", validation_alias="_f_pointer_arc" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithArcPointerOnly = ( + ReflectapiDemoTestsBasicTestStructWithArcPointerOnly + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +89,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +132,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +143,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithArcPointerOnly.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap index 446fa4f1..08c1e54f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithExternalGenericTypeFallback > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + data: dict[str, int] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithExternalGenericTypeFallback = ( + ReflectapiDemoTestsBasicTestStructWithExternalGenericTypeFallback + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +55,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback + ]: """ Args: @@ -64,7 +91,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +102,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback + ]: """ Args: @@ -108,7 +138,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +149,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithExternalGenericTypeFallback.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap index 897a9c6f..768e792d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithFixedSizeArray > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithFixedSizeArray(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: bytes = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithFixedSizeArray = ( + ReflectapiDemoTestsBasicTestStructWithFixedSizeArray + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithFixedSizeArray.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap index 6e39e6bd..af88c353 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithHashMap > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithHashMap(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: dict[int, str] = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithHashMap = ReflectapiDemoTestsBasicTestStructWithHashMap + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithHashMap.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap index df60d1d8..2e2f5355 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithHashSetField > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,31 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithHashSetField(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f_hashset: bytes = Field( + serialization_alias="_f_hashset", validation_alias="_f_hashset" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithHashSetField = ( + ReflectapiDemoTestsBasicTestStructWithHashSetField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +89,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +132,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +143,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithHashSetField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap index bc20277c..c70a1727 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithHashSetFieldGeneric:: >\n()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,37 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +# Type variables for generic types + + +G = TypeVar("G") + + +class ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric(BaseModel, Generic[G]): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f_hashset: list[G] = Field( + serialization_alias="_f_hashset", validation_alias="_f_hashset" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithHashSetFieldGeneric = ( + ReflectapiDemoTestsBasicTestStructWithHashSetFieldGeneric + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +63,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] + ]: """ Args: @@ -50,7 +85,9 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str], + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[ + str + ], ) @@ -64,7 +101,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +112,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]] = None, - ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str]]: + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str] + ]: """ Args: @@ -94,7 +134,9 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[str], + response_model=reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric[ + str + ], ) @@ -108,7 +150,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +161,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithHashSetFieldGeneric.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap index 73cc2287..1e7da03a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithNested > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,38 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: str = Field(serialization_alias="_f", validation_alias="_f") + + +class ReflectapiDemoTestsBasicTestStructWithNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: reflectapi_demo.tests.basic.TestStructNested = Field( + serialization_alias="_f", validation_alias="_f" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructNested = ReflectapiDemoTestsBasicTestStructNested + TestStructWithNested = ReflectapiDemoTestsBasicTestStructWithNested + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +96,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +139,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +150,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructNested.model_rebuild() + reflectapi_demo.tests.basic.TestStructWithNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap index 5e48d09d..6b8ac0a2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithNestedExternal > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,44 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithNestedExternal(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: reflectapi_demo.tests.test_lib.TestStructNested = Field( + serialization_alias="_f", validation_alias="_f" + ) + + +class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: str = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithNestedExternal = ( + ReflectapiDemoTestsBasicTestStructWithNestedExternal + ) + + class test_lib: + """Namespace for test_lib types.""" + + TestStructNested = ReflectapiDemoTestsTestLibTestStructNested + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +102,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +145,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +156,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithNestedExternal.model_rebuild() + reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap index 0fe369ab..a4bfe6ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSelfViaArc > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithSelfViaArc(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: reflectapi_demo.tests.basic.TestStructWithSelfViaArc = Field( + serialization_alias="_f", validation_alias="_f" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithSelfViaArc = ReflectapiDemoTestsBasicTestStructWithSelfViaArc + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithSelfViaArc.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap index 9a0810c6..7b3fd545 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSkipField > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,25 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithSkipField(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithSkipField = ReflectapiDemoTestsBasicTestStructWithSkipField + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +83,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +126,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +137,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithSkipField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap index 604b4045..9d3a79c6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSkipFieldInput > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,45 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSkipFieldInput = ( + ReflectapiDemoTestsBasicInputTestStructWithSkipFieldInput + ) + + class output: + """Namespace for output types.""" + + TestStructWithSkipFieldInput = ( + ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldInput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +71,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: """ @@ -64,7 +105,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +116,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput]: """ @@ -108,7 +150,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +161,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldInput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithSkipFieldInput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap index 661a67f8..8531978b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithSkipFieldOutput > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,45 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +class ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSkipFieldOutput = ( + ReflectapiDemoTestsBasicInputTestStructWithSkipFieldOutput + ) + + class output: + """Namespace for output types.""" + + TestStructWithSkipFieldOutput = ( + ReflectapiDemoTestsBasicOutputTestStructWithSkipFieldOutput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +71,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: """ @@ -64,7 +105,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +116,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput]: """ @@ -108,7 +150,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +161,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.input.TestStructWithSkipFieldOutput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithSkipFieldOutput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap index cc144302..3f9fe9e1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformArray > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithTransformArray(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: bytes = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformArray = ( + ReflectapiDemoTestsBasicTestStructWithTransformArray + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithTransformArray.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap index 823e5ad7..4d2e1a35 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformBoth > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithTransformBoth(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformBoth = ( + ReflectapiDemoTestsBasicTestStructWithTransformBoth + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithTransformBoth.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap index 6f0fb494..b78a0a63 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformFallback > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithTransformFallback(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformFallback = ( + ReflectapiDemoTestsBasicTestStructWithTransformFallback + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +55,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallback] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithTransformFallback + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: """ @@ -64,7 +89,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +100,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallback] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithTransformFallback + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallback]: """ @@ -108,7 +134,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +145,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithTransformFallback.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap index a904af22..7105a5cb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformFallbackNested > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTransformFallbackNested = ( + ReflectapiDemoTestsBasicTestStructWithTransformFallbackNested + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +55,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: """ @@ -64,7 +89,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +100,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested] = None, + data: Optional[ + reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested]: """ @@ -108,7 +134,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +145,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithTransformFallbackNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap index d6e21838..6b581971 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformInput > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,47 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicInputTestStructWithTransformInput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +class ReflectapiDemoTestsBasicOutputTestStructWithTransformInput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructWithTransformInput = ( + ReflectapiDemoTestsBasicInputTestStructWithTransformInput + ) + + class output: + """Namespace for output types.""" + + TestStructWithTransformInput = ( + ReflectapiDemoTestsBasicOutputTestStructWithTransformInput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +73,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformInput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithTransformInput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: """ @@ -64,7 +107,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +118,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformInput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithTransformInput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformInput]: """ @@ -108,7 +152,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +163,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.input.TestStructWithTransformInput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithTransformInput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap index 3aec3862..eab7e5f0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTransformOutput > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,47 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicInputTestStructWithTransformOutput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +class ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + class input: + """Namespace for input types.""" + + TestStructWithTransformOutput = ( + ReflectapiDemoTestsBasicInputTestStructWithTransformOutput + ) + + class output: + """Namespace for output types.""" + + TestStructWithTransformOutput = ( + ReflectapiDemoTestsBasicOutputTestStructWithTransformOutput + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +73,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformOutput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithTransformOutput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: """ @@ -64,7 +107,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +118,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.basic.input.TestStructWithTransformOutput] = None, + data: Optional[ + reflectapi_demo.tests.basic.input.TestStructWithTransformOutput + ] = None, ) -> ApiResponse[reflectapi_demo.tests.basic.output.TestStructWithTransformOutput]: """ @@ -108,7 +152,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +163,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.input.TestStructWithTransformOutput.model_rebuild() + reflectapi_demo.tests.basic.output.TestStructWithTransformOutput.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap index 4fe831b3..efdf9c74 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTuple > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithTuple(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: std.tuple.Tuple2[int, str] = Field( + serialization_alias="_f", validation_alias="_f" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTuple = ReflectapiDemoTestsBasicTestStructWithTuple + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithTuple.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap index c9ac5e11..7a06506a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithTuple12 > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithTuple12(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: std.tuple.Tuple12[int, str, int, str, int, str, int, str, int, str, int, str] = ( + Field(serialization_alias="_f", validation_alias="_f") + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithTuple12 = ReflectapiDemoTestsBasicTestStructWithTuple12 + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithTuple12.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap index c551cda5..6462325e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVec > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithVec(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: bytes = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithVec = ReflectapiDemoTestsBasicTestStructWithVec + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithVec.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap index 1c8f9831..5d1ebffb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVecExternal > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,44 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithVecExternal(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: list[reflectapi_demo.tests.test_lib.TestStructNested] = Field( + serialization_alias="_f", validation_alias="_f" + ) + + +class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: str = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithVecExternal = ( + ReflectapiDemoTestsBasicTestStructWithVecExternal + ) + + class test_lib: + """Namespace for test_lib types.""" + + TestStructNested = ReflectapiDemoTestsTestLibTestStructNested + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +102,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +145,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +156,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithVecExternal.model_rebuild() + reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap index adb472eb..637cbd19 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVecNested > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,42 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithVecNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: list[list[reflectapi_demo.tests.test_lib.TestStructNested]] = Field( + serialization_alias="_f", validation_alias="_f" + ) + + +class ReflectapiDemoTestsTestLibTestStructNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: str = Field(serialization_alias="_f", validation_alias="_f") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithVecNested = ReflectapiDemoTestsBasicTestStructWithVecNested + + class test_lib: + """Namespace for test_lib types.""" + + TestStructNested = ReflectapiDemoTestsTestLibTestStructNested + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +100,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +143,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +154,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithVecNested.model_rebuild() + reflectapi_demo.tests.test_lib.TestStructNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap index 65668416..3ab55f37 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/basic.rs expression: "super :: into_python_code :: < TestStructWithVecTwo > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,28 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsBasicTestStructWithVecTwo(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: bytes = Field(serialization_alias="_f", validation_alias="_f") + f2: list[int] = Field(serialization_alias="_f2", validation_alias="_f2") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class basic: + """Namespace for basic types.""" + + TestStructWithVecTwo = ReflectapiDemoTestsBasicTestStructWithVecTwo + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +86,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +129,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.basic.TestStructWithVecTwo.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap index 6f2aa406..1948e8f5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/enums.rs expression: "super :: into_python_code :: < Nums > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,26 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsEnumsNums(str, Enum): + """Generated enum.""" + + ZERO = "0" + A = "A" + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + Nums = ReflectapiDemoTestsEnumsNums + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.enums.Nums.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap index 0075bfbc..149748b9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap @@ -38,9 +38,6 @@ from reflectapi_runtime import ReflectapiInfallible T = TypeVar("T") -T = TypeVar("T") - - class ReflectapiDemoTestsEnumsTestEnumWithGenericsVariant1Variant( BaseModel, Generic[T] ): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap index 50170443..5405a149 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap @@ -38,9 +38,6 @@ from reflectapi_runtime import ReflectapiInfallible T = TypeVar("T") -T = TypeVar("T") - - class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsVariant1Variant( BaseModel, Generic[T] ): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap index c2f48eff..41643f3e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap @@ -38,9 +38,6 @@ from reflectapi_runtime import ReflectapiInfallible T = TypeVar("T") -T = TypeVar("T") - - class ReflectapiDemoTestsEnumsTestEnumWithGenericsAndFieldsAndNamedFieldsVariant1Variant( BaseModel, Generic[T] ): diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap index 449e63da..051d6de2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_tuple_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/enums.rs expression: "super :: into_python_code :: < E > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,41 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsEnumsA(str, Enum): + """Generated enum.""" + + X = "X" + Y = "Y" + + +class ReflectapiDemoTestsEnumsEA(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["a"] = Field(default="a", description="Discriminator field") + value: reflectapi_demo.tests.enums.A = Field(description="Tuple variant value") + + +class ReflectapiDemoTestsEnumsE(RootModel): + root: Annotated[Union[ReflectapiDemoTestsEnumsEA], Field(discriminator="type")] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + A = ReflectapiDemoTestsEnumsA + EA = ReflectapiDemoTestsEnumsEA + E = ReflectapiDemoTestsEnumsE + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +100,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +143,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +154,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.enums.A.model_rebuild() + reflectapi_demo.tests.enums.E.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap index a1370231..1b463415 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__internally_tagged_enum_with_unit_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/enums.rs expression: "super :: into_python_code :: < A > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,45 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsEnumsAX(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["X"] = Field(default="X", description="Discriminator field") + + +class ReflectapiDemoTestsEnumsAY(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Y"] = Field(default="Y", description="Discriminator field") + value: None = Field(description="Tuple variant value") + + +class ReflectapiDemoTestsEnumsA(RootModel): + root: Annotated[ + Union[ReflectapiDemoTestsEnumsAX, ReflectapiDemoTestsEnumsAY], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class enums: + """Namespace for enums types.""" + + AX = ReflectapiDemoTestsEnumsAX + AY = ReflectapiDemoTestsEnumsAY + A = ReflectapiDemoTestsEnumsA + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +104,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +147,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +158,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.enums.A.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap index fc618aef..dc4aa178 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__adj_repr_enum_with_untagged_variant-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,52 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestVariant1(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Variant1"] = Field( + default="Variant1", description="Discriminator field" + ) + field_name: int + + +class ReflectapiDemoTestsSerdeTestVariant2(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Variant2"] = Field( + default="Variant2", description="Discriminator field" + ) + value: str = Field(description="Tuple variant value") + + +class ReflectapiDemoTestsSerdeTest(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeTestVariant1, ReflectapiDemoTestsSerdeTestVariant2 + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestVariant1 = ReflectapiDemoTestsSerdeTestVariant1 + TestVariant2 = ReflectapiDemoTestsSerdeTestVariant2 + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +111,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +154,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +165,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap index d81bde03..a5d61b6b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TreeNode > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,28 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTreeNode(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + label: str + child: reflectapi_demo.tests.serde.TreeNode | None = None + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TreeNode = ReflectapiDemoTestsSerdeTreeNode + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TreeNode.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap index 6a8762cd..7f575ec9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStruct > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,51 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStruct(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + duration: timedelta + naive_time: str + naive_date: date + naive_datetime: datetime + date_time_fixed_offset: datetime + date_time_utc: datetime + date_time_local: datetime + + +class StdTimeDuration(BaseModel): + """Time duration type""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + secs: int + nanos: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStruct = ReflectapiDemoTestsSerdeTestStruct + + +class std: + """Namespace for std types.""" + + class time: + """Namespace for time types.""" + + Duration = StdTimeDuration + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +110,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +153,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +164,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap index 8f3ebfd7..8a352b63 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Never > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,25 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeNever(str, Enum): + """Generated enum.""" + + pass + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Never = ReflectapiDemoTestsSerdeNever + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +84,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +127,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Never.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index bf04a937..d63abfef 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsAdjacentlyTagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,108 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant( + BaseModel +): + """EmptyUnit variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant( + BaseModel +): + """EmptyStruct variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedVariants = Union[ + Literal["Empty"], + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant, + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant, +] + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged( + RootModel[ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedVariants] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant, + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("t") + content = data.get("c") + if tag is None: + raise ValueError("Missing tag field 't'") + if content is None and tag not in ("Empty"): + raise ValueError("Missing content field 'c' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "Empty": + return "Empty" + if tag == "EmptyUnit": + if isinstance(content, list): + return ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant() + else: + raise ValueError("Expected list for tuple variant EmptyUnit") + if tag == "EmptyStruct": + return ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant( + **content + ) + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged: {}".format( + data + ) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if self.root == "Empty": + return {"t": "Empty"} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant, + ): + return {"t": "EmptyUnit", "c": []} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant, + ): + return {"t": "EmptyStruct", "c": self.root.model_dump()} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyUnitVariant + TestEmptyVariantsAdjacentlyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTaggedEmptyStructVariant + TestEmptyVariantsAdjacentlyTagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsAdjacentlyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +142,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: """ @@ -65,7 +176,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +187,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged]: """ @@ -109,7 +221,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +232,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEmptyVariantsAdjacentlyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap index 0b7d2bd0..4d550211 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsExternallyTagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,110 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant( + BaseModel +): + """EmptyUnit variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant( + BaseModel +): + """EmptyStruct variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedVariants = Union[ + Literal["Empty"], + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant, + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant, +] + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged( + RootModel[ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedVariants] +): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance( + data, + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant, + ): + return data + if isinstance( + data, + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant, + ): + return data + + # Handle JSON data (for deserialization) + if isinstance(data, str) and data == "Empty": + return data + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "EmptyUnit": + if isinstance(value, list): + return ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant() + else: + raise ValueError("Expected list for tuple variant EmptyUnit") + if key == "EmptyStruct": + return ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant( + **value + ) + + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged: {data}" + ) + + @model_serializer + def _serialize_externally_tagged(self): + if self.root == "Empty": + return "Empty" + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant, + ): + return {"EmptyUnit": []} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant, + ): + return {"EmptyStruct": self.root.model_dump()} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsExternallyTaggedEmptyUnitVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyUnitVariant + TestEmptyVariantsExternallyTaggedEmptyStructVariant = ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTaggedEmptyStructVariant + TestEmptyVariantsExternallyTagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsExternallyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +144,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: """ @@ -65,7 +178,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +189,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged]: """ @@ -109,7 +223,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +234,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEmptyVariantsExternallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap index f32f61e7..f19658fb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsInterallyTagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,55 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Empty"] = Field(default="Empty", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["EmptyStruct"] = Field( + default="EmptyStruct", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty, + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsInterallyTaggedEmpty = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmpty + ) + TestEmptyVariantsInterallyTaggedEmptyStruct = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTaggedEmptyStruct + ) + TestEmptyVariantsInterallyTagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsInterallyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +82,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: """ @@ -65,7 +116,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +127,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged]: """ @@ -109,7 +161,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +172,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEmptyVariantsInterallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap index 64fb3aba..7d9d642c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEmptyVariantsUntagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,55 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyUnit(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyStruct(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged = Union[ + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty, + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyUnit, + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyStruct, +] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEmptyVariantsUntaggedEmpty = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmpty + ) + TestEmptyVariantsUntaggedEmptyUnit = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyUnit + ) + TestEmptyVariantsUntaggedEmptyStruct = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntaggedEmptyStruct + ) + TestEmptyVariantsUntagged = ( + ReflectapiDemoTestsSerdeTestEmptyVariantsUntagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +114,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +157,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +168,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEmptyVariantsUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap index 8e3d9b0b..e1208878 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_mixed_variant_types_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Mixed > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,60 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeMixedUnit(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Unit"] = Field(default="Unit", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeMixedWrap(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Wrap"] = Field(default="Wrap", description="Discriminator field") + value: str + + +class ReflectapiDemoTestsSerdeMixedFull(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Full"] = Field(default="Full", description="Discriminator field") + x: int + y: int + + +class ReflectapiDemoTestsSerdeMixed(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeMixedUnit, + ReflectapiDemoTestsSerdeMixedWrap, + ReflectapiDemoTestsSerdeMixedFull, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + MixedUnit = ReflectapiDemoTestsSerdeMixedUnit + MixedWrap = ReflectapiDemoTestsSerdeMixedWrap + MixedFull = ReflectapiDemoTestsSerdeMixedFull + Mixed = ReflectapiDemoTestsSerdeMixed + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +119,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +162,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +173,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Mixed.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap index e3455372..ad07a023 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRename > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,26 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeMyEnum(str, Enum): + """Generated enum.""" + + V1 = "V1" + V2 = "V2" + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + MyEnum = ReflectapiDemoTestsSerdeMyEnum + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.MyEnum.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap index 52c64064..3123173f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRenameAll > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,25 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumRenameAll(str, Enum): + """Generated enum.""" + + FIELD_NAME = "fieldName" + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumRenameAll = ReflectapiDemoTestsSerdeTestEnumRenameAll + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +84,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +127,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap index 9ea9e83f..69e84b15 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRenameAllOnVariant > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,110 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant(BaseModel): + """Variant1 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) + + +class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant(BaseModel): + """Variant2 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: int + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariants = Union[ + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant, + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant, +] + + +class ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant( + RootModel[ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariants] +): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance( + data, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant + ): + return data + if isinstance( + data, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant + ): + return data + + # Handle JSON data (for deserialization) + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Variant1": + return ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant( + **value + ) + ) + if key == "Variant2": + return ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant( + field_0=value + ) + ) + + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant: {data}" + ) + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance( + self.root, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant + ): + return {"Variant1": self.root.model_dump()} + if isinstance( + self.root, ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant + ): + return {"Variant2": self.root.field_0} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumRenameAllOnVariantVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant1Variant + ) + TestEnumRenameAllOnVariantVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariantVariant2Variant + ) + TestEnumRenameAllOnVariant = ( + ReflectapiDemoTestsSerdeTestEnumRenameAllOnVariant + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +176,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +219,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +230,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumRenameAllOnVariant.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap index 9454e9b0..4e6bce2a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumRenameVariantField > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,82 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant(BaseModel): + """Variant2 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + variant2_field_name: int + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariants = ( + ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant +) + + +class ReflectapiDemoTestsSerdeTestEnumRenameVariantField( + RootModel[ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariants] +): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance( + data, ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant + ): + return data + + # Handle JSON data (for deserialization) + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Variant2": + return ( + ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant( + **value + ) + ) + + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumRenameVariantField: {data}" + ) + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance( + self.root, ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant + ): + return {"Variant2": self.root.model_dump()} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumRenameVariantField variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumRenameVariantFieldVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumRenameVariantFieldVariant2Variant + ) + TestEnumRenameVariantField = ( + ReflectapiDemoTestsSerdeTestEnumRenameVariantField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +148,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +191,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +202,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumRenameVariantField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap index 23b6c0a2..233b7903 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumTag > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,53 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumTagVariant1(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Variant1"] = Field( + default="Variant1", description="Discriminator field" + ) + field_name: int + + +class ReflectapiDemoTestsSerdeTestEnumTagVariant2(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Variant2"] = Field( + default="Variant2", description="Discriminator field" + ) + field_name: int + + +class ReflectapiDemoTestsSerdeTestEnumTag(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeTestEnumTagVariant1, + ReflectapiDemoTestsSerdeTestEnumTagVariant2, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumTagVariant1 = ReflectapiDemoTestsSerdeTestEnumTagVariant1 + TestEnumTagVariant2 = ReflectapiDemoTestsSerdeTestEnumTagVariant2 + TestEnumTag = ReflectapiDemoTestsSerdeTestEnumTag + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +112,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +155,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +166,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumTag.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index b6384737..73a06da1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumTagContent > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,104 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant(BaseModel): + """Variant1 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int + + +class ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant(BaseModel): + """Variant2 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: int + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEnumTagContentVariants = Union[ + ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant, + ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant, +] + + +class ReflectapiDemoTestsSerdeTestEnumTagContent( + RootModel[ReflectapiDemoTestsSerdeTestEnumTagContentVariants] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant, + ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("type") + content = data.get("content") + if tag is None: + raise ValueError("Missing tag field 'type'") + if content is None and tag not in (): + raise ValueError( + "Missing content field 'content' for tag: {}".format(tag) + ) + # Dispatch based on tag + if tag == "Variant1": + return ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant( + **content + ) + if tag == "Variant2": + return ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant( + field_0=content + ) + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeTestEnumTagContent: {}".format( + data + ) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance( + self.root, ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant + ): + return {"type": "Variant1", "content": self.root.model_dump()} + if isinstance( + self.root, ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant + ): + return {"type": "Variant2", "content": self.root.field_0} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumTagContent variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumTagContentVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentVariant1Variant + ) + TestEnumTagContentVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentVariant2Variant + ) + TestEnumTagContent = ReflectapiDemoTestsSerdeTestEnumTagContent + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +170,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +213,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +224,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumTagContent.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index 18dbbe9e..edfd1d7c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumTagContentRenameAll > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,112 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant(BaseModel): + """variant1 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int + + +class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant(BaseModel): + """variant2 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: int + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariants = Union[ + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant, + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant, +] + + +class ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll( + RootModel[ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariants] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant, + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("type") + content = data.get("content") + if tag is None: + raise ValueError("Missing tag field 'type'") + if content is None and tag not in (): + raise ValueError( + "Missing content field 'content' for tag: {}".format(tag) + ) + # Dispatch based on tag + if tag == "variant1": + return ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant( + **content + ) + ) + if tag == "variant2": + return ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant( + field_0=content + ) + ) + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll: {}".format( + data + ) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant, + ): + return {"type": "variant1", "content": self.root.model_dump()} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant, + ): + return {"type": "variant2", "content": self.root.field_0} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumTagContentRenameAllVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant1Variant + ) + TestEnumTagContentRenameAllVariant2Variant = ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAllVariant2Variant + ) + TestEnumTagContentRenameAll = ( + ReflectapiDemoTestsSerdeTestEnumTagContentRenameAll + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +178,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +221,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +232,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumTagContentRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap index be18fb61..1cfab641 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumUntagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,43 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: int + + +class ReflectapiDemoTestsSerdeTestEnumUntaggedVariant2(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int + + +ReflectapiDemoTestsSerdeTestEnumUntagged = Union[ + ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1, + ReflectapiDemoTestsSerdeTestEnumUntaggedVariant2, +] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumUntaggedVariant1 = ReflectapiDemoTestsSerdeTestEnumUntaggedVariant1 + TestEnumUntaggedVariant2 = ReflectapiDemoTestsSerdeTestEnumUntaggedVariant2 + TestEnumUntagged = ReflectapiDemoTestsSerdeTestEnumUntagged + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +102,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +145,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +156,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap index 92ed9e66..cc65c97b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithFieldSkip > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,76 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant(BaseModel): + """Variant1 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariants = ( + ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant +) + + +class ReflectapiDemoTestsSerdeTestEnumWithFieldSkip( + RootModel[ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariants] +): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance( + data, ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant + ): + return data + + # Handle JSON data (for deserialization) + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Variant1": + return ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant( + **value + ) + + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithFieldSkip: {data}" + ) + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance( + self.root, ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant + ): + return {"Variant1": self.root.model_dump()} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithFieldSkip variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumWithFieldSkipVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumWithFieldSkipVariant1Variant + ) + TestEnumWithFieldSkip = ReflectapiDemoTestsSerdeTestEnumWithFieldSkip + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +142,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +185,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +196,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumWithFieldSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap index f16e37f3..7563f4d0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_many_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < LargeEnum > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,156 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeLargeEnumAlpha(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Alpha"] = Field(default="Alpha", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeLargeEnumBeta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Beta"] = Field(default="Beta", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeLargeEnumGamma(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Gamma"] = Field(default="Gamma", description="Discriminator field") + x: int + + +class ReflectapiDemoTestsSerdeLargeEnumDelta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Delta"] = Field(default="Delta", description="Discriminator field") + value: str + + +class ReflectapiDemoTestsSerdeLargeEnumEpsilon(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Epsilon"] = Field( + default="Epsilon", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeLargeEnumZeta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Zeta"] = Field(default="Zeta", description="Discriminator field") + y: bool + + +class ReflectapiDemoTestsSerdeLargeEnumEta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Eta"] = Field(default="Eta", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeLargeEnumTheta(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Theta"] = Field(default="Theta", description="Discriminator field") + value: int + + +class ReflectapiDemoTestsSerdeLargeEnumIota(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Iota"] = Field(default="Iota", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeLargeEnumKappa(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Kappa"] = Field(default="Kappa", description="Discriminator field") + z: float + + +class ReflectapiDemoTestsSerdeLargeEnumLambda(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Lambda"] = Field(default="Lambda", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeLargeEnumMu(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Mu"] = Field(default="Mu", description="Discriminator field") + w: str + v: int + + +class ReflectapiDemoTestsSerdeLargeEnum(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeLargeEnumAlpha, + ReflectapiDemoTestsSerdeLargeEnumBeta, + ReflectapiDemoTestsSerdeLargeEnumGamma, + ReflectapiDemoTestsSerdeLargeEnumDelta, + ReflectapiDemoTestsSerdeLargeEnumEpsilon, + ReflectapiDemoTestsSerdeLargeEnumZeta, + ReflectapiDemoTestsSerdeLargeEnumEta, + ReflectapiDemoTestsSerdeLargeEnumTheta, + ReflectapiDemoTestsSerdeLargeEnumIota, + ReflectapiDemoTestsSerdeLargeEnumKappa, + ReflectapiDemoTestsSerdeLargeEnumLambda, + ReflectapiDemoTestsSerdeLargeEnumMu, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + LargeEnumAlpha = ReflectapiDemoTestsSerdeLargeEnumAlpha + LargeEnumBeta = ReflectapiDemoTestsSerdeLargeEnumBeta + LargeEnumGamma = ReflectapiDemoTestsSerdeLargeEnumGamma + LargeEnumDelta = ReflectapiDemoTestsSerdeLargeEnumDelta + LargeEnumEpsilon = ReflectapiDemoTestsSerdeLargeEnumEpsilon + LargeEnumZeta = ReflectapiDemoTestsSerdeLargeEnumZeta + LargeEnumEta = ReflectapiDemoTestsSerdeLargeEnumEta + LargeEnumTheta = ReflectapiDemoTestsSerdeLargeEnumTheta + LargeEnumIota = ReflectapiDemoTestsSerdeLargeEnumIota + LargeEnumKappa = ReflectapiDemoTestsSerdeLargeEnumKappa + LargeEnumLambda = ReflectapiDemoTestsSerdeLargeEnumLambda + LargeEnumMu = ReflectapiDemoTestsSerdeLargeEnumMu + LargeEnum = ReflectapiDemoTestsSerdeLargeEnum + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +215,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +258,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +269,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.LargeEnum.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index f8dea8f0..19d8b3bc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithRenameToInvalidChars > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,84 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant( + BaseModel +): + """Variant1 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="field-name&&", validation_alias="field-name&&") + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants = ( + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant +) + + +class ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars( + RootModel[ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariants] +): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance( + data, + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant, + ): + return data + + # Handle JSON data (for deserialization) + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Variant1": + return ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant( + **value + ) + + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars: {data}" + ) + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant, + ): + return {"Variant1": self.root.model_dump()} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumWithRenameToInvalidCharsVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidCharsVariant1Variant + ) + TestEnumWithRenameToInvalidChars = ( + ReflectapiDemoTestsSerdeTestEnumWithRenameToInvalidChars + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +118,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ @@ -65,7 +152,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +163,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars]: """ @@ -109,7 +197,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +208,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumWithRenameToInvalidChars.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap index 3a273658..aa75d7bf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Action > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,86 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeActionCreateItemVariant(BaseModel): + """create_item variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + + +class ReflectapiDemoTestsSerdeActionDeleteItemVariant(BaseModel): + """delete_item variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: int + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeActionVariants = Union[ + ReflectapiDemoTestsSerdeActionCreateItemVariant, + ReflectapiDemoTestsSerdeActionDeleteItemVariant, +] + + +class ReflectapiDemoTestsSerdeAction(RootModel[ReflectapiDemoTestsSerdeActionVariants]): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdeActionCreateItemVariant, + ReflectapiDemoTestsSerdeActionDeleteItemVariant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("kind") + content = data.get("data") + if tag is None: + raise ValueError("Missing tag field 'kind'") + if content is None and tag not in (): + raise ValueError("Missing content field 'data' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "create_item": + return ReflectapiDemoTestsSerdeActionCreateItemVariant(**content) + if tag == "delete_item": + return ReflectapiDemoTestsSerdeActionDeleteItemVariant(**content) + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeAction: {}".format(data) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeActionCreateItemVariant): + return {"kind": "create_item", "data": self.root.model_dump()} + if isinstance(self.root, ReflectapiDemoTestsSerdeActionDeleteItemVariant): + return {"kind": "delete_item", "data": self.root.model_dump()} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeAction variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + ActionCreateItemVariant = ReflectapiDemoTestsSerdeActionCreateItemVariant + ActionDeleteItemVariant = ReflectapiDemoTestsSerdeActionDeleteItemVariant + Action = ReflectapiDemoTestsSerdeAction + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +152,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +195,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +206,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Action.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap index 99b12fb2..a9ad367b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_other-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantOther > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,83 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["V0"] = Field(default="V0", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther(RootModel): + root: Annotated[ + Union[ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0], + Field(discriminator="type"), + ] + + +class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["V0"] = Field(default="V0", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Variant1"] = Field( + default="Variant1", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0, + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithVariantOtherV0 = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantOtherV0 + ) + TestEnumWithVariantOther = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantOther + ) + + class output: + """Namespace for output types.""" + + TestEnumWithVariantOtherV0 = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherV0 + ) + TestEnumWithVariantOtherVariant1 = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOtherVariant1 + ) + TestEnumWithVariantOther = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantOther + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +110,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantOther] = None, + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantOther + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: """ @@ -65,7 +144,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +155,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantOther] = None, + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantOther + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantOther]: """ @@ -109,7 +189,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +200,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestEnumWithVariantOther.model_rebuild() + reflectapi_demo.tests.serde.output.TestEnumWithVariantOther.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap index a2ed9ff0..59dff440 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantSkip > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,25 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumWithVariantSkip(str, Enum): + """Generated enum.""" + + pass + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumWithVariantSkip = ReflectapiDemoTestsSerdeTestEnumWithVariantSkip + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +84,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +127,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +138,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumWithVariantSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap index ca0b10b3..4eb469d2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantSkipDeserialize > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,43 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize(str, Enum): + """Generated enum.""" + + pass + + +class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize(str, Enum): + """Generated enum.""" + + _VARIANT1 = "_Variant1" + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithVariantSkipDeserialize = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipDeserialize + ) + + class output: + """Namespace for output types.""" + + TestEnumWithVariantSkipDeserialize = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipDeserialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,8 +70,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize + ]: """ Args: @@ -65,7 +106,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,8 +117,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize + ]: """ Args: @@ -109,7 +153,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +164,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipDeserialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipDeserialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap index 5bbad23c..06027402 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantSkipSerialize > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,43 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize(str, Enum): + """Generated enum.""" + + VARIANT1 = "Variant1" + + +class ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize(str, Enum): + """Generated enum.""" + + pass + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestEnumWithVariantSkipSerialize = ( + ReflectapiDemoTestsSerdeInputTestEnumWithVariantSkipSerialize + ) + + class output: + """Namespace for output types.""" + + TestEnumWithVariantSkipSerialize = ( + ReflectapiDemoTestsSerdeOutputTestEnumWithVariantSkipSerialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,8 +70,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize + ]: """ Args: @@ -65,7 +106,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,8 +117,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize + ]: """ Args: @@ -109,7 +153,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +164,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestEnumWithVariantSkipSerialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestEnumWithVariantSkipSerialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap index 30d84b2b..2886e42f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestEnumWithVariantUntagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,83 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant(BaseModel): + """Variant1 variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: int + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariants = ( + ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant +) + + +class ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged( + RootModel[ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariants] +): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance( + data, ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant + ): + return data + + # Handle JSON data (for deserialization) + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Variant1": + return ( + ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant( + field_0=value + ) + ) + + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged: {data}" + ) + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant, + ): + return {"Variant1": self.root.field_0} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestEnumWithVariantUntaggedVariant1Variant = ( + ReflectapiDemoTestsSerdeTestEnumWithVariantUntaggedVariant1Variant + ) + TestEnumWithVariantUntagged = ( + ReflectapiDemoTestsSerdeTestEnumWithVariantUntagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +149,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +192,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +203,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestEnumWithVariantUntagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap index 8f1138f2..63214b5b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,30 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTest(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + index_map: dict[int, int] + index_set: list[str] + url: str + json: Any + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +88,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +131,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap index ee2fb055..bfa982b5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Keywords > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,30 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeKeywords(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type_: str = Field(serialization_alias="type", validation_alias="type") + class_: str = Field(serialization_alias="class", validation_alias="class") + from_: str = Field(serialization_alias="from", validation_alias="from") + import_: str = Field(serialization_alias="import", validation_alias="import") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Keywords = ReflectapiDemoTestsSerdeKeywords + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +88,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +131,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Keywords.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap index 11808732..c8998f4d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < SpecialNames > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,35 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeSpecialNames(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + content_type: str = Field( + serialization_alias="Content-Type", validation_alias="Content-Type" + ) + nested_key: str = Field( + serialization_alias="x.nested.key", validation_alias="x.nested.key" + ) + has_spaces: int = Field( + serialization_alias="has spaces", validation_alias="has spaces" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + SpecialNames = ReflectapiDemoTestsSerdeSpecialNames + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +93,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +136,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +147,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.SpecialNames.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index 11b6972f..d04289b4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Message > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,98 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeMessage(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + payload: reflectapi_demo.tests.serde.Payload + + +class ReflectapiDemoTestsSerdePayloadTextVariant(BaseModel): + """Text variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + body: str + + +class ReflectapiDemoTestsSerdePayloadBinaryVariant(BaseModel): + """Binary variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + size: int + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdePayloadVariants = Union[ + ReflectapiDemoTestsSerdePayloadTextVariant, + ReflectapiDemoTestsSerdePayloadBinaryVariant, +] + + +class ReflectapiDemoTestsSerdePayload( + RootModel[ReflectapiDemoTestsSerdePayloadVariants] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdePayloadTextVariant, + ReflectapiDemoTestsSerdePayloadBinaryVariant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("kind") + content = data.get("data") + if tag is None: + raise ValueError("Missing tag field 'kind'") + if content is None and tag not in (): + raise ValueError("Missing content field 'data' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "Text": + return ReflectapiDemoTestsSerdePayloadTextVariant(**content) + if tag == "Binary": + return ReflectapiDemoTestsSerdePayloadBinaryVariant(**content) + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdePayload: {}".format(data) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdePayloadTextVariant): + return {"kind": "Text", "data": self.root.model_dump()} + if isinstance(self.root, ReflectapiDemoTestsSerdePayloadBinaryVariant): + return {"kind": "Binary", "data": self.root.model_dump()} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdePayload variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Message = ReflectapiDemoTestsSerdeMessage + PayloadTextVariant = ReflectapiDemoTestsSerdePayloadTextVariant + PayloadBinaryVariant = ReflectapiDemoTestsSerdePayloadBinaryVariant + Payload = ReflectapiDemoTestsSerdePayload + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +164,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +207,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +218,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Message.model_rebuild() + reflectapi_demo.tests.serde.Payload.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap index b1400265..a6c0949a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_enum_with_unit_variants_only-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Item > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,111 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeItemActive(BaseModel): + """'Active' variant of ReflectapiDemoTestsSerdeItem""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + status: Literal["Active"] = Field( + default="Active", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeItemInactive(BaseModel): + """'Inactive' variant of ReflectapiDemoTestsSerdeItem""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + status: Literal["Inactive"] = Field( + default="Inactive", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeItemPending(BaseModel): + """'Pending' variant of ReflectapiDemoTestsSerdeItem""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + status: Literal["Pending"] = Field( + default="Pending", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeItem(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeItemActive, + ReflectapiDemoTestsSerdeItemInactive, + ReflectapiDemoTestsSerdeItemPending, + ], + Field(discriminator="status"), + ] + + +class ReflectapiDemoTestsSerdeStatusActive(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + status: Literal["Active"] = Field( + default="Active", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeStatusInactive(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + status: Literal["Inactive"] = Field( + default="Inactive", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeStatusPending(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + status: Literal["Pending"] = Field( + default="Pending", description="Discriminator field" + ) + + +class ReflectapiDemoTestsSerdeStatus(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeStatusActive, + ReflectapiDemoTestsSerdeStatusInactive, + ReflectapiDemoTestsSerdeStatusPending, + ], + Field(discriminator="status"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + ItemActive = ReflectapiDemoTestsSerdeItemActive + ItemInactive = ReflectapiDemoTestsSerdeItemInactive + ItemPending = ReflectapiDemoTestsSerdeItemPending + Item = ReflectapiDemoTestsSerdeItem + StatusActive = ReflectapiDemoTestsSerdeStatusActive + StatusInactive = ReflectapiDemoTestsSerdeStatusInactive + StatusPending = ReflectapiDemoTestsSerdeStatusPending + Status = ReflectapiDemoTestsSerdeStatus + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +170,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +213,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +224,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Item.model_rebuild() + reflectapi_demo.tests.serde.Status.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap index 8d554ed4..5fb92262 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Drawing > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,92 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeDrawing(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + shape: reflectapi_demo.tests.serde.Shape + + +class ReflectapiDemoTestsSerdeShapeCircleVariant(BaseModel): + """Circle variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + radius: float + + +class ReflectapiDemoTestsSerdeShapeRectVariant(BaseModel): + """Rect variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + width: float + height: float + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeShapeVariants = Union[ + ReflectapiDemoTestsSerdeShapeCircleVariant, ReflectapiDemoTestsSerdeShapeRectVariant +] + + +class ReflectapiDemoTestsSerdeShape(RootModel[ReflectapiDemoTestsSerdeShapeVariants]): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance(data, ReflectapiDemoTestsSerdeShapeCircleVariant): + return data + if isinstance(data, ReflectapiDemoTestsSerdeShapeRectVariant): + return data + + # Handle JSON data (for deserialization) + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Circle": + return ReflectapiDemoTestsSerdeShapeCircleVariant(**value) + if key == "Rect": + return ReflectapiDemoTestsSerdeShapeRectVariant(**value) + + raise ValueError(f"Unknown variant for ReflectapiDemoTestsSerdeShape: {data}") + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeShapeCircleVariant): + return {"Circle": self.root.model_dump()} + if isinstance(self.root, ReflectapiDemoTestsSerdeShapeRectVariant): + return {"Rect": self.root.model_dump()} + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeShape variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Drawing = ReflectapiDemoTestsSerdeDrawing + ShapeCircleVariant = ReflectapiDemoTestsSerdeShapeCircleVariant + ShapeRectVariant = ReflectapiDemoTestsSerdeShapeRectVariant + Shape = ReflectapiDemoTestsSerdeShape + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +158,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +201,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +212,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Drawing.model_rebuild() + reflectapi_demo.tests.serde.Shape.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap index fc618aef..95d3d2cc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,67 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +# Type variables for generic types + + +Additional = TypeVar("Additional") + +Payload = TypeVar("Payload") + + +class ReflectapiDemoTestsSerdeA(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + a: int + + +class ReflectapiDemoTestsSerdeB(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + b: int + + +class ReflectapiDemoTestsSerdeS(BaseModel, Generic[Payload, Additional]): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsSerdeTestS(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["S"] = Field(default="S", description="Discriminator field") + payload: Annotated[Any, "External type: Payload"] + additional: Annotated[Any, "External type: Additional"] + + +class ReflectapiDemoTestsSerdeTest(RootModel): + root: Annotated[Union[ReflectapiDemoTestsSerdeTestS], Field(discriminator="type")] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + A = ReflectapiDemoTestsSerdeA + B = ReflectapiDemoTestsSerdeB + S = ReflectapiDemoTestsSerdeS + TestS = ReflectapiDemoTestsSerdeTestS + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +126,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +169,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +180,10 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.A.model_rebuild() + reflectapi_demo.tests.serde.B.model_rebuild() + reflectapi_demo.tests.serde.S.model_rebuild() + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap index e7f23bad..8e87a143 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_internally_tagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Offer > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,92 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeOfferSingle(BaseModel): + """'Single' variant of ReflectapiDemoTestsSerdeOffer""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + type_: Literal["Single"] = Field( + default="Single", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", + ) + business: str + + +class ReflectapiDemoTestsSerdeOfferGroup(BaseModel): + """'Group' variant of ReflectapiDemoTestsSerdeOffer""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + type_: Literal["Group"] = Field( + default="Group", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", + ) + count: int + + +class ReflectapiDemoTestsSerdeOffer(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeOfferSingle, + ReflectapiDemoTestsSerdeOfferGroup, + ], + Field(discriminator="type_"), + ] + + +class ReflectapiDemoTestsSerdeOfferKindSingle(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Single"] = Field(default="Single", description="Discriminator field") + business: str + + +class ReflectapiDemoTestsSerdeOfferKindGroup(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Group"] = Field(default="Group", description="Discriminator field") + count: int + + +class ReflectapiDemoTestsSerdeOfferKind(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeOfferKindSingle, + ReflectapiDemoTestsSerdeOfferKindGroup, + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + OfferSingle = ReflectapiDemoTestsSerdeOfferSingle + OfferGroup = ReflectapiDemoTestsSerdeOfferGroup + Offer = ReflectapiDemoTestsSerdeOffer + OfferKindSingle = ReflectapiDemoTestsSerdeOfferKindSingle + OfferKindGroup = ReflectapiDemoTestsSerdeOfferKindGroup + OfferKind = ReflectapiDemoTestsSerdeOfferKind + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +151,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +194,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +205,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Offer.model_rebuild() + reflectapi_demo.tests.serde.OfferKind.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap index da003cf0..9681d603 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Document > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,51 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeDocument(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + title: str + created_at: str + updated_at: str + author: str + version: int + + +class ReflectapiDemoTestsSerdeMetadata(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + author: str + version: int + + +class ReflectapiDemoTestsSerdeTimestamps(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + created_at: str + updated_at: str + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Document = ReflectapiDemoTestsSerdeDocument + Metadata = ReflectapiDemoTestsSerdeMetadata + Timestamps = ReflectapiDemoTestsSerdeTimestamps + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +109,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +152,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +163,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Document.model_rebuild() + reflectapi_demo.tests.serde.Metadata.model_rebuild() + reflectapi_demo.tests.serde.Timestamps.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap index ebb6e36f..2897c29b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_optional_internally_tagged_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Task > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,79 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTaskHigh(BaseModel): + """'High' variant of ReflectapiDemoTestsSerdeTask""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + title: str + kind: Literal["High"] = Field(default="High", description="Discriminator field") + deadline: str + + +class ReflectapiDemoTestsSerdeTaskLow(BaseModel): + """'Low' variant of ReflectapiDemoTestsSerdeTask""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + title: str + kind: Literal["Low"] = Field(default="Low", description="Discriminator field") + + +class ReflectapiDemoTestsSerdeTask(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeTaskHigh, + ReflectapiDemoTestsSerdeTaskLow, + ], + Field(discriminator="kind"), + ] + + +class ReflectapiDemoTestsSerdePriorityHigh(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + kind: Literal["High"] = Field(default="High", description="Discriminator field") + deadline: str + + +class ReflectapiDemoTestsSerdePriorityLow(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + kind: Literal["Low"] = Field(default="Low", description="Discriminator field") + + +class ReflectapiDemoTestsSerdePriority(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdePriorityHigh, ReflectapiDemoTestsSerdePriorityLow + ], + Field(discriminator="kind"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TaskHigh = ReflectapiDemoTestsSerdeTaskHigh + TaskLow = ReflectapiDemoTestsSerdeTaskLow + Task = ReflectapiDemoTestsSerdeTask + PriorityHigh = ReflectapiDemoTestsSerdePriorityHigh + PriorityLow = ReflectapiDemoTestsSerdePriorityLow + Priority = ReflectapiDemoTestsSerdePriority + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +138,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +181,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +192,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Priority.model_rebuild() + reflectapi_demo.tests.serde.Task.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap index 5ed42854..daf93012 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_and_internal_enum_combined-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Post > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,104 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeAudit(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + modified_by: str + + +class ReflectapiDemoTestsSerdePostText(BaseModel): + """'Text' variant of ReflectapiDemoTestsSerdePost""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + modified_by: str + type_: Literal["Text"] = Field( + default="Text", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", + ) + body: str + + +class ReflectapiDemoTestsSerdePostImage(BaseModel): + """'Image' variant of ReflectapiDemoTestsSerdePost""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + id: str + modified_by: str + type_: Literal["Image"] = Field( + default="Image", + serialization_alias="type", + validation_alias="type", + description="Discriminator field", + ) + url: str + width: int + + +class ReflectapiDemoTestsSerdePost(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdePostText, + ReflectapiDemoTestsSerdePostImage, + ], + Field(discriminator="type_"), + ] + + +class ReflectapiDemoTestsSerdeContentText(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Text"] = Field(default="Text", description="Discriminator field") + body: str + + +class ReflectapiDemoTestsSerdeContentImage(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["Image"] = Field(default="Image", description="Discriminator field") + url: str + width: int + + +class ReflectapiDemoTestsSerdeContent(RootModel): + root: Annotated[ + Union[ + ReflectapiDemoTestsSerdeContentText, ReflectapiDemoTestsSerdeContentImage + ], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Audit = ReflectapiDemoTestsSerdeAudit + PostText = ReflectapiDemoTestsSerdePostText + PostImage = ReflectapiDemoTestsSerdePostImage + Post = ReflectapiDemoTestsSerdePost + ContentText = ReflectapiDemoTestsSerdeContentText + ContentImage = ReflectapiDemoTestsSerdeContentImage + Content = ReflectapiDemoTestsSerdeContent + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +163,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +206,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +217,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Audit.model_rebuild() + reflectapi_demo.tests.serde.Content.model_rebuild() + reflectapi_demo.tests.serde.Post.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap index 6c2d6b3f..a0506c13 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Outer > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,48 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInner(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + z: str + + +class ReflectapiDemoTestsSerdeMiddle(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + y: int + z: str + + +class ReflectapiDemoTestsSerdeOuter(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + x: str + y: int + z: str + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Inner = ReflectapiDemoTestsSerdeInner + Middle = ReflectapiDemoTestsSerdeMiddle + Outer = ReflectapiDemoTestsSerdeOuter + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +106,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +149,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +160,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Inner.model_rebuild() + reflectapi_demo.tests.serde.Middle.model_rebuild() + reflectapi_demo.tests.serde.Outer.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap index cfee4fbd..f6d49364 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < S > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,42 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +# Type variables for generic types + + +Additional = TypeVar("Additional") + +Payload = TypeVar("Payload") + + +class ReflectapiDemoTestsSerdeK(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + a: int + + +class ReflectapiDemoTestsSerdeS(BaseModel, Generic[Payload, Additional]): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + K = ReflectapiDemoTestsSerdeK + S = ReflectapiDemoTestsSerdeS + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +68,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]]: + data: Optional[ + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] + ]: """ Args: @@ -50,7 +90,9 @@ class AsyncInoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None], + response_model=reflectapi_demo.tests.serde.S[ + reflectapi_demo.tests.serde.K, None + ], ) @@ -64,7 +106,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +117,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None]]: + data: Optional[ + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None] + ]: """ Args: @@ -94,7 +139,9 @@ class InoutClient: path, params=params if params else None, json_model=data, - response_model=reflectapi_demo.tests.serde.S[reflectapi_demo.tests.serde.K, None], + response_model=reflectapi_demo.tests.serde.S[ + reflectapi_demo.tests.serde.K, None + ], ) @@ -108,7 +155,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +166,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.K.model_rebuild() + reflectapi_demo.tests.serde.S.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap index 76d7ad0e..0f896cc7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Cell > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,52 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeCell(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + label: str + content: reflectapi_demo.tests.serde.Value + + +class ReflectapiDemoTestsSerdeValueNum(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + value: float + + +class ReflectapiDemoTestsSerdeValueText(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + text: str + + +ReflectapiDemoTestsSerdeValue = Union[ + ReflectapiDemoTestsSerdeValueNum, ReflectapiDemoTestsSerdeValueText +] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Cell = ReflectapiDemoTestsSerdeCell + ValueNum = ReflectapiDemoTestsSerdeValueNum + ValueText = ReflectapiDemoTestsSerdeValueText + Value = ReflectapiDemoTestsSerdeValue + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +111,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +154,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +165,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Cell.model_rebuild() + reflectapi_demo.tests.serde.Value.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap index ef10993b..f0785457 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Tagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,81 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +# Type variables for generic types + + +T = TypeVar("T") + + +class ReflectapiDemoTestsSerdeTaggedItemVariant(BaseModel, Generic[T]): + """Item variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: T + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeTaggedVariants = Union[ + ReflectapiDemoTestsSerdeTaggedItemVariant, Literal["Nothing"] +] + + +class ReflectapiDemoTestsSerdeTagged( + RootModel[ReflectapiDemoTestsSerdeTaggedVariants], Generic[T] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance(data, (ReflectapiDemoTestsSerdeTaggedItemVariant)): + return data + if isinstance(data, dict): + tag = data.get("t") + content = data.get("c") + if tag is None: + raise ValueError("Missing tag field 't'") + if content is None and tag not in ("Nothing"): + raise ValueError("Missing content field 'c' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "Item": + return ReflectapiDemoTestsSerdeTaggedItemVariant(field_0=content) + if tag == "Nothing": + return "Nothing" + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeTagged: {}".format(data) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeTaggedItemVariant): + return {"t": "Item", "c": self.root.field_0} + if self.root == "Nothing": + return {"t": "Nothing"} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTagged variant: {type(self.root)}" + ) + + def __class_getitem__(cls, params): + return cls + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TaggedItemVariant = ReflectapiDemoTestsSerdeTaggedItemVariant + Tagged = ReflectapiDemoTestsSerdeTagged + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +147,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +190,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +201,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Tagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap index 0fd0452b..33845ef7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Wrapper > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,82 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +# Type variables for generic types + + +T = TypeVar("T") + + +class ReflectapiDemoTestsSerdeWrapperValueVariant(BaseModel, Generic[T]): + """Value variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: T + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeWrapperVariants = Union[ + ReflectapiDemoTestsSerdeWrapperValueVariant[T], Literal["Empty"] +] + + +class ReflectapiDemoTestsSerdeWrapper( + RootModel[ReflectapiDemoTestsSerdeWrapperVariants], Generic[T] +): + """Externally tagged enum""" + + @classmethod + def __class_getitem__(cls, params): + return cls + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance(data, ReflectapiDemoTestsSerdeWrapperValueVariant): + return data + + # Handle JSON data (for deserialization) + if isinstance(data, str) and data == "Empty": + return data + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "Value": + return ReflectapiDemoTestsSerdeWrapperValueVariant(field_0=value) + + raise ValueError(f"Unknown variant for ReflectapiDemoTestsSerdeWrapper: {data}") + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance(self.root, ReflectapiDemoTestsSerdeWrapperValueVariant): + return {"Value": self.root.field_0} + if self.root == "Empty": + return "Empty" + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeWrapper variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + WrapperValueVariant = ReflectapiDemoTestsSerdeWrapperValueVariant + Wrapper = ReflectapiDemoTestsSerdeWrapper + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +148,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +191,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +202,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Wrapper.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap index 8f1138f2..f3a9a9c0 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTest(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="field-name", validation_alias="field-name" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap index 1b9df25f..9d66aa03 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Underscored > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeUnderscored(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + single: int = Field(serialization_alias="_single", validation_alias="_single") + double: str = Field(serialization_alias="__double", validation_alias="__double") + triple: bool = Field(serialization_alias="___triple", validation_alias="___triple") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Underscored = ReflectapiDemoTestsSerdeUnderscored + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Underscored.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap index 263f0ad4..0d8d3a50 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < deep::nested::inner::DeepType > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,36 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeDeepNestedInnerDeepType(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + data: str + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class deep: + """Namespace for deep types.""" + + class nested: + """Namespace for nested types.""" + + class inner: + """Namespace for inner types.""" + + DeepType = ReflectapiDemoTestsSerdeDeepNestedInnerDeepType + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +94,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +137,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +148,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.deep.nested.inner.DeepType.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap index 2199fad3..68877877 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < SimpleTopLevel > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeSimpleTopLevel(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + value: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + SimpleTopLevel = ReflectapiDemoTestsSerdeSimpleTopLevel + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.SimpleTopLevel.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap index 6ba0bd1a..c6e1187f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TypeWithNumbers > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,30 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTypeWithNumbers(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_123: str = Field(serialization_alias="123start", validation_alias="123start") + kebab_field: int = Field( + serialization_alias="kebab-field", validation_alias="kebab-field" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TypeWithNumbers = ReflectapiDemoTestsSerdeTypeWithNumbers + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +88,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +131,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +142,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TypeWithNumbers.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap index 6aa80a0e..24676488 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Complex > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,28 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeComplex(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + matrix: list[list[int]] + lookup: dict[str, list[int | None]] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Complex = ReflectapiDemoTestsSerdeComplex + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Complex.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap index fc618aef..c4b88175 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,102 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestV1(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + version: Literal["v1"] = Field(default="v1", description="Discriminator field") + value: reflectapi_demo.tests.serde.V1 = Field(description="Tuple variant value") + + +class ReflectapiDemoTestsSerdeTestV2(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + version: Literal["v2"] = Field(default="v2", description="Discriminator field") + value: reflectapi_demo.tests.serde.V2 = Field(description="Tuple variant value") + + +class ReflectapiDemoTestsSerdeTest(RootModel): + root: Annotated[ + Union[ReflectapiDemoTestsSerdeTestV1, ReflectapiDemoTestsSerdeTestV2], + Field(discriminator="version"), + ] + + +class ReflectapiDemoTestsSerdeV1A(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["A"] = Field(default="A", description="Discriminator field") + a: int + + +class ReflectapiDemoTestsSerdeV1B(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["B"] = Field(default="B", description="Discriminator field") + b: int + + +class ReflectapiDemoTestsSerdeV1(RootModel): + root: Annotated[ + Union[ReflectapiDemoTestsSerdeV1A, ReflectapiDemoTestsSerdeV1B], + Field(discriminator="type"), + ] + + +class ReflectapiDemoTestsSerdeV2C(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["C"] = Field(default="C", description="Discriminator field") + c: int + + +class ReflectapiDemoTestsSerdeV2D(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["D"] = Field(default="D", description="Discriminator field") + d: int + + +class ReflectapiDemoTestsSerdeV2(RootModel): + root: Annotated[ + Union[ReflectapiDemoTestsSerdeV2C, ReflectapiDemoTestsSerdeV2D], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestV1 = ReflectapiDemoTestsSerdeTestV1 + TestV2 = ReflectapiDemoTestsSerdeTestV2 + Test = ReflectapiDemoTestsSerdeTest + V1A = ReflectapiDemoTestsSerdeV1A + V1B = ReflectapiDemoTestsSerdeV1B + V1 = ReflectapiDemoTestsSerdeV1 + V2C = ReflectapiDemoTestsSerdeV2C + V2D = ReflectapiDemoTestsSerdeV2D + V2 = ReflectapiDemoTestsSerdeV2 + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +161,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +204,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +215,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Test.model_rebuild() + reflectapi_demo.tests.serde.V1.model_rebuild() + reflectapi_demo.tests.serde.V2.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap index fc618aef..33e39df6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_internally_tagged_enums_minimal-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,50 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestV1(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + version: Literal["v1"] = Field(default="v1", description="Discriminator field") + value: reflectapi_demo.tests.serde.V1 = Field(description="Tuple variant value") + + +class ReflectapiDemoTestsSerdeTest(RootModel): + root: Annotated[ + Union[ReflectapiDemoTestsSerdeTestV1], Field(discriminator="version") + ] + + +class ReflectapiDemoTestsSerdeV1A(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["A"] = Field(default="A", description="Discriminator field") + a: int + + +class ReflectapiDemoTestsSerdeV1(RootModel): + root: Annotated[Union[ReflectapiDemoTestsSerdeV1A], Field(discriminator="type")] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestV1 = ReflectapiDemoTestsSerdeTestV1 + Test = ReflectapiDemoTestsSerdeTest + V1A = ReflectapiDemoTestsSerdeV1A + V1 = ReflectapiDemoTestsSerdeV1 + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +109,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +152,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +163,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Test.model_rebuild() + reflectapi_demo.tests.serde.V1.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index b0306ec4..115ec490 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestNewtypeVariantsAdjacentlyTagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,135 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant(BaseModel): + """int variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: int + + +class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant( + BaseModel +): + """string variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: str + + +class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant(BaseModel): + """bool variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: bool + + +# Adjacently tagged enum using RootModel +ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedVariants = Union[ + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant, + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant, + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant, + Literal["unit"], +] + + +class ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged( + RootModel[ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedVariants] +): + """Adjacently tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_adjacently_tagged(cls, data): + # Handle direct variant instances + if isinstance( + data, + ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant, + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant, + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant, + ), + ): + return data + if isinstance(data, dict): + tag = data.get("t") + content = data.get("c") + if tag is None: + raise ValueError("Missing tag field 't'") + if content is None and tag not in ("unit"): + raise ValueError("Missing content field 'c' for tag: {}".format(tag)) + # Dispatch based on tag + if tag == "int": + return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant( + field_0=content + ) + if tag == "string": + return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant( + field_0=content + ) + if tag == "bool": + return ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant( + field_0=content + ) + if tag == "unit": + return "unit" + raise ValueError( + "Unknown variant for ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged: {}".format( + data + ) + ) + + @model_serializer + def _serialize_adjacently_tagged(self): + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant, + ): + return {"t": "int", "c": self.root.field_0} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant, + ): + return {"t": "string", "c": self.root.field_0} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant, + ): + return {"t": "bool", "c": self.root.field_0} + if self.root == "unit": + return {"t": "unit"} + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestNewtypeVariantsAdjacentlyTaggedIntVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedIntVariant + ) + TestNewtypeVariantsAdjacentlyTaggedStringVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedStringVariant + ) + TestNewtypeVariantsAdjacentlyTaggedBoolVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTaggedBoolVariant + ) + TestNewtypeVariantsAdjacentlyTagged = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsAdjacentlyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +169,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: """ @@ -65,7 +203,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +214,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged]: """ @@ -109,7 +248,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +259,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestNewtypeVariantsAdjacentlyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index c74a247f..d6d24b76 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestNewtypeVariantsExternallyTagged > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -17,7 +17,14 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict, PrivateAttr, RootModel, model_serializer, model_validator +from pydantic import ( + BaseModel, + ConfigDict, + PrivateAttr, + RootModel, + model_serializer, + model_validator, +) # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse @@ -25,6 +32,139 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant(BaseModel): + """int variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: int + + +class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant( + BaseModel +): + """string variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: str + + +class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant(BaseModel): + """bool variant""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_0: bool + + +# Externally tagged enum using RootModel +ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedVariants = Union[ + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant, + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant, + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant, + Literal["unit"], +] + + +class ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged( + RootModel[ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedVariants] +): + """Externally tagged enum""" + + @model_validator(mode="before") + @classmethod + def _validate_externally_tagged(cls, data): + # Handle direct variant instances (for programmatic creation) + if isinstance( + data, ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant + ): + return data + if isinstance( + data, + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant, + ): + return data + if isinstance( + data, ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant + ): + return data + + # Handle JSON data (for deserialization) + if isinstance(data, str) and data == "unit": + return data + + if isinstance(data, dict): + if len(data) != 1: + raise ValueError("Externally tagged enum must have exactly one key") + + key, value = next(iter(data.items())) + if key == "int": + return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant( + field_0=value + ) + if key == "string": + return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant( + field_0=value + ) + if key == "bool": + return ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant( + field_0=value + ) + + raise ValueError( + f"Unknown variant for ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged: {data}" + ) + + @model_serializer + def _serialize_externally_tagged(self): + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant, + ): + return {"int": self.root.field_0} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant, + ): + return {"string": self.root.field_0} + if isinstance( + self.root, + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant, + ): + return {"bool": self.root.field_0} + if self.root == "unit": + return "unit" + + raise ValueError( + f"Cannot serialize ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged variant: {type(self.root)}" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestNewtypeVariantsExternallyTaggedIntVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedIntVariant + ) + TestNewtypeVariantsExternallyTaggedStringVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedStringVariant + ) + TestNewtypeVariantsExternallyTaggedBoolVariant = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTaggedBoolVariant + ) + TestNewtypeVariantsExternallyTagged = ( + ReflectapiDemoTestsSerdeTestNewtypeVariantsExternallyTagged + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +173,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: """ @@ -65,7 +207,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +218,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged]: """ @@ -109,7 +252,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +263,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestNewtypeVariantsExternallyTagged.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap index 96708a1e..4f2eb66a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_internally_tagged-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Enum > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,68 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeStrukt1(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + a: int + b: int + + +class ReflectapiDemoTestsSerdeStrukt2(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + c: int + d: int + + +class ReflectapiDemoTestsSerdeEnumA(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["a"] = Field(default="a", description="Discriminator field") + a: int + b: int + + +class ReflectapiDemoTestsSerdeEnumB(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + type: Literal["b"] = Field(default="b", description="Discriminator field") + c: int + d: int + + +class ReflectapiDemoTestsSerdeEnum(RootModel): + root: Annotated[ + Union[ReflectapiDemoTestsSerdeEnumA, ReflectapiDemoTestsSerdeEnumB], + Field(discriminator="type"), + ] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Strukt1 = ReflectapiDemoTestsSerdeStrukt1 + Strukt2 = ReflectapiDemoTestsSerdeStrukt2 + EnumA = ReflectapiDemoTestsSerdeEnumA + EnumB = ReflectapiDemoTestsSerdeEnumB + Enum = ReflectapiDemoTestsSerdeEnum + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +127,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +170,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +181,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Enum.model_rebuild() + reflectapi_demo.tests.serde.Strukt1.model_rebuild() + reflectapi_demo.tests.serde.Strukt2.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap index c32d9e38..a34a7a72 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Nested > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + value: str | None | None = None + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Nested = ReflectapiDemoTestsSerdeNested + + class AsyncInoutClient: """Async client for inout operations.""" @@ -65,7 +86,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -109,7 +129,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Nested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap index 275902e6..a0db04e6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Category > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,28 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeCategory(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + name: str + subcategories: list[reflectapi_demo.tests.serde.Category] + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Category = ReflectapiDemoTestsSerdeCategory + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +86,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +129,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +140,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Category.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap index 2d40ae65..5c8a4930 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRename > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,25 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeMyStruct(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + MyStruct = ReflectapiDemoTestsSerdeMyStruct + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +83,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +126,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +137,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.MyStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap index 7b776b48..02ff4550 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameAll > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructRenameAll = ReflectapiDemoTestsSerdeTestStructRenameAll + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStructRenameAll.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap index cebc9f26..80891709 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameAllDifferently > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,49 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int + + +class ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructRenameAllDifferently = ( + ReflectapiDemoTestsSerdeInputTestStructRenameAllDifferently + ) + + class output: + """Namespace for output types.""" + + TestStructRenameAllDifferently = ( + ReflectapiDemoTestsSerdeOutputTestStructRenameAllDifferently + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +75,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently] = None, + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: """ @@ -64,7 +109,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +120,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently] = None, + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently]: """ @@ -108,7 +154,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +165,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestStructRenameAllDifferently.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructRenameAllDifferently.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap index 2e3657bc..9a265517 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameAllPascalCase > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,31 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="FieldName", validation_alias="FieldName" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructRenameAllPascalCase = ( + ReflectapiDemoTestsSerdeTestStructRenameAllPascalCase + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +57,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestStructRenameAllPascalCase + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: """ @@ -64,7 +91,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +102,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestStructRenameAllPascalCase + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructRenameAllPascalCase]: """ @@ -108,7 +136,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +147,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStructRenameAllPascalCase.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap index c141d994..be4a501d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructRenameField > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,49 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestStructRenameField(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) + + +class ReflectapiDemoTestsSerdeOutputTestStructRenameField(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructRenameField = ( + ReflectapiDemoTestsSerdeInputTestStructRenameField + ) + + class output: + """Namespace for output types.""" + + TestStructRenameField = ( + ReflectapiDemoTestsSerdeOutputTestStructRenameField + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +107,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +150,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +161,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestStructRenameField.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructRenameField.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap index 8f1138f2..28ca6e4c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < Test > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTest(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + inner: bytes + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + Test = ReflectapiDemoTestsSerdeTest + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.Test.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap index faff7100..597777e8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithFlatten > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,38 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStructWithFlatten(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int + + +class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithFlatten = ReflectapiDemoTestsSerdeTestStructWithFlatten + TestStructWithFlattenNested = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenNested + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +96,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +139,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +150,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStructWithFlatten.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap index 007aa73b..104dae7e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithFlattenOptional > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,40 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int + + +class ReflectapiDemoTestsSerdeTestStructWithFlattenOptional(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int | None = None + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithFlattenNested = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenNested + ) + TestStructWithFlattenOptional = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenOptional + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,7 +67,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptional] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptional + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: """ @@ -65,7 +101,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,7 +112,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptional] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptional + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptional]: """ @@ -109,7 +146,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +157,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenOptional.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap index 458e538a..98a5635c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithFlattenOptionalAndRequired > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,54 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStructRenameAll(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) + + +class ReflectapiDemoTestsSerdeTestStructWithFlattenNested(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int + + +class ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int | None = None + field_name: int = Field( + serialization_alias="fieldName", validation_alias="fieldName" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructRenameAll = ReflectapiDemoTestsSerdeTestStructRenameAll + TestStructWithFlattenNested = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenNested + ) + TestStructWithFlattenOptionalAndRequired = ( + ReflectapiDemoTestsSerdeTestStructWithFlattenOptionalAndRequired + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,8 +81,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired + ]: """ Args: @@ -65,7 +117,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,8 +128,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired]: + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired + ]: """ Args: @@ -109,7 +164,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +175,9 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStructRenameAll.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenNested.model_rebuild() + reflectapi_demo.tests.serde.TestStructWithFlattenOptionalAndRequired.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap index 9e9605c5..c3d0523b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithRenameToInvalidChars > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="field-name&&", validation_alias="field-name&&") + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithRenameToInvalidChars = ( + ReflectapiDemoTestsSerdeTestStructWithRenameToInvalidChars + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +55,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: """ @@ -64,7 +89,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +100,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars] = None, + data: Optional[ + reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars]: """ @@ -108,7 +134,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +145,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStructWithRenameToInvalidChars.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap index 2759d22e..d9057077 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithRenameToKebabCase > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,29 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeStructName(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + field_name: int = Field( + serialization_alias="field-name", validation_alias="field-name" + ) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + StructName = ReflectapiDemoTestsSerdeStructName + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +87,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +130,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +141,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.StructName.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap index b032e97e..2d286947 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeDefault > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,47 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int | None = None + + +class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSerdeDefault = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeDefault + ) + + class output: + """Namespace for output types.""" + + TestStructWithSerdeDefault = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeDefault + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,7 +73,9 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault] = None, + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: """ @@ -64,7 +107,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,7 +118,9 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault] = None, + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault + ] = None, ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault]: """ @@ -108,7 +152,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +163,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestStructWithSerdeDefault.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeDefault.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap index 580da73c..08d9fcb9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkip > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,25 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStructWithSerdeSkip(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStructWithSerdeSkip = ReflectapiDemoTestsSerdeTestStructWithSerdeSkip + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +83,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +126,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +137,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStructWithSerdeSkip.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap index 5e618fe2..e501631f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkipDeserialize > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,45 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSerdeSkipDeserialize = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipDeserialize + ) + + class output: + """Namespace for output types.""" + + TestStructWithSerdeSkipDeserialize = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipDeserialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +71,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize + ]: """ Args: @@ -64,7 +107,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +118,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize + ]: """ Args: @@ -108,7 +154,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +165,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipDeserialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipDeserialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap index 50ad47bf..b2ef0b9c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkipSerialize > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,45 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int = Field(serialization_alias="_f", validation_alias="_f") + + +class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSerdeSkipSerialize = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerialize + ) + + class output: + """Namespace for output types.""" + + TestStructWithSerdeSkipSerialize = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerialize + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -32,8 +71,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize + ]: """ Args: @@ -64,7 +107,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -76,8 +118,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize + ]: """ Args: @@ -108,7 +154,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +165,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerialize.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerialize.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap index 819a9fdf..937a231b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStructWithSerdeSkipSerializeIf > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -25,6 +25,47 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int | None = None + + +class ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + f: int | None = None + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + class input: + """Namespace for input types.""" + + TestStructWithSerdeSkipSerializeIf = ( + ReflectapiDemoTestsSerdeInputTestStructWithSerdeSkipSerializeIf + ) + + class output: + """Namespace for output types.""" + + TestStructWithSerdeSkipSerializeIf = ( + ReflectapiDemoTestsSerdeOutputTestStructWithSerdeSkipSerializeIf + ) + + class AsyncInoutClient: """Async client for inout operations.""" @@ -33,8 +74,12 @@ class AsyncInoutClient: async def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf + ]: """ Args: @@ -65,7 +110,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -77,8 +121,12 @@ class InoutClient: def test( self, - data: Optional[reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf] = None, - ) -> ApiResponse[reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf]: + data: Optional[ + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf + ] = None, + ) -> ApiResponse[ + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf + ]: """ Args: @@ -109,7 +157,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -121,6 +168,8 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.input.TestStructWithSerdeSkipSerializeIf.model_rebuild() + reflectapi_demo.tests.serde.output.TestStructWithSerdeSkipSerializeIf.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap index e5934192..0b680853 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap @@ -2,12 +2,12 @@ source: reflectapi-demo/src/tests/serde.rs expression: "super :: into_python_code :: < TestStruct > ()" --- -''' +""" Generated Python client for api_client. DO NOT MODIFY THIS FILE MANUALLY. This file is automatically generated by ReflectAPI. -''' +""" from __future__ import annotations @@ -24,6 +24,27 @@ from reflectapi_runtime import ReflectapiEmpty from reflectapi_runtime import ReflectapiInfallible +class ReflectapiDemoTestsSerdeTestStruct(BaseModel): + """Generated data model.""" + + model_config = ConfigDict(extra="ignore", populate_by_name=True) + + timezone: str + + +# Namespace classes for dotted access to types +class reflectapi_demo: + """Namespace for reflectapi_demo types.""" + + class tests: + """Namespace for tests types.""" + + class serde: + """Namespace for serde types.""" + + TestStruct = ReflectapiDemoTestsSerdeTestStruct + + class AsyncInoutClient: """Async client for inout operations.""" @@ -64,7 +85,6 @@ class AsyncClient(AsyncClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = AsyncInoutClient(self) @@ -108,7 +128,6 @@ class Client(ClientBase): ) -> None: super().__init__(base_url, **kwargs) - self.inout = InoutClient(self) @@ -120,6 +139,7 @@ StdNumNonZeroI64 = Annotated[int, "Rust NonZero i64 type"] # Rebuild models to resolve forward references try: + reflectapi_demo.tests.serde.TestStruct.model_rebuild() except AttributeError: # Some types may not have model_rebuild method pass diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index dd232b14..15f09407 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -48,6 +48,16 @@ impl NormalizationPipeline { .add_stage(NamingResolutionStage) .add_stage(CircularDependencyResolutionStage::new()) } + + /// Create a codegen-oriented pipeline that only runs CircularDependencyResolution. + /// + /// This is designed for use when the caller has already run + /// `schema.consolidate_types()` and does not want NamingResolution + /// (which would rename types and create a name-domain mismatch + /// between the SemanticSchema and the raw Schema used for rendering). + pub fn for_codegen() -> Self { + Self::new().add_stage(CircularDependencyResolutionStage::new()) + } } // --------------------------------------------------------------------------- @@ -765,8 +775,21 @@ impl Normalizer { } } - /// Normalize a raw schema into a semantic schema - pub fn normalize(mut self, schema: &Schema) -> Result> { + /// Normalize a raw schema into a semantic schema using the standard pipeline. + pub fn normalize(self, schema: &Schema) -> Result> { + self.normalize_with_pipeline(schema, NormalizationPipeline::standard()) + } + + /// Normalize a raw schema into a semantic schema using a custom pipeline. + /// + /// Use `NormalizationPipeline::for_codegen()` when the caller has already + /// consolidated types on the raw Schema and wants SemanticType names to + /// match the raw Schema names exactly (no NamingResolution renaming). + pub fn normalize_with_pipeline( + mut self, + schema: &Schema, + pipeline: NormalizationPipeline, + ) -> Result> { // Clone so that pipeline stages can mutate without affecting the caller let mut schema = schema.clone(); @@ -774,54 +797,27 @@ impl Normalizer { crate::ids::ensure_symbol_ids(&mut schema); // Capture original type names BEFORE the pipeline transforms them. - // Key: SymbolId path (stable across renames). Value: original name. - // SymbolId is set by ensure_symbol_ids and stays stable even after - // NamingResolutionStage changes the type's name and id.path. - // Wait — rename_type updates id.path too. So we need a different - // stable key. Use the original name itself as both key and value, - // indexed by a generated sequential ID. - let mut pre_norm_by_index: Vec = Vec::new(); - // Also build a map from pre-norm name to index - let mut pre_norm_index: HashMap = HashMap::new(); - for (i, t) in schema + // NamingResolution (if present in the pipeline) will strip module + // paths, so we need to map short names back to qualified names. + let pre_norm_names: Vec = schema .input_types .types() .chain(schema.output_types.types()) - .enumerate() - { - let name = t.name().to_string(); - pre_norm_index.insert(name.clone(), i); - pre_norm_by_index.push(name); - } + .map(|t| t.name().to_string()) + .collect(); + + // Run the caller-provided pipeline + pipeline.run(&mut schema)?; - // Phase 0.5: Run the standard normalization pipeline - NormalizationPipeline::standard().run(&mut schema)?; - - // After the pipeline, types may have been renamed AND reordered. - // TypeConsolidation merges input+output into input_types. - // NamingResolution strips module paths. - // We can't match by position. Instead, match by the type's - // content (fields, variants) — but that's expensive. - // Simpler: just store the post-norm name as the key and - // the pre-norm name as the value. Since both input and output - // had consolidate_types run, the pre-norm name IS the - // fully-qualified name that the raw Schema has. - // - // Actually: the pre_norm_index keys are the pre-normalization - // names. NamingResolution transforms those into short names. - // The mapping we need is: short_name → qualified_name. - // We can't build this after the pipeline because we don't know - // which pre-norm name became which post-norm name. - // - // The real solution: have NamingResolutionStage record its - // name mappings. For now, build the reverse mapping from - // the NamingResolution logic: short name is the last :: - // segment of the qualified name. If unique, maps 1:1. + // Build the original_names reverse mapping. + // When NamingResolution runs, it strips module paths (e.g. + // "my_module::MyType" -> "MyType"). We map the short name back + // to the pre-pipeline qualified name. + // When NamingResolution is NOT in the pipeline, names are unchanged + // and the mapping is identity — the unwrap_or fallback handles this. let mut original_names: HashMap = HashMap::new(); - for pre_name in &pre_norm_by_index { - // NamingResolution strips to last :: segment + for pre_name in &pre_norm_names { let short = pre_name.split("::").last().unwrap_or(pre_name); - // Only set if not already taken (first wins for collisions) original_names .entry(short.to_string()) .or_insert_with(|| pre_name.clone()); diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index d625d72a..b91d4f0f 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1016,11 +1016,20 @@ fn modules_from_rendered_types( pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let implemented_types = build_implemented_types(); - // Build the semantic IR FIRST — from the original schema before - // consolidate_types mutates it. The Normalizer runs its own - // TypeConsolidation + NamingResolution internally. + // Consolidate input/output types FIRST so both the SemanticSchema and + // the raw Schema share the same unified type names. + let all_type_names = schema.consolidate_types(); + validate_type_references(&schema)?; + + // Build the semantic IR with a codegen-specific pipeline that skips + // TypeConsolidation (already done above) and NamingResolution (which + // would rename types and create a name-domain mismatch with the raw + // Schema). Only CircularDependencyResolution runs. let semantic = reflectapi_schema::Normalizer::new() - .normalize(&schema) + .normalize_with_pipeline( + &schema, + reflectapi_schema::NormalizationPipeline::for_codegen(), + ) .map_err(|errors| { anyhow::anyhow!( "Schema normalization failed: {}", @@ -1032,12 +1041,6 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { ) })?; - // Now consolidate the raw schema — needed for legacy rendering functions - // that still use schema.get_type(). This must happen AFTER the Normalizer - // clones the original schema. - let all_type_names = schema.consolidate_types(); - validate_type_references(&schema)?; - let mut generated_code = Vec::new(); // Generate file header @@ -1135,20 +1138,25 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { "std::option::Option", ]; - // Collect TypeVars used across all types, using semantic IR ordering + // Build the set of Python class names that will be emitted, so we can + // detect TypeVar-vs-class name collisions below. + let emitted_class_names: HashSet = semantic + .types() + .filter(|st| !runtime_provided_types.contains(&st.name())) + .filter_map(|st| schema.get_type(st.name())) + .map(|t| improve_class_name(t.name())) + .collect(); + + // Collect TypeVars used across all types, using semantic IR ordering. + // Since the codegen pipeline skips NamingResolution, sem_type.name() + // matches the raw Schema's type names exactly — no original_name bridging needed. let mut used_type_vars: BTreeSet = BTreeSet::new(); for sem_type in semantic.types() { - let original_name = sem_type.original_name(); - let resolved_name = sem_type.name(); - if runtime_provided_types.contains(&original_name) - || runtime_provided_types.contains(&resolved_name) - { + let type_name = sem_type.name(); + if runtime_provided_types.contains(&type_name) { continue; } - let type_def = match schema - .get_type(original_name) - .or_else(|| schema.get_type(resolved_name)) - { + let type_def = match schema.get_type(type_name) { Some(t) => t, None => continue, }; @@ -1157,12 +1165,42 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { collect_type_vars_from_type(type_def, &schema, &implemented_types, &mut used_type_vars)?; } + // Build a rename map for TypeVars that collide with class names. + // When a Rust type parameter has the same name as a top-level type + // (e.g., `Identity` is both a type parameter and a struct), the class + // definition would overwrite the TypeVar. We prefix these with `_T_` + // so the TypeVar and class can coexist in Python's single namespace. + let typevar_rename_map: BTreeMap = used_type_vars + .iter() + .filter(|tv| emitted_class_names.contains(tv.as_str())) + .map(|tv| (tv.clone(), format!("_T_{tv}"))) + .collect(); + + // Apply the rename map to the schema's type parameter names and type + // references. This ensures all downstream rendering functions + // automatically use the renamed TypeVar names without needing to + // thread a rename map through every function signature. + if !typevar_rename_map.is_empty() { + rename_type_params_in_schema(&mut schema, &typevar_rename_map); + } + + // Apply renames to the used_type_vars set + let renamed_type_vars: BTreeSet = used_type_vars + .iter() + .map(|tv| { + typevar_rename_map + .get(tv) + .cloned() + .unwrap_or_else(|| tv.clone()) + }) + .collect(); + // Generate TypeVar declarations - if !used_type_vars.is_empty() { + if !renamed_type_vars.is_empty() { generated_code.push("".to_string()); generated_code.push("# Type variables for generic types".to_string()); generated_code.push("".to_string()); - for type_var in &used_type_vars { + for type_var in &renamed_type_vars { generated_code.push(format!("{type_var} = TypeVar(\"{type_var}\")")); } generated_code.push("".to_string()); @@ -1173,25 +1211,17 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Use SemanticSchema for type ordering — it provides deterministic // BTreeMap ordering from the Normalizer's dependency analysis. - // Look up original names to find raw types in the Schema for rendering. - let mut rendered_original_names_in_order: Vec = Vec::new(); + // Names match the raw Schema directly (no NamingResolution was applied). + let mut rendered_type_names_in_order: Vec = Vec::new(); for sem_type in semantic.types() { - let original_type_name = sem_type.original_name().to_string(); - let resolved_name = sem_type.name().to_string(); + let type_name = sem_type.name().to_string(); - if runtime_provided_types.contains(&original_type_name.as_str()) - || runtime_provided_types.contains(&resolved_name.as_str()) - { + if runtime_provided_types.contains(&type_name.as_str()) { continue; } - // Look up the raw Type for rendering. Try original name first - // (pre-normalization, with module prefix), then resolved name. - let type_def = match schema - .get_type(&original_type_name) - .or_else(|| schema.get_type(&resolved_name)) - { + let type_def = match schema.get_type(&type_name) { Some(t) => t, None => { continue; @@ -1204,8 +1234,8 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { // Only store non-empty renders (excludes unwrapped tuple structs) if !rendered.trim().is_empty() { - rendered_types.insert(original_type_name.clone(), rendered); - rendered_original_names_in_order.push(original_type_name); + rendered_types.insert(type_name.clone(), rendered); + rendered_type_names_in_order.push(type_name); } } @@ -1213,7 +1243,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let rendered_type_keys: Vec = rendered_types.keys().cloned().collect(); // Build namespace module tree and render it - let module_tree = modules_from_rendered_types(rendered_original_names_in_order, rendered_types); + let module_tree = modules_from_rendered_types(rendered_type_names_in_order, rendered_types); let module_tree_code = module_tree.render(); if !module_tree_code.trim().is_empty() { generated_code.push(module_tree_code); @@ -1331,6 +1361,137 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { format_python_code(&result) } +/// Rename type parameters in the schema to avoid TypeVar/class name collisions. +/// +/// When a Rust type parameter (e.g., `Identity`) has the same name as a +/// top-level type, the Python codegen would produce both a TypeVar and a +/// class with the same name, causing the class to shadow the TypeVar. +/// +/// This function renames the parameters in-place in the schema's type +/// definitions and updates all type references that point to those +/// parameters, so all downstream rendering automatically uses the safe names. +fn rename_type_params_in_schema(schema: &mut Schema, rename_map: &BTreeMap) { + // Process both input_types and output_types since consolidate_types() + // keeps non-conflicting types in their original typespace. + let input_type_names: Vec = schema + .input_types + .types() + .map(|t| t.name().to_string()) + .collect(); + for type_name in input_type_names { + if let Some(type_def) = schema.input_types.get_type_mut(&type_name) { + rename_type_params_in_type(type_def, rename_map); + } + } + + let output_type_names: Vec = schema + .output_types + .types() + .map(|t| t.name().to_string()) + .collect(); + for type_name in output_type_names { + if let Some(type_def) = schema.output_types.get_type_mut(&type_name) { + rename_type_params_in_type(type_def, rename_map); + } + } +} + +/// Rename type parameters within a single type definition. +fn rename_type_params_in_type( + type_def: &mut reflectapi_schema::Type, + rename_map: &BTreeMap, +) { + match type_def { + reflectapi_schema::Type::Struct(s) => { + // Check if this struct has any parameters that need renaming + let has_renames = s + .parameters + .iter() + .any(|p| rename_map.contains_key(&p.name)); + if !has_renames { + return; + } + // Rename parameters + for param in &mut s.parameters { + if let Some(new_name) = rename_map.get(¶m.name) { + param.name = new_name.clone(); + } + } + // Rename type references in fields + match &mut s.fields { + reflectapi_schema::Fields::Named(fields) + | reflectapi_schema::Fields::Unnamed(fields) => { + for field in fields { + rename_type_ref(&mut field.type_ref, rename_map); + } + } + reflectapi_schema::Fields::None => {} + } + } + reflectapi_schema::Type::Enum(e) => { + let has_renames = e + .parameters + .iter() + .any(|p| rename_map.contains_key(&p.name)); + if !has_renames { + return; + } + for param in &mut e.parameters { + if let Some(new_name) = rename_map.get(¶m.name) { + param.name = new_name.clone(); + } + } + for variant in &mut e.variants { + match &mut variant.fields { + reflectapi_schema::Fields::Named(fields) + | reflectapi_schema::Fields::Unnamed(fields) => { + for field in fields { + rename_type_ref(&mut field.type_ref, rename_map); + } + } + reflectapi_schema::Fields::None => {} + } + } + } + reflectapi_schema::Type::Primitive(p) => { + let has_renames = p + .parameters + .iter() + .any(|pp| rename_map.contains_key(&pp.name)); + if !has_renames { + return; + } + for param in &mut p.parameters { + if let Some(new_name) = rename_map.get(¶m.name) { + param.name = new_name.clone(); + } + } + if let Some(fallback) = &mut p.fallback { + rename_type_ref(fallback, rename_map); + } + } + } +} + +/// Recursively rename type parameter references in a TypeReference tree. +/// +/// Only renames bare references (no generic arguments) that match the rename +/// map, since type parameters are always leaf references with no arguments. +/// A reference like `Identity` with arguments would be a concrete type +/// instantiation, not a type parameter usage. +fn rename_type_ref(type_ref: &mut TypeReference, rename_map: &BTreeMap) { + // Only rename bare names (no arguments) — these are type parameter usages. + // References with arguments are concrete type instantiations (e.g., Vec). + if type_ref.arguments.is_empty() { + if let Some(new_name) = rename_map.get(&type_ref.name) { + type_ref.name = new_name.clone(); + } + } + for arg in &mut type_ref.arguments { + rename_type_ref(arg, rename_map); + } +} + /// Check if a type name looks like a generic type variable fn is_probable_typevar(name: &str) -> bool { // Likely a TypeVar if it's a bare identifier not present in schema and starts with uppercase @@ -2286,17 +2447,6 @@ fn render_externally_tagged_enum( // Check if this enum is generic let is_generic = !generic_params.is_empty(); - // Generate TypeVar definitions if generic - let type_var_definitions = if is_generic { - generic_params - .iter() - .map(|param| format!("{param} = TypeVar('{param}')")) - .collect::>() - .join("\n") - } else { - String::new() - }; - // Always use RootModel approach; add Generic[...] when needed let template = templates::ExternallyTaggedEnumRootModel { name: enum_name.clone(), @@ -2317,17 +2467,9 @@ fn render_externally_tagged_enum( }; let enum_code = template.render(); - // Combine all parts - let mut result = String::new(); - - // Add TypeVar definitions at the top if generic - if !type_var_definitions.is_empty() { - result.push_str(&type_var_definitions); - result.push_str("\n\n"); - } - - // Add the enum code - result.push_str(&enum_code); + // TypeVar definitions are emitted once at the top of the file; + // inline declarations are suppressed to avoid collisions with class names. + let result = enum_code; Ok(result) } @@ -2406,16 +2548,8 @@ fn render_internally_tagged_enum_core( let is_generic = !generic_params.is_empty(); - // Generate TypeVar definitions if generic - let type_var_definitions = if is_generic { - generic_params - .iter() - .map(|param| format!("{param} = TypeVar('{param}')")) - .collect::>() - .join("\n") - } else { - String::new() - }; + // TypeVar definitions are emitted once at the top of the file; + // inline declarations are suppressed to avoid collisions with class names. // Generate individual classes for each variant for variant in &enum_def.variants { @@ -2648,12 +2782,6 @@ fn render_internally_tagged_enum_core( // Combine all parts let mut result = String::new(); - // Add TypeVar definitions at the top if generic - if !type_var_definitions.is_empty() { - result.push_str(&type_var_definitions); - result.push_str("\n\n"); - } - // Add variant classes result.push_str(&variant_class_definitions.join("\n\n")); if !result.is_empty() { @@ -5463,13 +5591,8 @@ pub mod templates { impl DiscriminatedUnionEnum { pub fn render(&self) -> String { let mut s = String::new(); - if self.is_generic { - writeln!(s, "# TypeVar definitions for {}", self.union_name).unwrap(); - for param in &self.generic_params { - writeln!(s, "{param} = TypeVar('{param}')").unwrap(); - } - writeln!(s).unwrap(); - } + // TypeVar definitions are emitted once at the top of the file; + // inline declarations are suppressed to avoid collisions with class names. for variant_model in &self.variant_models { writeln!(s, "{variant_model}").unwrap(); writeln!(s).unwrap(); @@ -5614,9 +5737,8 @@ pub mod templates { "# Generic externally tagged enum using Approach B: Generic Variant Models" ) .unwrap(); - for param in &self.generic_params { - writeln!(s, "{param} = TypeVar('{param}')").unwrap(); - } + // TypeVar definitions are emitted once at the top of the file; + // inline declarations are suppressed to avoid collisions with class names. writeln!(s).unwrap(); writeln!(s, "# Common non-generic base class with discriminator").unwrap(); writeln!(s, "class {}Base(BaseModel):", self.name).unwrap(); From 171d052958f4c00f9fcf0398ccf5e5b65ae3333c Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 11:58:15 +1300 Subject: [PATCH 42/47] docs: update architecture for SemanticSchema-driven Python codegen --- docs/architecture.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 441910be..2efe15ae 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -282,14 +282,14 @@ Downstream codegen backends query the detected cycles to emit forward-reference ### Normalizer -The `Normalizer` orchestrates the full conversion from `Schema` to `SemanticSchema`: +The `Normalizer` orchestrates the full conversion from `Schema` to `SemanticSchema`. It accepts a custom pipeline via `normalize_with_pipeline()`, or uses `NormalizationPipeline::standard()` by default. Codegen backends that handle their own naming use `NormalizationPipeline::for_codegen()` (CircularDependency only, no TypeConsolidation or NamingResolution). -1. **Phase 0**: Calls `ensure_symbol_ids()` and runs `NormalizationPipeline::standard()`. -2. **Phase 1 (Symbol Discovery)**: Walks the schema and registers every type, function, field, and variant in the `SymbolTable`. -3. **Phase 2 (Type Resolution)**: Resolves all `TypeReference` names to `SymbolId` targets, producing `ResolvedTypeReference` values. -4. **Phase 3 (Dependency Analysis)**: Builds a dependency graph in the `SymbolTable` and performs topological sorting. +1. **Phase 0**: Calls `ensure_symbol_ids()` and runs the selected pipeline. +2. **Phase 1 (Symbol Discovery)**: Registers all types, functions, fields, and variants in the `SymbolTable`. +3. **Phase 2 (Type Resolution)**: Resolves `TypeReference` names to `SymbolId` targets. +4. **Phase 3 (Dependency Analysis)**: Builds dependency graph and performs topological sorting. 5. **Phase 4 (Semantic Validation)**: Checks for semantic errors. -6. **Phase 5 (IR Construction)**: Builds the final `SemanticSchema` with `BTreeMap`-ordered collections for deterministic output. +6. **Phase 5 (IR Construction)**: Builds the `SemanticSchema` with `BTreeMap`-ordered collections. ### SemanticSchema @@ -314,7 +314,7 @@ Key properties compared to `Schema`: ## 5. Code Generation Backends -All backends live in `reflectapi/src/codegen/`. Each reads the `Schema` directly and produces language-specific output. +All backends live in `reflectapi/src/codegen/`. The Python backend uses `SemanticSchema` for type iteration ordering and the consolidated raw `Schema` for rendering. TypeScript, Rust, and OpenAPI backends read the `Schema` directly. ### TypeScript @@ -338,17 +338,18 @@ Mirrors the source Rust types, re-emitting struct/enum definitions with appropri ### Python -Generates Pydantic v2 models with namespace classes mirroring the Rust module structure. Key features: +Generates Pydantic v2 models with namespace classes mirroring the Rust module structure. Uses `SemanticSchema` for type iteration ordering via `NormalizationPipeline::for_codegen()` (skips NamingResolution since Python handles its own naming via `improve_class_name`). The consolidated raw `Schema` provides concrete type data for rendering. - **BaseModel classes** for structs, with `ConfigDict(extra="ignore", populate_by_name=True)`. - **Namespace alias classes** mirror the Rust module hierarchy for dotted access (e.g., `auth.UsersSignInRequest`). Type definitions are at module top-level with flat PascalCase names; namespace classes provide aliases. - **Discriminated unions** (`Union[..., Field(discriminator="tag")]`) for internally-tagged enums. - **RootModel** wrappers with `model_validator`/`model_serializer` for externally-tagged and adjacently-tagged enums. - **Per-variant model expansion** for `#[serde(flatten)]` with internally-tagged enums (see Section 6). +- **Field descriptions** via `Field(description="...")` propagated from the schema. +- **Typed error returns** — `ApiResponse[OutputType, ErrorType]` in method signatures. - **Field aliases** via `Field(serialization_alias=..., validation_alias=...)` for serde-renamed fields and underscore-prefixed fields. - **Literal types** for discriminator fields, with alias handling for Python reserved words (e.g., `type` becomes `type_`). -- **Factory classes** with type-annotated parameters for ergonomic enum variant construction. -- **Docstring escaping** for descriptions containing backslashes or triple-quotes. +- **TypeVar collision resolution** — renames TypeVars that collide with class names (e.g., `Identity` → `_T_Identity`). - Python reserved words are sanitized in field names, method names, and parameters. - Output is formatted with `ruff`. @@ -473,9 +474,9 @@ Preserves the original `#[serde(flatten)]` attribute on the field, since the gen ## 7. Limitations and Design Gaps -### Codegen backends consume `Schema` directly +### TypeScript, Rust, and OpenAPI backends use raw Schema -The `SymbolId`, `ensure_symbol_ids()`, `NormalizationPipeline`, `Normalizer`, and `SemanticSchema` infrastructure exists in `reflectapi-schema` but the codegen backends in `reflectapi/src/codegen/` consume the `Schema` directly. Migrating backends to consume `SemanticSchema` would provide guaranteed resolved references, deterministic ordering, dependency-aware topological ordering, and a single unified typespace. +The Python backend uses `SemanticSchema` for iteration ordering with `NormalizationPipeline::for_codegen()`. The TypeScript, Rust, and OpenAPI backends still consume the raw `Schema` directly. Migrating them to `SemanticSchema` would provide deterministic ordering and dependency-aware topological sorting. ### Flattened enum handling varies by representation From 831772c205ec6e8fbf49b3bc326d615ab878a5cb Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 12:01:33 +1300 Subject: [PATCH 43/47] docs: add dual-pipeline ASCII diagram to architecture doc --- docs/architecture.md | 70 ++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index 2efe15ae..ecccc7d8 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -213,34 +213,52 @@ The pipeline transforms a deserialized `Schema` into a validated, immutable `Sem ### Pipeline Overview ``` - +--------------------------+ - reflectapi.json ----------> | JSON Deserialization | - +--------------------------+ - | - v - +--------------------------+ - | ensure_symbol_ids() | Assign stable SymbolIds - +--------------------------+ - | - v - +--------------------------+ - | NormalizationPipeline | - | 1. TypeConsolidation | Merge input/output typespaces - | 2. NamingResolution | Strip module paths, resolve conflicts - | 3. CircularDependency | Detect cycles via Tarjan's SCC - +--------------------------+ - | - v - +--------------------------+ - | Normalizer | 5-phase conversion to SemanticSchema - +--------------------------+ - | - v - +--------------------------+ - | SemanticSchema | Immutable, validated IR - +--------------------------+ + reflectapi.json + | + v + +--------------------------+ + | JSON Deserialization | + +--------------------------+ + | + v + +--------------------------+ + | ensure_symbol_ids() | Assign stable SymbolIds + +--------------------------+ + | + +--------------------------------------------------+ + | standard() | for_codegen() + | (Normalizer default) | (Python backend) + v v + +---------------------------+ +------------------------------+ + | 1. TypeConsolidation | | Schema::consolidate_types() | + | 2. NamingResolution | | (caller runs separately) | + | 3. CircularDependency | +------------------------------+ + +---------------------------+ | + | v + | +------------------------------+ + | | CircularDependency only | + | +------------------------------+ + | | + +------------------+-----------------------+ + | + v + +-------------------+ + | Normalizer | + | 1. Discovery | Register symbols + | 2. Resolution | Resolve type references + | 3. Dependencies | Build dependency graph + | 4. Validation | Semantic checks + | 5. IR Build | Construct SemanticSchema + +-------------------+ + | + v + +-------------------+ + | SemanticSchema | Immutable, validated IR + +-------------------+ ``` +The `standard()` pipeline is used by `Normalizer::normalize()`. The `for_codegen()` pipeline is used by backends that handle their own naming (Python calls `consolidate_types()` first, then normalizes with `for_codegen()` to preserve qualified type names). + ### SymbolId Every symbol in the schema (types, functions, fields, variants) receives a stable, unique identifier: From 06b397d4d87ae26df23c8683e454319fa15c68b4 Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 12:23:11 +1300 Subject: [PATCH 44/47] fix: remove redundant sort on BTreeMap keys, fix mut warning --- reflectapi/src/codegen/python.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index b91d4f0f..319377fa 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1323,8 +1323,7 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { "# Rebuild models to resolve forward references".to_string(), "try:".to_string(), ]; - let mut sorted_type_names: Vec<&String> = rendered_type_keys.iter().collect(); - sorted_type_names.sort(); + let sorted_type_names: Vec<&String> = rendered_type_keys.iter().collect(); for original_name in &sorted_type_names { if !original_name.starts_with("std::") && !original_name.starts_with("reflectapi::") { let dotted = type_name_to_python_ref(original_name); From 8f71775d090bb0dffc35e9eef3c1577ed3b8975a Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 12:28:29 +1300 Subject: [PATCH 45/47] feat: extensible PipelineBuilder for normalization pipeline Replace the fixed standard()/for_codegen() pipeline variants with a declarative PipelineBuilder that lets backends configure each stage: PipelineBuilder::new() .consolidation(Consolidation::Skip) // or Standard (default) .naming(Naming::Skip) // or Standard, or Custom(stage) .circular_dependency_strategy(...) // default: Intelligent .add_stage(custom_stage) // append backend-specific stages .build() Three configuration dimensions: - Consolidation: Standard (run TypeConsolidationStage) | Skip - Naming: Standard (NamingResolution) | Skip | Custom(Box) - ResolutionStrategy: passed to CircularDependencyResolutionStage Convenience methods standard() and for_codegen() delegate to the builder internally and remain as shorthand. Python codegen uses PipelineBuilder directly with Skip/Skip. Architecture doc updated with PipelineBuilder diagram and config docs. --- docs/architecture.md | 36 +++++-- reflectapi-schema/src/lib.rs | 5 +- reflectapi-schema/src/normalize.rs | 167 +++++++++++++++++++++++++++-- reflectapi/src/codegen/python.rs | 5 +- 4 files changed, 195 insertions(+), 18 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index ecccc7d8..f4afd5f9 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -225,9 +225,18 @@ The pipeline transforms a deserialized `Schema` into a validated, immutable `Sem | ensure_symbol_ids() | Assign stable SymbolIds +--------------------------+ | + v + +-------------------------------+ + | PipelineBuilder | Configures which stages run + | .consolidation(Standard|Skip)| + | .naming(Standard|Skip|Custom)| + | .circular_dependency_strategy| + | .add_stage(custom) | + +-------------------------------+ + | .build() +--------------------------------------------------+ | standard() | for_codegen() - | (Normalizer default) | (Python backend) + | (all defaults) | (Skip, Skip) v v +---------------------------+ +------------------------------+ | 1. TypeConsolidation | | Schema::consolidate_types() | @@ -257,7 +266,14 @@ The pipeline transforms a deserialized `Schema` into a validated, immutable `Sem +-------------------+ ``` -The `standard()` pipeline is used by `Normalizer::normalize()`. The `for_codegen()` pipeline is used by backends that handle their own naming (Python calls `consolidate_types()` first, then normalizes with `for_codegen()` to preserve qualified type names). +Pipelines are configured via `PipelineBuilder`. The convenience methods `NormalizationPipeline::standard()` and `for_codegen()` delegate to the builder internally. The Python backend uses `PipelineBuilder` directly: + +```rust +PipelineBuilder::new() + .consolidation(Consolidation::Skip) + .naming(Naming::Skip) + .build() +``` ### SymbolId @@ -283,7 +299,15 @@ When a schema is deserialized from JSON, all `SymbolId` fields have their defaul 4. When the same FQN appears in both typespaces with different type definitions, the output typespace's copy receives a disambiguated ID (`disambiguator = 1`). 5. Assigns IDs to struct fields and enum variants as children of their parent's path. -### NormalizationPipeline +### NormalizationPipeline and PipelineBuilder + +Pipelines are assembled via `PipelineBuilder`, which controls three dimensions: + +- **`Consolidation`** (`Standard` | `Skip`) -- whether to run `TypeConsolidationStage`. +- **`Naming`** (`Standard` | `Skip` | `Custom(Box)`) -- whether/how to run naming resolution. +- **`ResolutionStrategy`** (`Intelligent` | `Boxing` | `ForwardDeclarations` | `OptionalBreaking` | `ReferenceCounted`) -- passed to `CircularDependencyResolutionStage`. + +Additional custom stages can be appended via `add_stage()`. The convenience methods `NormalizationPipeline::standard()` and `for_codegen()` delegate to `PipelineBuilder` internally and remain the recommended shorthand for common configurations. The standard pipeline applies three stages in sequence: @@ -300,7 +324,7 @@ Downstream codegen backends query the detected cycles to emit forward-reference ### Normalizer -The `Normalizer` orchestrates the full conversion from `Schema` to `SemanticSchema`. It accepts a custom pipeline via `normalize_with_pipeline()`, or uses `NormalizationPipeline::standard()` by default. Codegen backends that handle their own naming use `NormalizationPipeline::for_codegen()` (CircularDependency only, no TypeConsolidation or NamingResolution). +The `Normalizer` orchestrates the full conversion from `Schema` to `SemanticSchema`. It accepts a custom pipeline via `normalize_with_pipeline()`, or uses `NormalizationPipeline::standard()` by default. Codegen backends that handle their own naming build a pipeline with `PipelineBuilder` (skipping consolidation and naming) and pass it to `normalize_with_pipeline()`. 1. **Phase 0**: Calls `ensure_symbol_ids()` and runs the selected pipeline. 2. **Phase 1 (Symbol Discovery)**: Registers all types, functions, fields, and variants in the `SymbolTable`. @@ -356,7 +380,7 @@ Mirrors the source Rust types, re-emitting struct/enum definitions with appropri ### Python -Generates Pydantic v2 models with namespace classes mirroring the Rust module structure. Uses `SemanticSchema` for type iteration ordering via `NormalizationPipeline::for_codegen()` (skips NamingResolution since Python handles its own naming via `improve_class_name`). The consolidated raw `Schema` provides concrete type data for rendering. +Generates Pydantic v2 models with namespace classes mirroring the Rust module structure. Uses `SemanticSchema` for type iteration ordering via `PipelineBuilder::new().consolidation(Consolidation::Skip).naming(Naming::Skip).build()` (skips NamingResolution since Python handles its own naming via `improve_class_name`). The consolidated raw `Schema` provides concrete type data for rendering. - **BaseModel classes** for structs, with `ConfigDict(extra="ignore", populate_by_name=True)`. - **Namespace alias classes** mirror the Rust module hierarchy for dotted access (e.g., `auth.UsersSignInRequest`). Type definitions are at module top-level with flat PascalCase names; namespace classes provide aliases. @@ -494,7 +518,7 @@ Preserves the original `#[serde(flatten)]` attribute on the field, since the gen ### TypeScript, Rust, and OpenAPI backends use raw Schema -The Python backend uses `SemanticSchema` for iteration ordering with `NormalizationPipeline::for_codegen()`. The TypeScript, Rust, and OpenAPI backends still consume the raw `Schema` directly. Migrating them to `SemanticSchema` would provide deterministic ordering and dependency-aware topological sorting. +The Python backend uses `SemanticSchema` for iteration ordering via `PipelineBuilder` (with consolidation and naming skipped). The TypeScript, Rust, and OpenAPI backends still consume the raw `Schema` directly. Migrating them to `SemanticSchema` would provide deterministic ordering and dependency-aware topological sorting. ### Flattened enum handling varies by representation diff --git a/reflectapi-schema/src/lib.rs b/reflectapi-schema/src/lib.rs index bb8423c9..70f9f4a8 100644 --- a/reflectapi-schema/src/lib.rs +++ b/reflectapi-schema/src/lib.rs @@ -11,8 +11,9 @@ mod visit; pub use self::codegen::*; pub use self::ids::ensure_symbol_ids; pub use self::normalize::{ - CircularDependencyResolutionStage, NamingResolutionStage, NormalizationError, - NormalizationPipeline, NormalizationStage, Normalizer, TypeConsolidationStage, + CircularDependencyResolutionStage, Consolidation, Naming, NamingResolutionStage, + NormalizationError, NormalizationPipeline, NormalizationStage, Normalizer, PipelineBuilder, + ResolutionStrategy, TypeConsolidationStage, }; pub use self::semantic::*; pub use self::subst::{mk_subst, Instantiate, Substitute}; diff --git a/reflectapi-schema/src/normalize.rs b/reflectapi-schema/src/normalize.rs index 15f09407..f8ded076 100644 --- a/reflectapi-schema/src/normalize.rs +++ b/reflectapi-schema/src/normalize.rs @@ -41,12 +41,11 @@ impl NormalizationPipeline { Ok(()) } - /// Create the standard normalization pipeline + /// Create the standard normalization pipeline. + /// + /// Delegates to `PipelineBuilder` with all default settings. pub fn standard() -> Self { - Self::new() - .add_stage(TypeConsolidationStage) - .add_stage(NamingResolutionStage) - .add_stage(CircularDependencyResolutionStage::new()) + PipelineBuilder::new().build() } /// Create a codegen-oriented pipeline that only runs CircularDependencyResolution. @@ -55,8 +54,159 @@ impl NormalizationPipeline { /// `schema.consolidate_types()` and does not want NamingResolution /// (which would rename types and create a name-domain mismatch /// between the SemanticSchema and the raw Schema used for rendering). + /// + /// Delegates to `PipelineBuilder` with consolidation and naming skipped. pub fn for_codegen() -> Self { - Self::new().add_stage(CircularDependencyResolutionStage::new()) + PipelineBuilder::new() + .consolidation(Consolidation::Skip) + .naming(Naming::Skip) + .build() + } +} + +// --------------------------------------------------------------------------- +// PipelineBuilder: configurable pipeline construction +// --------------------------------------------------------------------------- + +/// Controls whether and how input/output types are merged. +#[derive(Debug, Clone, Default)] +pub enum Consolidation { + /// Run the standard `TypeConsolidationStage`. + #[default] + Standard, + /// Skip type consolidation entirely. + Skip, +} + +/// Controls how type names are resolved. +#[derive(Default)] +pub enum Naming { + /// Run the standard `NamingResolutionStage`. + #[default] + Standard, + /// Skip naming resolution entirely. + Skip, + /// Use a custom naming stage. + Custom(Box), +} + +impl std::fmt::Debug for Naming { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Naming::Standard => write!(f, "Naming::Standard"), + Naming::Skip => write!(f, "Naming::Skip"), + Naming::Custom(_) => write!(f, "Naming::Custom(...)"), + } + } +} + +/// Builder for configuring a normalization pipeline. +/// +/// Provides fine-grained control over which normalization stages are included +/// and in what order. The default configuration matches `NormalizationPipeline::standard()`. +/// +/// # Examples +/// +/// ```rust,ignore +/// // Standard pipeline (equivalent to NormalizationPipeline::standard()) +/// let pipeline = PipelineBuilder::new().build(); +/// +/// // Codegen pipeline (equivalent to NormalizationPipeline::for_codegen()) +/// let pipeline = PipelineBuilder::new() +/// .consolidation(Consolidation::Skip) +/// .naming(Naming::Skip) +/// .build(); +/// +/// // Custom pipeline with extra stages +/// let pipeline = PipelineBuilder::new() +/// .circular_dependency_strategy(ResolutionStrategy::Boxing) +/// .add_stage(MyCustomStage) +/// .build(); +/// ``` +pub struct PipelineBuilder { + consolidation: Consolidation, + naming: Naming, + circular_dependency_strategy: ResolutionStrategy, + extra_stages: Vec>, +} + +impl Default for PipelineBuilder { + fn default() -> Self { + Self::new() + } +} + +impl PipelineBuilder { + /// Create a new builder with default settings (all stages enabled). + pub fn new() -> Self { + Self { + consolidation: Consolidation::default(), + naming: Naming::default(), + circular_dependency_strategy: ResolutionStrategy::default(), + extra_stages: Vec::new(), + } + } + + /// Set the consolidation strategy. + pub fn consolidation(mut self, consolidation: Consolidation) -> Self { + self.consolidation = consolidation; + self + } + + /// Set the naming resolution strategy. + pub fn naming(mut self, naming: Naming) -> Self { + self.naming = naming; + self + } + + /// Set the circular dependency resolution strategy. + pub fn circular_dependency_strategy(mut self, strategy: ResolutionStrategy) -> Self { + self.circular_dependency_strategy = strategy; + self + } + + /// Append a custom stage that will run after the built-in stages. + pub fn add_stage(mut self, stage: S) -> Self { + self.extra_stages.push(Box::new(stage)); + self + } + + /// Build the configured `NormalizationPipeline`. + /// + /// Stages are added in order: + /// 1. Type consolidation (if not skipped) + /// 2. Naming resolution (if not skipped, or custom stage) + /// 3. Circular dependency resolution (always included) + /// 4. Any extra stages added via `add_stage()` + pub fn build(self) -> NormalizationPipeline { + let mut pipeline = NormalizationPipeline::new(); + + match self.consolidation { + Consolidation::Standard => { + pipeline = pipeline.add_stage(TypeConsolidationStage); + } + Consolidation::Skip => {} + } + + match self.naming { + Naming::Standard => { + pipeline = pipeline.add_stage(NamingResolutionStage); + } + Naming::Skip => {} + Naming::Custom(stage) => { + pipeline.stages.push(stage); + } + } + + pipeline = pipeline.add_stage(CircularDependencyResolutionStage::with_strategy( + self.circular_dependency_strategy, + )); + + for stage in self.extra_stages { + pipeline.stages.push(stage); + } + + pipeline } } @@ -782,9 +932,8 @@ impl Normalizer { /// Normalize a raw schema into a semantic schema using a custom pipeline. /// - /// Use `NormalizationPipeline::for_codegen()` when the caller has already - /// consolidated types on the raw Schema and wants SemanticType names to - /// match the raw Schema names exactly (no NamingResolution renaming). + /// Use `PipelineBuilder` to configure which stages run, or the convenience + /// methods `NormalizationPipeline::standard()` / `NormalizationPipeline::for_codegen()`. pub fn normalize_with_pipeline( mut self, schema: &Schema, diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 319377fa..7338e5f1 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1028,7 +1028,10 @@ pub fn generate(mut schema: Schema, config: &Config) -> anyhow::Result { let semantic = reflectapi_schema::Normalizer::new() .normalize_with_pipeline( &schema, - reflectapi_schema::NormalizationPipeline::for_codegen(), + reflectapi_schema::PipelineBuilder::new() + .consolidation(reflectapi_schema::Consolidation::Skip) + .naming(reflectapi_schema::Naming::Skip) + .build(), ) .map_err(|errors| { anyhow::anyhow!( From 1307e100ef5a5941492af2bb7abd98cd2b15cc3d Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 12:49:02 +1300 Subject: [PATCH 46/47] fix: address final compiler review findings - Remove stale architecture doc claims (field descriptions and error types are now implemented, not "remaining gaps") - Remove dead code in render_struct: unreachable flattened-fields collection loop (flattened structs take the early return path) --- docs/architecture.md | 2 +- reflectapi/src/codegen/python.rs | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/docs/architecture.md b/docs/architecture.md index f4afd5f9..db281d02 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -530,4 +530,4 @@ Cycle detection uses Tarjan's SCC algorithm. The `Boxing` strategy is a no-op be ### Python codegen coverage -Validated against a production 284-endpoint API (57K-line generated client, 284 endpoints). Remaining gaps: field descriptions not propagated to Pydantic `Field(description=...)`, externally-tagged enums generate more boilerplate than TypeScript equivalents, error types not included in client method return signatures. +Validated against a production 284-endpoint API (59K-line generated client, 284 endpoints). Remaining gap: externally-tagged enums generate more boilerplate than TypeScript equivalents (multiple classes + RootModel + model_validator vs inline union syntax). diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 7338e5f1..06554ef3 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -1891,25 +1891,9 @@ fn render_struct( }) .collect::, anyhow::Error>>()?; - // Collect flattened fields recursively using the new helper function - let mut flattened_fields: Vec = Vec::new(); - for field in struct_def.fields.iter().filter(|f| f.flattened()) { - let fields = collect_flattened_fields( - &field.type_ref, - schema, - implemented_types, - &active_generics, - field.required, - 0, - used_type_vars, - Some(field.name()), - )?; - flattened_fields.extend(fields); - } - - // Combine regular fields with flattened field information - let mut all_fields = regular_fields; - all_fields.extend(flattened_fields); + // Note: flattened fields are handled by render_struct_with_flatten (early return + // at the top of this function). This path only handles non-flattened structs. + let all_fields = regular_fields; // Check if this is a generic struct (has type parameters) let has_generics = !struct_def.parameters.is_empty(); From 9642b672e395628229ed37c4a7ba84a2fc4e86ea Mon Sep 17 00:00:00 2001 From: Brian Thorne Date: Sun, 29 Mar 2026 12:54:27 +1300 Subject: [PATCH 47/47] fix: always import Field from pydantic, remove dead try/except MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Always import Field — used for descriptions, aliases, discriminators across many contexts. Fixes NameError for schemas with aliased fields but no discriminated unions. - Remove dead try/except around response_model identity check in runtime client (both sync and async). --- ..._tests__basic__reflectapi_deprecated-5.snap | 2 +- ...s__basic__reflectapi_enum_documented-4.snap | 1 + ...c__reflectapi_enum_with_skip_variant-5.snap | 2 +- ..._basic__reflectapi_struct_documented-4.snap | 2 +- ...ests__basic__reflectapi_struct_empty-5.snap | 2 +- ...ts__basic__reflectapi_struct_newtype-5.snap | 2 +- ...pi_struct_one_basic_field_static_str-4.snap | 2 +- ...ectapi_struct_one_basic_field_string-4.snap | 2 +- ...e_basic_field_string_reflectapi_both-5.snap | 2 +- ...field_string_reflectapi_both_equally-5.snap | 2 +- ...ield_string_reflectapi_both_equally2-4.snap | 2 +- ...ring_reflectapi_both_with_attributes-5.snap | 2 +- ...eflectapi_struct_one_basic_field_u32-4.snap | 2 +- ...sts__basic__reflectapi_struct_option-5.snap | 2 +- ...ests__basic__reflectapi_struct_tuple-5.snap | 2 +- ...__basic__reflectapi_struct_unit_type-5.snap | 2 +- ...ctapi_struct_with_additional_derives-5.snap | 2 +- ...truct_with_all_primitive_type_fields-5.snap | 2 +- ...s__basic__reflectapi_struct_with_arc-5.snap | 2 +- ...lectapi_struct_with_arc_pointer_only-5.snap | 2 +- ...c__reflectapi_struct_with_attributes-5.snap | 2 +- ...pi_struct_with_attributes_input_only-5.snap | 2 +- ...i_struct_with_attributes_output_only-5.snap | 2 +- ...api_struct_with_attributes_type_only-5.snap | 2 +- ..._with_external_generic_type_fallback-5.snap | 2 +- ...lectapi_struct_with_fixed_size_array-5.snap | 2 +- ...asic__reflectapi_struct_with_hashmap-5.snap | 2 +- ...reflectapi_struct_with_hashset_field-5.snap | 2 +- ...pi_struct_with_hashset_field_generic-5.snap | 2 +- ...basic__reflectapi_struct_with_nested-5.snap | 2 +- ...flectapi_struct_with_nested_external-5.snap | 2 +- ..._reflectapi_struct_with_self_via_arc-5.snap | 2 +- ...c__reflectapi_struct_with_skip_field-5.snap | 2 +- ...lectapi_struct_with_skip_field_input-5.snap | 2 +- ...ectapi_struct_with_skip_field_output-5.snap | 2 +- ...flectapi_struct_with_transform_array-5.snap | 2 +- ...eflectapi_struct_with_transform_both-5.snap | 2 +- ...ctapi_struct_with_transform_fallback-5.snap | 2 +- ...truct_with_transform_fallback_nested-5.snap | 2 +- ...flectapi_struct_with_transform_input-5.snap | 2 +- ...lectapi_struct_with_transform_output-5.snap | 2 +- ..._basic__reflectapi_struct_with_tuple-5.snap | 2 +- ...asic__reflectapi_struct_with_tuple12-5.snap | 2 +- ...s__basic__reflectapi_struct_with_vec-5.snap | 2 +- ..._reflectapi_struct_with_vec_external-5.snap | 2 +- ...c__reflectapi_struct_with_vec_nested-5.snap | 2 +- ...asic__reflectapi_struct_with_vec_two-5.snap | 2 +- .../reflectapi_demo__tests__enums__enum-4.snap | 2 +- ...ctapi_demo__tests__enums__enum_empty-4.snap | 2 +- ..._demo__tests__enums__enum_rename_num-5.snap | 2 +- ..._variant_and_fields_and_named_fields-4.snap | 1 + ...enum_with_discriminant_ignored_input-4.snap | 2 +- ...num_with_discriminant_ignored_output-4.snap | 2 +- ..._enums__enum_with_discriminant_input-4.snap | 2 +- ...enums__enum_with_discriminant_output-4.snap | 2 +- ...__enum_with_empty_variant_and_fields-4.snap | 1 + ...demo__tests__enums__enum_with_fields-4.snap | 1 + ...mo__tests__enums__enum_with_generics-4.snap | 1 + ...enums__enum_with_generics_and_fields-4.snap | 1 + ...generics_and_fields_and_named_fields-4.snap | 1 + ...rics__struct_with_circular_reference-4.snap | 2 +- ...ruct_with_circular_reference_generic-4.snap | 2 +- ...th_circular_reference_generic_parent-4.snap | 2 +- ...rcular_reference_generic_without_box-4.snap | 2 +- ...reference_generic_without_box_parent-4.snap | 2 +- ..._generic_without_box_parent_specific-4.snap | 2 +- ...s__struct_with_nested_generic_struct-4.snap | 2 +- ...uct_with_nested_generic_struct_twice-4.snap | 2 +- ...generics__struct_with_simple_generic-4.snap | 2 +- ...s__generics__struct_with_vec_generic-4.snap | 2 +- ...ics__struct_with_vec_generic_generic-4.snap | 2 +- ...uct_with_vec_generic_generic_generic-4.snap | 2 +- ...__tests__serde__box_field_unwrapping-5.snap | 2 +- ...lectapi_demo__tests__serde__datetime-5.snap | 2 +- ...ctapi_demo__tests__serde__empty_enum-5.snap | 2 +- ...de__empty_variants_adjacently_tagged-5.snap | 1 + ...de__empty_variants_externally_tagged-5.snap | 1 + ...ests__serde__empty_variants_untagged-5.snap | 2 +- ...tapi_demo__tests__serde__enum_rename-5.snap | 2 +- ..._demo__tests__serde__enum_rename_all-5.snap | 2 +- ...s__serde__enum_rename_all_on_variant-5.snap | 1 + ...ts__serde__enum_rename_variant_field-5.snap | 1 + ...demo__tests__serde__enum_tag_content-5.snap | 1 + ...__serde__enum_tag_content_rename_all-5.snap | 1 + ...pi_demo__tests__serde__enum_untagged-5.snap | 2 +- ...__tests__serde__enum_with_field_skip-5.snap | 1 + ...e__enum_with_rename_to_invalid_chars-5.snap | 1 + ...__enum_with_serde_rename_on_variants-5.snap | 1 + ...tests__serde__enum_with_variant_skip-5.snap | 2 +- ...__enum_with_variant_skip_deserialize-5.snap | 2 +- ...de__enum_with_variant_skip_serialize-5.snap | 2 +- ...s__serde__enum_with_variant_untagged-5.snap | 1 + ...i_demo__tests__serde__external_impls-5.snap | 2 +- ...ts__serde__field_all_python_keywords-5.snap | 2 +- ...erde__field_names_with_special_chars-5.snap | 2 +- ...flatten_adjacently_tagged_enum_field-5.snap | 1 + ...flatten_externally_tagged_enum_field-5.snap | 1 + ...sts__serde__flatten_multiple_structs-5.snap | 2 +- ...__flatten_struct_with_nested_flatten-5.snap | 2 +- ...api_demo__tests__serde__flatten_unit-5.snap | 2 +- ...__serde__flatten_untagged_enum_field-5.snap | 2 +- ...erde__generic_adjacently_tagged_enum-5.snap | 1 + ...erde__generic_externally_tagged_enum-5.snap | 1 + ...rde__generic_struct_repr_transparent-5.snap | 2 +- ...t_repr_transparent_partially_generic-5.snap | 2 +- ...ctapi_demo__tests__serde__kebab_case-5.snap | 2 +- ...e__multiple_underscore_prefix_fields-5.snap | 2 +- ...rde__namespace_deeply_nested_modules-5.snap | 2 +- ...serde__namespace_single_segment_type-5.snap | 2 +- ..._serde__namespace_with_numeric_start-5.snap | 2 +- ...ts__serde__nested_generic_containers-5.snap | 2 +- ...__newtype_variants_adjacently_tagged-5.snap | 1 + ...__newtype_variants_externally_tagged-5.snap | 1 + ...demo__tests__serde__option_of_option-5.snap | 2 +- ...ests__serde__self_referential_struct-5.snap | 2 +- ...tapi_demo__tests__serde__struct_from-5.snap | 2 +- ...tapi_demo__tests__serde__struct_into-5.snap | 2 +- ...pi_demo__tests__serde__struct_rename-5.snap | 2 +- ...emo__tests__serde__struct_rename_all-5.snap | 2 +- ...serde__struct_rename_all_differently-5.snap | 2 +- ...serde__struct_rename_all_pascal_case-5.snap | 2 +- ...ts__serde__struct_rename_differently-5.snap | 2 +- ...o__tests__serde__struct_rename_field-5.snap | 2 +- ..._repr_transparent_generic_inner_type-5.snap | 2 +- ..._demo__tests__serde__struct_try_from-5.snap | 2 +- ...o__tests__serde__struct_with_flatten-5.snap | 2 +- ..._serde__struct_with_flatten_optional-5.snap | 2 +- ...t_with_flatten_optional_and_required-5.snap | 2 +- ..._struct_with_rename_to_invalid_chars-5.snap | 2 +- ...de__struct_with_rename_to_kebab_case-5.snap | 2 +- ...ts__serde__struct_with_serde_default-5.snap | 2 +- ...tests__serde__struct_with_serde_skip-5.snap | 2 +- ...__struct_with_serde_skip_deserialize-5.snap | 2 +- ...de__struct_with_serde_skip_serialize-5.snap | 2 +- ..._struct_with_serde_skip_serialize_if-5.snap | 2 +- ...serde__struct_with_serde_transparent-5.snap | 2 +- ...lectapi_demo__tests__serde__timezone-5.snap | 2 +- ...tapi_demo__tests__serde__unit_struct-5.snap | 2 +- ...emo__tests__serde__unit_tuple_struct-5.snap | 2 +- .../src/reflectapi_runtime/client.py | 18 ++++++------------ reflectapi/src/codegen/python.rs | 5 +++-- 141 files changed, 148 insertions(+), 130 deletions(-) diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap index 2b48ac12..4f635d94 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_deprecated-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap index d71903cc..b0bc3526 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_documented-4.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap index a173e238..35fa07a5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_enum_with_skip_variant-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap index 15f5d86b..7589927d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_documented-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap index e56f49e5..f4276e04 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_empty-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap index 5c7cd755..c8045d02 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_newtype-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap index 985221de..7aa9890a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_static_str-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap index 5dc7f06e..f8c17f3c 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap index 92636fb6..369fb8e1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap index 80344d68..0ceb49dd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap index 631e7785..12082e68 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_equally2-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap index 6aa11c0d..fb9ae717 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_string_reflectapi_both_with_attributes-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap index 94886aed..c1c1c38a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_one_basic_field_u32-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap index b963cb4d..c963a7ee 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_option-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap index 1ddc86bf..b89f25d7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_tuple-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap index 9130c65f..99904cf7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_unit_type-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap index b460da78..b70547ad 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_additional_derives-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap index 2dba8821..39613578 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_all_primitive_type_fields-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap index 6198c9ba..309214f5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap index 349f3e11..7baa4bac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_arc_pointer_only-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap index fc2178d5..b3c8c94b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap index 4df00ce6..bbe42397 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_input_only-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap index d272ea99..f3dafc2b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_output_only-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap index d6f94aef..9032b21a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_attributes_type_only-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap index 08c1e54f..5675ba5f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_external_generic_type_fallback-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap index 768e792d..af3eec3a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_fixed_size_array-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap index af88c353..be526eb9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashmap-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap index 2e2f5355..ec4c116d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap index c70a1727..514bfa4e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_hashset_field_generic-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap index 1e7da03a..720c3d85 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap index 6b8ac0a2..39d30505 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_nested_external-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap index a4bfe6ac..d417ecd8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_self_via_arc-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap index 7b3fd545..54ac90a9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap index 9d3a79c6..d052cf13 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_input-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap index 8531978b..46c77102 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_skip_field_output-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap index 3f9fe9e1..c3d1e56b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_array-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap index 4d2e1a35..cf78b4e5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_both-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap index b78a0a63..9fdd95c4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap index 7105a5cb..600258d9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_fallback_nested-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap index 6b581971..15856e46 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_input-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap index eab7e5f0..eae22a12 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_transform_output-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap index efdf9c74..b194eb1f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap index 7a06506a..841473d7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_tuple12-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap index 6462325e..bea3b0f4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap index 5d1ebffb..e714c4b8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_external-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap index 637cbd19..200bcee5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_nested-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap index 3ab55f37..99d73b0b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__basic__reflectapi_struct_with_vec_two-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap index 2f7a16ff..dd0929e3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum-4.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap index a942237b..72b8e901 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_empty-4.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap index 1948e8f5..d1d97873 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_rename_num-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap index 35c6f2c9..20061b55 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_basic_variant_and_fields_and_named_fields-4.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap index e619f8f6..c2226d35 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_input-4.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap index 473996f6..a0359ef3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_ignored_output-4.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap index 93607b49..4ebe0d2f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_input-4.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap index ce0c6143..fa0609e5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_discriminant_output-4.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap index 2e80eb88..57319bdb 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_empty_variant_and_fields-4.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap index 5faca6ec..13c76fb5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_fields-4.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap index 149748b9..8550df10 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics-4.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap index 5405a149..4482a317 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields-4.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap index 41643f3e..c20a1187 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__enums__enum_with_generics_and_fields_and_named_fields-4.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap index 217b76a6..075935c8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap index 336b96ad..510a7161 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap index f560b362..3c2e3ab2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_parent-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap index 457b68a8..fb7a6721 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap index d43ced93..2b462663 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap index 0337b867..5332fd41 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_circular_reference_generic_without_box_parent_specific-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap index f201fb14..364f6ddf 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap index d8d5c976..6197e8c1 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_nested_generic_struct_twice-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap index 2b628e89..ccde25c4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_simple_generic-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap index 81bff2f2..7ea8d753 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap index 409ed097..98a157b6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap index 2e286df1..825b08d2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__generics__struct_with_vec_generic_generic_generic-4.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap index a5d61b6b..22649dcc 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__box_field_unwrapping-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap index 7f575ec9..d19bb870 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__datetime-5.snap @@ -17,7 +17,7 @@ from datetime import datetime, date, timedelta from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap index 8a352b63..f7dbbbf4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_enum-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap index d63abfef..28d9c6f2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_adjacently_tagged-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap index 4d550211..2d41c6ee 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_externally_tagged-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap index 7d9d642c..e3bcbec8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__empty_variants_untagged-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap index ad07a023..355a5235 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap index 3123173f..98fef325 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap index 69e84b15..0eeb72e5 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_all_on_variant-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap index 4e6bce2a..533d4182 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_rename_variant_field-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap index 73a06da1..7aa08bfe 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap index edfd1d7c..226b586d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_tag_content_rename_all-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap index 1cfab641..ca331871 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_untagged-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap index cc65c97b..4a820178 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_field_skip-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap index 19d8b3bc..5f7a2237 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_rename_to_invalid_chars-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap index aa75d7bf..d0b2408a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_serde_rename_on_variants-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap index 59dff440..9ad62d20 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap index 4eb469d2..6817e991 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_deserialize-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap index 06027402..a6522535 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_skip_serialize-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap index 2886e42f..38cc0bf6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__enum_with_variant_untagged-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap index 63214b5b..170d9e2b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__external_impls-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap index bfa982b5..6e5141a2 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_all_python_keywords-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap index c8998f4d..58e8f934 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__field_names_with_special_chars-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap index d04289b4..2563f520 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_adjacently_tagged_enum_field-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap index 5fb92262..1e7c313d 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_externally_tagged_enum_field-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap index 9681d603..57a00356 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_multiple_structs-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap index a0506c13..0104634a 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_struct_with_nested_flatten-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap index f6d49364..e33271b4 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_unit-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap index 0f896cc7..45df6567 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__flatten_untagged_enum_field-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap index f0785457..064c4073 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_adjacently_tagged_enum-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap index 33845ef7..acb3e9f9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_externally_tagged_enum-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap index 45624de1..d47d9065 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap index ea5d4355..31b84a7e 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__generic_struct_repr_transparent_partially_generic-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap index f3a9a9c0..c74060b7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__kebab_case-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap index 9d66aa03..4d4f295b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__multiple_underscore_prefix_fields-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap index 0d8d3a50..f49bcd70 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_deeply_nested_modules-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap index 68877877..ab97e063 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_single_segment_type-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap index c6e1187f..7c9c3e4f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__namespace_with_numeric_start-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap index 24676488..53ac8c41 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__nested_generic_containers-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap index 115ec490..fc347cb7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_adjacently_tagged-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap index d6d24b76..b4c7ea68 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__newtype_variants_externally_tagged-5.snap @@ -20,6 +20,7 @@ from typing import Annotated, Any, Generic, Optional, TypeVar, Union from pydantic import ( BaseModel, ConfigDict, + Field, PrivateAttr, RootModel, model_serializer, diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap index a34a7a72..d64ef1b7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__option_of_option-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap index a0db04e6..61120080 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__self_referential_struct-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap index 0071b7dc..a09ea2e9 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_from-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap index 891132d5..662f54ac 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_into-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap index 5c8a4930..cbc43008 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap index 02ff4550..f6c0a618 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap index 80891709..8f0a3619 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_differently-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap index 9a265517..a4cd3aa8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_all_pascal_case-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap index e6180e38..73e2d3bd 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_differently-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap index be4a501d..eaa742ed 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_rename_field-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap index 28ca6e4c..e54e0b3b 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_repr_transparent_generic_inner_type-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap index 6e8d2a5c..91a92da7 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_try_from-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap index 597777e8..30423229 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap index 104dae7e..d97d1c86 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap index 98a5635c..a9b72a75 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_flatten_optional_and_required-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap index c3d0523b..19ac1fd3 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_invalid_chars-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap index d9057077..fed2460f 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_rename_to_kebab_case-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap index 2d286947..1eb93882 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_default-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap index 08d9fcb9..63f230c6 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap index e501631f..52a915da 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_deserialize-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap index b2ef0b9c..b8965b63 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap index 937a231b..a1a8e240 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_skip_serialize_if-5.snap @@ -17,7 +17,7 @@ from enum import Enum from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap index 69e7689b..38276207 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__struct_with_serde_transparent-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap index 0b680853..ca5f1b59 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__timezone-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap index 8d4ebcd2..4b7497c8 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_struct-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap index af52f55e..5340e847 100644 --- a/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap +++ b/reflectapi-demo/src/tests/snapshots/reflectapi_demo__tests__serde__unit_tuple_struct-5.snap @@ -16,7 +16,7 @@ from __future__ import annotations from typing import Annotated, Any, Generic, Optional, TypeVar, Union # Third-party imports -from pydantic import BaseModel, ConfigDict +from pydantic import BaseModel, ConfigDict, Field # Runtime imports from reflectapi_runtime import AsyncClientBase, ClientBase, ApiResponse diff --git a/reflectapi-python-runtime/src/reflectapi_runtime/client.py b/reflectapi-python-runtime/src/reflectapi_runtime/client.py index 40577341..178011a7 100644 --- a/reflectapi-python-runtime/src/reflectapi_runtime/client.py +++ b/reflectapi-python-runtime/src/reflectapi_runtime/client.py @@ -430,12 +430,9 @@ def _validate_response_model( json_response = self._parse_json_response(response) return ApiResponse(json_response, metadata) - try: - if response_model is Any: - json_response = self._parse_json_response(response) - return ApiResponse(json_response, metadata) - except Exception: - pass + if response_model is Any: + json_response = self._parse_json_response(response) + return ApiResponse(json_response, metadata) try: ta = TypeAdapter(response_model) @@ -871,12 +868,9 @@ def _validate_response_model( json_response = self._parse_json_response(response) return ApiResponse(json_response, metadata) - try: - if response_model is Any: - json_response = self._parse_json_response(response) - return ApiResponse(json_response, metadata) - except Exception: - pass + if response_model is Any: + json_response = self._parse_json_response(response) + return ApiResponse(json_response, metadata) try: ta = TypeAdapter(response_model) diff --git a/reflectapi/src/codegen/python.rs b/reflectapi/src/codegen/python.rs index 06554ef3..a72f4f2b 100644 --- a/reflectapi/src/codegen/python.rs +++ b/reflectapi/src/codegen/python.rs @@ -104,11 +104,12 @@ fn generate_optimized_imports(imports: &templates::Imports) -> String { typing_imports.insert("Literal"); } - // Pydantic imports + // Pydantic imports — Field is always imported since it's used for + // descriptions, aliases, discriminators, and defaults across many contexts. third_party_imports.insert("BaseModel"); third_party_imports.insert("ConfigDict"); + third_party_imports.insert("Field"); if imports.has_discriminated_unions { - third_party_imports.insert("Field"); third_party_imports.insert("RootModel"); } if imports.has_externally_tagged_enums {