polyxml 0.14.0__tar.gz → 0.14.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.14.0 → polyxml-0.14.2}/Cargo.lock +5 -5
- {polyxml-0.14.0 → polyxml-0.14.2}/Cargo.toml +1 -1
- {polyxml-0.14.0 → polyxml-0.14.2}/PKG-INFO +1 -1
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/cpp/mod.rs +6 -1
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/csharp/mod.rs +3 -2
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/go/mod.rs +6 -1
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/rust/mod.rs +29 -6
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/typescript/mod.rs +23 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_csharp_codegen.rs +14 -6
- {polyxml-0.14.0 → polyxml-0.14.2}/pyproject.toml +1 -1
- {polyxml-0.14.0 → polyxml-0.14.2}/README.md +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/Cargo.toml +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/README.md +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/benches/core_benchmarks.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/java/mod.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/mod.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/codegen/python/mod.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/converters.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/error.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/ir/mod.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/ir/tarjan.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/json.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/lib.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/parser.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/schema.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/schema_parser/mod.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/serializer.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/transcoder.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/src/value.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_conformance.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_core.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_cpp_codegen.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_go_codegen.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_java_codegen.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_json.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_python_codegen.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_rust_codecs.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_rust_codegen.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_schema_ir.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_security.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_transcoder.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-core/tests/test_ts_codegen.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-python/Cargo.toml +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-python/README.md +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-python/src/lib.rs +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-python/tests/test_conformance.py +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-python/tests/test_generated_models.py +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-python/tests/test_json.py +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/crates/polyxml-python/tests/test_polyxml.py +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/python/polyxml/AGENT_GUIDE.md +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/python/polyxml/__init__.py +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/python/polyxml/compat/__init__.py +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/python/polyxml/compat/xsdata.py +0 -0
- {polyxml-0.14.0 → polyxml-0.14.2}/python/polyxml/py.typed +0 -0
|
@@ -549,7 +549,7 @@ dependencies = [
|
|
|
549
549
|
|
|
550
550
|
[[package]]
|
|
551
551
|
name = "polyxml"
|
|
552
|
-
version = "0.14.
|
|
552
|
+
version = "0.14.2"
|
|
553
553
|
dependencies = [
|
|
554
554
|
"criterion",
|
|
555
555
|
"heck",
|
|
@@ -567,14 +567,14 @@ dependencies = [
|
|
|
567
567
|
|
|
568
568
|
[[package]]
|
|
569
569
|
name = "polyxml-c"
|
|
570
|
-
version = "0.14.
|
|
570
|
+
version = "0.14.2"
|
|
571
571
|
dependencies = [
|
|
572
572
|
"polyxml",
|
|
573
573
|
]
|
|
574
574
|
|
|
575
575
|
[[package]]
|
|
576
576
|
name = "polyxml-cli"
|
|
577
|
-
version = "0.14.
|
|
577
|
+
version = "0.14.2"
|
|
578
578
|
dependencies = [
|
|
579
579
|
"clap",
|
|
580
580
|
"glob",
|
|
@@ -588,7 +588,7 @@ dependencies = [
|
|
|
588
588
|
|
|
589
589
|
[[package]]
|
|
590
590
|
name = "polyxml-js"
|
|
591
|
-
version = "0.14.
|
|
591
|
+
version = "0.14.2"
|
|
592
592
|
dependencies = [
|
|
593
593
|
"napi",
|
|
594
594
|
"napi-build",
|
|
@@ -598,7 +598,7 @@ dependencies = [
|
|
|
598
598
|
|
|
599
599
|
[[package]]
|
|
600
600
|
name = "polyxml-python"
|
|
601
|
-
version = "0.14.
|
|
601
|
+
version = "0.14.2"
|
|
602
602
|
dependencies = [
|
|
603
603
|
"lexical-core",
|
|
604
604
|
"polyxml",
|
|
@@ -799,7 +799,12 @@ concept XmlModel = requires(T a) {{
|
|
|
799
799
|
let target_type = self.context.map_type_ref(&elem.type_ref);
|
|
800
800
|
if elem_alias != target_type {
|
|
801
801
|
if let Some(ref doc) = elem.documentation {
|
|
802
|
-
|
|
802
|
+
for line in doc.lines() {
|
|
803
|
+
let trimmed = line.trim();
|
|
804
|
+
if !trimmed.is_empty() {
|
|
805
|
+
writeln!(out, "/// {}", trimmed).unwrap();
|
|
806
|
+
}
|
|
807
|
+
}
|
|
803
808
|
}
|
|
804
809
|
writeln!(out, "using {} = {};", elem_alias, target_type).unwrap();
|
|
805
810
|
}
|
|
@@ -595,10 +595,11 @@ impl CSharpCodegen {
|
|
|
595
595
|
|
|
596
596
|
fn emit_struct_validator(&self, out: &mut String, s: &StructDef, indent: &str) {
|
|
597
597
|
let struct_name = to_csharp_type_name(&s.qname.local);
|
|
598
|
+
let new_kw = if s.base_type.is_some() { "new " } else { "" };
|
|
598
599
|
writeln!(
|
|
599
600
|
out,
|
|
600
|
-
"{} public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)",
|
|
601
|
-
indent
|
|
601
|
+
"{} public {}IEnumerable<ValidationResult> Validate(ValidationContext validationContext)",
|
|
602
|
+
indent, new_kw
|
|
602
603
|
)
|
|
603
604
|
.unwrap();
|
|
604
605
|
writeln!(out, "{} {{", indent).unwrap();
|
|
@@ -760,7 +760,12 @@ impl GoCodegen {
|
|
|
760
760
|
let target_type = self.context.map_type_ref(&elem.type_ref);
|
|
761
761
|
if elem_alias != target_type {
|
|
762
762
|
if let Some(ref doc) = elem.documentation {
|
|
763
|
-
|
|
763
|
+
for line in doc.lines() {
|
|
764
|
+
let trimmed = line.trim();
|
|
765
|
+
if !trimmed.is_empty() {
|
|
766
|
+
writeln!(out, "// {}", trimmed).unwrap();
|
|
767
|
+
}
|
|
768
|
+
}
|
|
764
769
|
}
|
|
765
770
|
writeln!(out, "type {} = {}\n", elem_alias, target_type).unwrap();
|
|
766
771
|
}
|
|
@@ -33,7 +33,7 @@ impl Default for RustOptions {
|
|
|
33
33
|
zero_copy: true,
|
|
34
34
|
derive_serde: true,
|
|
35
35
|
derive_default: true,
|
|
36
|
-
emit_polyxml_attrs:
|
|
36
|
+
emit_polyxml_attrs: false,
|
|
37
37
|
emit_root_aliases: true,
|
|
38
38
|
emit_codecs: true,
|
|
39
39
|
}
|
|
@@ -201,7 +201,7 @@ impl RustCodegen {
|
|
|
201
201
|
|
|
202
202
|
out.push_str("// Generated by PolyXML Compiler (https://github.com/nth-bailey/PolyXML)\n");
|
|
203
203
|
out.push_str(
|
|
204
|
-
"#![allow(dead_code, unused_imports, non_camel_case_types, non_snake_case)]\n\n",
|
|
204
|
+
"#![allow(dead_code, unused_imports, unused_mut, unused_variables, non_camel_case_types, non_snake_case)]\n\n",
|
|
205
205
|
);
|
|
206
206
|
|
|
207
207
|
let types_with_lifetime = if self.options.zero_copy {
|
|
@@ -422,6 +422,9 @@ impl RustCodegen {
|
|
|
422
422
|
}
|
|
423
423
|
|
|
424
424
|
let mut derives = vec!["Debug", "Clone", "Copy", "PartialEq", "Eq", "Hash"];
|
|
425
|
+
if self.options.derive_default {
|
|
426
|
+
derives.push("Default");
|
|
427
|
+
}
|
|
425
428
|
if self.options.derive_serde {
|
|
426
429
|
derives.push("Serialize");
|
|
427
430
|
derives.push("Deserialize");
|
|
@@ -433,7 +436,7 @@ impl RustCodegen {
|
|
|
433
436
|
let mut seen_variants = HashSet::new();
|
|
434
437
|
let mut variant_map = Vec::new();
|
|
435
438
|
|
|
436
|
-
for variant in
|
|
439
|
+
for (idx, variant) in e.variants.iter().enumerate() {
|
|
437
440
|
let mut var_id = to_rust_variant_identifier(&variant.name);
|
|
438
441
|
let mut counter = 1;
|
|
439
442
|
while seen_variants.contains(&var_id) {
|
|
@@ -448,6 +451,9 @@ impl RustCodegen {
|
|
|
448
451
|
if self.options.derive_serde {
|
|
449
452
|
let _ = writeln!(out, " #[serde(rename = \"{}\")]", variant.value);
|
|
450
453
|
}
|
|
454
|
+
if self.options.derive_default && idx == 0 {
|
|
455
|
+
let _ = writeln!(out, " #[default]");
|
|
456
|
+
}
|
|
451
457
|
let _ = writeln!(out, " {},", var_id);
|
|
452
458
|
variant_map.push((var_id, variant.value.clone()));
|
|
453
459
|
}
|
|
@@ -471,7 +477,7 @@ impl RustCodegen {
|
|
|
471
477
|
// std::str::FromStr
|
|
472
478
|
let _ = writeln!(out, "impl std::str::FromStr for {} {{", enum_name);
|
|
473
479
|
out.push_str(" type Err = String;\n\n");
|
|
474
|
-
out.push_str(" fn from_str(s: &str) -> Result<Self, Self::Err> {\n");
|
|
480
|
+
out.push_str(" fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {\n");
|
|
475
481
|
out.push_str(" match s {\n");
|
|
476
482
|
for (var_id, val) in &variant_map {
|
|
477
483
|
let _ = writeln!(out, " \"{}\" => Ok(Self::{}),", val, var_id);
|
|
@@ -837,6 +843,18 @@ impl RustCodegen {
|
|
|
837
843
|
| PrimitiveType::Entities
|
|
838
844
|
| PrimitiveType::AnyUri
|
|
839
845
|
| PrimitiveType::QName
|
|
846
|
+
| PrimitiveType::DateTime
|
|
847
|
+
| PrimitiveType::Date
|
|
848
|
+
| PrimitiveType::Time
|
|
849
|
+
| PrimitiveType::Duration
|
|
850
|
+
| PrimitiveType::GYear
|
|
851
|
+
| PrimitiveType::GYearMonth
|
|
852
|
+
| PrimitiveType::GMonth
|
|
853
|
+
| PrimitiveType::GMonthDay
|
|
854
|
+
| PrimitiveType::GDay
|
|
855
|
+
| PrimitiveType::Base64Binary
|
|
856
|
+
| PrimitiveType::HexBinary
|
|
857
|
+
| PrimitiveType::AnySimpleType
|
|
840
858
|
),
|
|
841
859
|
TypeRef::Named(qname) => {
|
|
842
860
|
if let Some(TypeDef::Simple(s)) = ir.types.get(qname) {
|
|
@@ -1028,7 +1046,6 @@ impl RustCodegen {
|
|
|
1028
1046
|
}
|
|
1029
1047
|
out.push_str(" _ => {}\n");
|
|
1030
1048
|
out.push_str(" }\n");
|
|
1031
|
-
out.push_str(" }\n");
|
|
1032
1049
|
}
|
|
1033
1050
|
|
|
1034
1051
|
let elem_fields: Vec<_> = field_metas
|
|
@@ -1175,7 +1192,7 @@ impl RustCodegen {
|
|
|
1175
1192
|
if !attr_fields.is_empty() {
|
|
1176
1193
|
out.push_str("\n for attr in start.attributes() {\n");
|
|
1177
1194
|
out.push_str(" let attr = attr?;\n");
|
|
1178
|
-
out.push_str(" match attr.key.local_name().as_ref() {\n");
|
|
1195
|
+
out.push_str(" match std::str::from_utf8(attr.key.local_name().as_ref()).unwrap_or(\"\") {\n");
|
|
1179
1196
|
for meta in &attr_fields {
|
|
1180
1197
|
let _ = writeln!(out, " \"{}\" => {{", meta.field.xml_name);
|
|
1181
1198
|
self.emit_attr_parse(out, &meta.field, &meta.rust_name, ir);
|
|
@@ -1217,6 +1234,12 @@ impl RustCodegen {
|
|
|
1217
1234
|
meta.rust_name, meta.rust_name
|
|
1218
1235
|
);
|
|
1219
1236
|
}
|
|
1237
|
+
} else if self.options.derive_default {
|
|
1238
|
+
let _ = writeln!(
|
|
1239
|
+
out,
|
|
1240
|
+
" {}: var_{}.unwrap_or_default(),",
|
|
1241
|
+
meta.rust_name, meta.rust_name
|
|
1242
|
+
);
|
|
1220
1243
|
} else {
|
|
1221
1244
|
let _ = writeln!(
|
|
1222
1245
|
out,
|
|
@@ -246,6 +246,29 @@ impl TypeScriptCodegen {
|
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
+
for f in &s.fields {
|
|
250
|
+
if !f.is_cycle_cut {
|
|
251
|
+
match &f.type_ref {
|
|
252
|
+
TypeRef::Named(target_qname) => {
|
|
253
|
+
if target_qname != &s.qname {
|
|
254
|
+
if let Some(TypeDef::Struct(dep_struct)) = ir.types.get(target_qname) {
|
|
255
|
+
visit(dep_struct, ir, visiting, visited, ordered);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
TypeRef::List(inner) | TypeRef::Boxed(inner) => {
|
|
260
|
+
if let TypeRef::Named(target_qname) = inner.as_ref() {
|
|
261
|
+
if target_qname != &s.qname {
|
|
262
|
+
if let Some(TypeDef::Struct(dep_struct)) = ir.types.get(target_qname) {
|
|
263
|
+
visit(dep_struct, ir, visiting, visited, ordered);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
_ => {}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
249
272
|
visiting.remove(&s.qname);
|
|
250
273
|
visited.insert(s.qname.clone());
|
|
251
274
|
ordered.push(ir.types.get(&s.qname).unwrap());
|
|
@@ -11,6 +11,14 @@ use polyxml::ir::{
|
|
|
11
11
|
};
|
|
12
12
|
use tempfile::tempdir;
|
|
13
13
|
|
|
14
|
+
fn dotnet_command() -> Command {
|
|
15
|
+
let mut cmd = Command::new("dotnet");
|
|
16
|
+
cmd.env("DOTNET_NOLOGO", "1");
|
|
17
|
+
cmd.env("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
|
|
18
|
+
cmd.env("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", "1");
|
|
19
|
+
cmd
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
#[test]
|
|
15
23
|
fn test_csharp_sanitization() {
|
|
16
24
|
assert_eq!(to_csharp_type_name("event"), "Event");
|
|
@@ -308,7 +316,7 @@ public class Program
|
|
|
308
316
|
)
|
|
309
317
|
.unwrap();
|
|
310
318
|
|
|
311
|
-
let build_status =
|
|
319
|
+
let build_status = dotnet_command()
|
|
312
320
|
.args(["build", "--warnaserror"])
|
|
313
321
|
.current_dir(temp.path())
|
|
314
322
|
.status()
|
|
@@ -318,7 +326,7 @@ public class Program
|
|
|
318
326
|
"dotnet build failed on generated records"
|
|
319
327
|
);
|
|
320
328
|
|
|
321
|
-
let run_status =
|
|
329
|
+
let run_status = dotnet_command()
|
|
322
330
|
.args(["run"])
|
|
323
331
|
.current_dir(temp.path())
|
|
324
332
|
.status()
|
|
@@ -487,7 +495,7 @@ public class Program
|
|
|
487
495
|
)
|
|
488
496
|
.unwrap();
|
|
489
497
|
|
|
490
|
-
let build_status =
|
|
498
|
+
let build_status = dotnet_command()
|
|
491
499
|
.args(["build", "--warnaserror"])
|
|
492
500
|
.current_dir(temp.path())
|
|
493
501
|
.status()
|
|
@@ -497,7 +505,7 @@ public class Program
|
|
|
497
505
|
"dotnet build failed on choice models"
|
|
498
506
|
);
|
|
499
507
|
|
|
500
|
-
let run_status =
|
|
508
|
+
let run_status = dotnet_command()
|
|
501
509
|
.args(["run"])
|
|
502
510
|
.current_dir(temp.path())
|
|
503
511
|
.status()
|
|
@@ -628,7 +636,7 @@ public class Program
|
|
|
628
636
|
)
|
|
629
637
|
.unwrap();
|
|
630
638
|
|
|
631
|
-
let build_status =
|
|
639
|
+
let build_status = dotnet_command()
|
|
632
640
|
.args(["build", "--warnaserror"])
|
|
633
641
|
.current_dir(temp.path())
|
|
634
642
|
.status()
|
|
@@ -638,7 +646,7 @@ public class Program
|
|
|
638
646
|
"dotnet build failed on recursive tree models"
|
|
639
647
|
);
|
|
640
648
|
|
|
641
|
-
let run_status =
|
|
649
|
+
let run_status = dotnet_command()
|
|
642
650
|
.args(["run"])
|
|
643
651
|
.current_dir(temp.path())
|
|
644
652
|
.status()
|
|
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
|