polyxml 0.30.1__tar.gz → 0.30.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {polyxml-0.30.1 → polyxml-0.30.2}/Cargo.lock +6 -6
- {polyxml-0.30.1 → polyxml-0.30.2}/Cargo.toml +1 -1
- {polyxml-0.30.1 → polyxml-0.30.2}/PKG-INFO +1 -1
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/rust/mod.rs +20 -32
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_rust_codegen.rs +42 -1
- {polyxml-0.30.1 → polyxml-0.30.2}/pyproject.toml +1 -1
- {polyxml-0.30.1 → polyxml-0.30.2}/README.md +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/Cargo.toml +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/README.md +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/benches/core_benchmarks.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/benches/support/tag_dispatch_fixtures.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/benches/tag_dispatch.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/cpp/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/csharp/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/go/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/java/codec.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/java/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/java/models.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/python/aot.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/python/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/codegen/typescript/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/converters.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/error.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/ir/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/ir/tarjan.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/json.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/lib.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/parser.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/schema.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/schema_parser/mod.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/serializer.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/transcoder.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/src/value.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/fixtures/lexical_union.xsd +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/fixtures/mixed_content.xsd +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_adversarial_identifiers.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_conformance.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_core.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_cpp_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_csharp_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_go_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_java_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_json.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_lexical_union_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_mixed_content.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_pattern_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_python_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_rust_codecs.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_schema_audit.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_schema_ir.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_security.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_transcoder.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_ts_codegen.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_unbounded_choice.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/tests/test_xsi_type.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/Cargo.toml +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/README.md +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/benches/aot_vs_dataclass.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/src/lib.rs +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/tests/test_conformance.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/tests/test_generated_models.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/tests/test_json.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/tests/test_mixed_content.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/tests/test_polyxml.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-python/tests/test_xsi_type.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/python/polyxml/AGENT_GUIDE.md +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/python/polyxml/__init__.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/python/polyxml/compat/__init__.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/python/polyxml/compat/xsdata.py +0 -0
- {polyxml-0.30.1 → polyxml-0.30.2}/python/polyxml/py.typed +0 -0
|
@@ -608,7 +608,7 @@ dependencies = [
|
|
|
608
608
|
|
|
609
609
|
[[package]]
|
|
610
610
|
name = "polyxml"
|
|
611
|
-
version = "0.30.
|
|
611
|
+
version = "0.30.2"
|
|
612
612
|
dependencies = [
|
|
613
613
|
"criterion",
|
|
614
614
|
"heck",
|
|
@@ -629,14 +629,14 @@ dependencies = [
|
|
|
629
629
|
|
|
630
630
|
[[package]]
|
|
631
631
|
name = "polyxml-c"
|
|
632
|
-
version = "0.30.
|
|
632
|
+
version = "0.30.2"
|
|
633
633
|
dependencies = [
|
|
634
634
|
"polyxml",
|
|
635
635
|
]
|
|
636
636
|
|
|
637
637
|
[[package]]
|
|
638
638
|
name = "polyxml-cli"
|
|
639
|
-
version = "0.30.
|
|
639
|
+
version = "0.30.2"
|
|
640
640
|
dependencies = [
|
|
641
641
|
"clap",
|
|
642
642
|
"glob",
|
|
@@ -650,7 +650,7 @@ dependencies = [
|
|
|
650
650
|
|
|
651
651
|
[[package]]
|
|
652
652
|
name = "polyxml-js"
|
|
653
|
-
version = "0.30.
|
|
653
|
+
version = "0.30.2"
|
|
654
654
|
dependencies = [
|
|
655
655
|
"napi",
|
|
656
656
|
"napi-build",
|
|
@@ -660,7 +660,7 @@ dependencies = [
|
|
|
660
660
|
|
|
661
661
|
[[package]]
|
|
662
662
|
name = "polyxml-python"
|
|
663
|
-
version = "0.30.
|
|
663
|
+
version = "0.30.2"
|
|
664
664
|
dependencies = [
|
|
665
665
|
"lexical-core",
|
|
666
666
|
"polyxml",
|
|
@@ -670,7 +670,7 @@ dependencies = [
|
|
|
670
670
|
|
|
671
671
|
[[package]]
|
|
672
672
|
name = "polyxml-wasm"
|
|
673
|
-
version = "0.30.
|
|
673
|
+
version = "0.30.2"
|
|
674
674
|
dependencies = [
|
|
675
675
|
"polyxml",
|
|
676
676
|
"quick-xml",
|
|
@@ -5,8 +5,8 @@ use heck::{AsPascalCase, AsSnakeCase};
|
|
|
5
5
|
use serde::{Deserialize, Serialize};
|
|
6
6
|
|
|
7
7
|
use crate::codegen::{
|
|
8
|
-
build_type_name_map, flatten_fields, lookup_type_name,
|
|
9
|
-
LanguageContext,
|
|
8
|
+
build_type_name_map, flatten_fields, lookup_type_name, primitive_base, sanitize_keyword,
|
|
9
|
+
set_type_name_map, LanguageContext,
|
|
10
10
|
};
|
|
11
11
|
use crate::ir::{
|
|
12
12
|
EnumDef, FieldDef, FieldKind, PrimitiveType, QName, SchemaIR, SimpleTypeDef, StructDef,
|
|
@@ -998,8 +998,17 @@ impl RustCodegen {
|
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
1000
|
|
|
1001
|
+
fn unwrap_type_ref(mut ty: &TypeRef) -> &TypeRef {
|
|
1002
|
+
while let TypeRef::Boxed(inner) | TypeRef::List(inner) = ty {
|
|
1003
|
+
ty = inner;
|
|
1004
|
+
}
|
|
1005
|
+
ty
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1001
1008
|
fn field_is_string(&self, type_ref: &TypeRef, ir: &SchemaIR) -> bool {
|
|
1002
|
-
|
|
1009
|
+
let ty = Self::unwrap_type_ref(type_ref);
|
|
1010
|
+
let base = primitive_base(ty, ir);
|
|
1011
|
+
match base {
|
|
1003
1012
|
TypeRef::Primitive(prim) => matches!(
|
|
1004
1013
|
prim,
|
|
1005
1014
|
PrimitiveType::String
|
|
@@ -1030,19 +1039,14 @@ impl RustCodegen {
|
|
|
1030
1039
|
| PrimitiveType::HexBinary
|
|
1031
1040
|
| PrimitiveType::AnySimpleType
|
|
1032
1041
|
),
|
|
1033
|
-
|
|
1034
|
-
if let Some(TypeDef::Simple(s)) = ir.types.get(qname) {
|
|
1035
|
-
self.field_is_string(&s.base_type, ir)
|
|
1036
|
-
} else {
|
|
1037
|
-
false
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
TypeRef::Boxed(inner) | TypeRef::List(inner) => self.field_is_string(inner, ir),
|
|
1042
|
+
_ => false,
|
|
1041
1043
|
}
|
|
1042
1044
|
}
|
|
1043
1045
|
|
|
1044
1046
|
fn field_numeric_type(&self, type_ref: &TypeRef, ir: &SchemaIR) -> Option<&'static str> {
|
|
1045
|
-
|
|
1047
|
+
let ty = Self::unwrap_type_ref(type_ref);
|
|
1048
|
+
let base = primitive_base(ty, ir);
|
|
1049
|
+
match base {
|
|
1046
1050
|
TypeRef::Primitive(prim) => match prim {
|
|
1047
1051
|
PrimitiveType::Int => Some("i32"),
|
|
1048
1052
|
PrimitiveType::Integer
|
|
@@ -1061,30 +1065,14 @@ impl RustCodegen {
|
|
|
1061
1065
|
PrimitiveType::Float => Some("f32"),
|
|
1062
1066
|
_ => None,
|
|
1063
1067
|
},
|
|
1064
|
-
|
|
1065
|
-
if let Some(TypeDef::Simple(s)) = ir.types.get(qname) {
|
|
1066
|
-
self.field_numeric_type(&s.base_type, ir)
|
|
1067
|
-
} else {
|
|
1068
|
-
None
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
TypeRef::Boxed(inner) | TypeRef::List(inner) => self.field_numeric_type(inner, ir),
|
|
1068
|
+
_ => None,
|
|
1072
1069
|
}
|
|
1073
1070
|
}
|
|
1074
1071
|
|
|
1075
1072
|
fn field_is_bool(&self, type_ref: &TypeRef, ir: &SchemaIR) -> bool {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
if let Some(TypeDef::Simple(s)) = ir.types.get(qname) {
|
|
1080
|
-
self.field_is_bool(&s.base_type, ir)
|
|
1081
|
-
} else {
|
|
1082
|
-
false
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
TypeRef::Boxed(inner) | TypeRef::List(inner) => self.field_is_bool(inner, ir),
|
|
1086
|
-
_ => false,
|
|
1087
|
-
}
|
|
1073
|
+
let ty = Self::unwrap_type_ref(type_ref);
|
|
1074
|
+
let base = primitive_base(ty, ir);
|
|
1075
|
+
matches!(base, TypeRef::Primitive(PrimitiveType::Boolean))
|
|
1088
1076
|
}
|
|
1089
1077
|
|
|
1090
1078
|
fn field_is_enum(&self, type_ref: &TypeRef, ir: &SchemaIR) -> Option<String> {
|
|
@@ -3,7 +3,7 @@ use polyxml::codegen::rust::{
|
|
|
3
3
|
};
|
|
4
4
|
use polyxml::ir::{
|
|
5
5
|
Cardinality, EnumDef, EnumValue, FieldDef, FieldKind, PrimitiveType, QName, SchemaIR,
|
|
6
|
-
StructDef, TypeDef, TypeRef, UnionBranch, UnionDef,
|
|
6
|
+
SimpleTypeDef, StructDef, TypeDef, TypeRef, UnionBranch, UnionDef,
|
|
7
7
|
};
|
|
8
8
|
use polyxml::schema_parser::XsdParser;
|
|
9
9
|
|
|
@@ -1147,3 +1147,44 @@ fn test_rust_phf_dispatch_uniquifies_like_field_metas() {
|
|
|
1147
1147
|
"bare-string arm leaked into the Option match:\n{code}"
|
|
1148
1148
|
);
|
|
1149
1149
|
}
|
|
1150
|
+
|
|
1151
|
+
#[test]
|
|
1152
|
+
fn test_rust_simple_type_cycle_resilience() {
|
|
1153
|
+
let mut ir = SchemaIR::default();
|
|
1154
|
+
let q_a = QName::new(Some("urn:cycle"), "TypeA");
|
|
1155
|
+
let q_b = QName::new(Some("urn:cycle"), "TypeB");
|
|
1156
|
+
|
|
1157
|
+
// Mutual cycle between TypeA and TypeB
|
|
1158
|
+
ir.add_type(TypeDef::Simple(Box::new(SimpleTypeDef {
|
|
1159
|
+
qname: q_a.clone(),
|
|
1160
|
+
base_type: TypeRef::Named(q_b.clone()),
|
|
1161
|
+
facets: Default::default(),
|
|
1162
|
+
documentation: None,
|
|
1163
|
+
})));
|
|
1164
|
+
ir.add_type(TypeDef::Simple(Box::new(SimpleTypeDef {
|
|
1165
|
+
qname: q_b.clone(),
|
|
1166
|
+
base_type: TypeRef::Named(q_a.clone()),
|
|
1167
|
+
facets: Default::default(),
|
|
1168
|
+
documentation: None,
|
|
1169
|
+
})));
|
|
1170
|
+
|
|
1171
|
+
let struct_fields = vec![FieldDef::new(
|
|
1172
|
+
"cyclic_field",
|
|
1173
|
+
"cyclic_field",
|
|
1174
|
+
FieldKind::Element,
|
|
1175
|
+
TypeRef::Named(q_a),
|
|
1176
|
+
)];
|
|
1177
|
+
|
|
1178
|
+
ir.add_type(TypeDef::Struct(StructDef {
|
|
1179
|
+
qname: QName::new(Some("urn:cycle"), "CyclicStruct"),
|
|
1180
|
+
fields: struct_fields,
|
|
1181
|
+
base_type: None,
|
|
1182
|
+
is_abstract: false,
|
|
1183
|
+
is_mixed: false,
|
|
1184
|
+
documentation: None,
|
|
1185
|
+
}));
|
|
1186
|
+
|
|
1187
|
+
let codegen = RustCodegen::new(RustOptions::default());
|
|
1188
|
+
let code = codegen.generate_module(&ir);
|
|
1189
|
+
assert!(code.contains("pub struct CyclicStruct"));
|
|
1190
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{polyxml-0.30.1 → polyxml-0.30.2}/crates/polyxml-core/benches/support/tag_dispatch_fixtures.rs
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|