Commit Graph

202 Commits

Author SHA1 Message Date
Ephraim Kunz
4b27b04ba4 Allow adding the 'text' attribute to Option<String> 2021-04-29 20:40:34 -07:00
olvyko
0139d63f6d Alter yaserde_derive crate to support skip_serialize_if for attributes 2021-04-29 21:39:47 +06:00
Roman Valls Guimera
9bbb1a6cc9 XML prettyprint documentation 2021-02-11 19:50:56 +11:00
Marc-Antoine Arnaud
082cc0d953 bump to 0.6.0 2021-02-08 14:39:49 +01:00
Marc-Antoine ARNAUD
44854b0d4d
Merge pull request #105 from ephraimkunz/serialize-conflict
Use fully qualified method names to prevent collisions with serde derive macros
2021-02-08 11:37:25 +01:00
Ephraim Kunz
269975d953 Use fully qualified method names to prevent collisions with serde derive macros 2021-02-05 19:26:54 -08:00
Ephraim Kunz
07c2106256 Add unit test for attribute filtering 2021-02-04 20:02:39 -08:00
Ephraim Kunz
7d2658adaf Add filter to only look at 'yaserde' attributes 2021-02-04 19:45:34 -08:00
Marc-Antoine Arnaud
fcab1c0245 bump to 0.5.1 2021-01-08 10:10:02 +01:00
Marc-Antoine Arnaud
2926e0b620 bump to 0.5.0 2021-01-08 10:05:50 +01:00
Jonas Platte
a1fc2f9fad
Revert parts of "Use absolute paths in generated code"
to restore compatibility with older versions of Rust.
2020-12-17 18:32:06 +01:00
Jonas Platte
c455f12d23
Drop unnecessary qualification of String outside of generated code 2020-12-17 17:50:16 +01:00
Jonas Platte
d3ee4112e3
Clean up visitor code generation 2020-12-17 17:50:16 +01:00
Jonas Platte
12ddcdbc87
Use absolute paths in generated code
With this, the derives should work with most of the crates and types
the generated code refers to being aliased.

Notably, methods are still mostly invoked using regular method syntax
so those coming from trait could still be aliased by outside code.
2020-12-17 17:50:16 +01:00
Jonas Platte
52fb60ec8b
Remove most extern crate statements from yaserde_derive
yaserde_derive is an edition 2018 crate, so these are not necessary.
2020-12-17 17:48:26 +01:00
Jonas Platte
c98845fc42
Remove redundant lib name from yaserde_derive/Cargo.toml 2020-12-02 15:48:10 +01:00
marcelbuesing
798455faa8
Avoid breaking keywords in labels.
Keywords such as `ref` previously lead to labels such as `__#ref__value`.
This should be `__ref__value`.
2020-10-07 10:13:52 +02:00
Marc-Antoine Arnaud
6e2930e2df bump to 0.4.3 2020-08-26 23:33:12 +02:00
Marc-Antoine Arnaud
fc5625a5e4 parse bool as defined in xs:boolean 2020-08-26 23:32:24 +02:00
Marc-Antoine Arnaud
dc558a73e4 publish 0.4.2 2020-08-05 10:56:35 +02:00
Marc-Antoine ARNAUD
c25d8d420f
Merge pull request #88 from marcelbuesing/master
Enforce std String in macros to avoid collisions
2020-08-05 10:38:16 +02:00
marcelbuesing
701b92a2a4
Enforce std String in macros to avoid collisions 2020-08-03 20:28:53 +02:00
Horaci Macias
c2d9a9fb64 Before formatting 2020-07-21 09:36:55 +02:00
Horaci Macias
c76ad9fe59 Working on flatten 2020-07-21 09:11:59 +02:00
Horaci Macias
b1d11f4e3a Trying to address https://github.com/media-io/yaserde/issues/63 2020-07-20 17:16:00 +02:00
Scott Lamb
8a1e1e2e16 minor cleanup of element skipping
* "skipped" is unnecessary: it's always false at depth == 0,
  so its one use in "if depth == 0 && !skipped" can be removed.
* the element doesn't need a binding, and shadowing "named_element"
  confused me.
* remove old commented-out path that errored on unknown elements
2020-06-20 06:27:19 -07:00
Scott Lamb
c889461eef improve logging in deserialize path and tests
* Log the depth of elements as they're fetched
* Log the starting depth of structs/enums and their Rust symbol names
  (not just XML element names, which may differ significantly)
* Log every element in the struct/enum match loop at trace level.
* Log file/line numbers at a few key points in the tests.
  This is helpful in finding failures happen in some of the longer
  tests.

This logging helps me understand the data flow as I play with changes
for #76.
2020-06-20 06:27:19 -07:00
Marc-Antoine Arnaud
4976fc3aa0 bump to 0.4.1 2020-06-08 10:45:58 +02:00
Marc-Antoine Arnaud
ad167a74a7 use unwrap_or_default 2020-06-08 10:45:18 +02:00
Marc-Antoine Arnaud
ae8021f79a remove lifetime parameter on serializer 2020-06-08 10:28:36 +02:00
Marc-Antoine Arnaud
427d623c1f bump to 0.4.0 2020-06-08 09:30:08 +02:00
Marc-Antoine Arnaud
7569408245 support flatten attributes 2020-06-07 15:16:46 +02:00
Aaron Hill
6732d8b38a
Handle nested syn::Type:::Group
Currently, rustc does not pass the exact original TokenStream to
proc-macros in several cases. This has many undesirable effects, such as
losing correct location information in error message.
See rust-lang/rust#43081 for more details

In the future, rustc will begin passing the correct TokenStream to
proc-macros. As a result, `syn` may wrap a type in one or more
`syn::Type::Group`s (if the proc-macro input came from a `macro_rules!` expansion).

I've determined that this can cause `yaserde-derive` to fail to match
a `Type::Path`. This PR should properly handle nested groups, allowing
your crate to work with both old and new input.

If you have any questions, feel free to ask me. See rust-lang/rust#72622
for more details.
2020-05-31 00:00:06 -04:00
Marc-Antoine Arnaud
10f2be69be format code 2020-05-20 17:38:31 +02:00
Marc-Antoine Arnaud
0d2058ddb4 use heck to force camel case format on Visitor ident
issue #77
2020-05-20 16:58:55 +02:00
Marc-Antoine Arnaud
751f4715a8 bump to 0.3.17 2020-05-08 15:04:51 +02:00
Marc-Antoine Arnaud
f3c42a4d9e improve library 2020-05-08 14:42:43 +02:00
Marc-Antoine Arnaud
2726de5c56 bump to 0.3.16 2020-04-29 20:03:37 +02:00
Marc-Antoine Arnaud
dfaa69071d fix namespace check on deserilization of enum 2020-04-29 19:13:32 +02:00
Marc-Antoine Arnaud
e2a2779f71 format code 2020-04-22 19:05:13 +02:00
Marc-Antoine Arnaud
975baabd76 remove root attribute, use rename 2020-04-22 19:04:43 +02:00
Marc-Antoine Arnaud
0872461c41 continue to refactor code using common Field structure 2020-04-22 18:18:11 +02:00
Marc-Antoine Arnaud
f69d5e75b3 implement common default skip content serializer 2020-04-21 18:01:03 +02:00
Marc-Antoine Arnaud
04ddaa29dc restructure code 2020-04-21 15:02:34 +02:00
Marc-Antoine Arnaud
1c9ee67ace reformat more code 2020-04-19 16:34:39 +02:00
Marc-Antoine Arnaud
fbc329e2be reorgonize some code 2020-04-19 16:23:11 +02:00
Marc-Antoine Arnaud
856e271f7f support root flatten deserialization 2020-04-19 10:57:40 +02:00
Marc-Antoine Arnaud
7b53515736 add flatten support for root elements (Enum and Structs) 2020-04-19 10:00:06 +02:00
Marc-Antoine Arnaud
38e5d32b7e bump to 0.3.15 2020-04-06 19:34:18 +02:00
Marc-Antoine Arnaud
da353bdd4f serialize more types, add related unit tests 2020-04-06 16:19:50 +02:00
Marc-Antoine Arnaud
2c632fe0ee Merge branch 'master' of github.com:media-io/yaserde into fix_default_namespace_prefix 2020-04-06 14:42:33 +02:00
Marc-Antoine Arnaud
a93d70831f use rust 2018 syntax, remove unused headers 2020-04-06 14:04:12 +02:00
Dmitry Samoylov
39185ffd03 Fix issue #51 2020-04-06 18:55:59 +07:00
Dmitry Samoylov
d262bc998f Refactor reader 2020-04-06 18:12:17 +07:00
Marc-Antoine Arnaud
7de831f27c format code 2020-04-06 12:16:55 +02:00
Marc-Antoine Arnaud
515cec5ba7 remove prefix for default namespace 2020-04-06 12:12:54 +02:00
Dgame
c05e822865 Added explicit use log::debug 2020-03-29 20:36:30 +02:00
Marc-Antoine Arnaud
aa2442f2d4 bumpt to 0.3.14 2020-03-25 20:05:57 +01:00
Marc-Antoine ARNAUD
61f600926a
Merge pull request #57 from media-io/skip_serializing_if
bump to 0.3.13
2020-03-25 20:04:21 +01:00
Dmitry Samoylov
b3d9ea0744 Fix issue 12 for attributes 2020-03-24 17:39:33 +07:00
Marc-Antoine Arnaud
92cdc838e8 bump to 0.3.13 2020-02-25 15:34:44 +01:00
Marc-Antoine Arnaud
4e03b57723 start to support skip serializing if feature
issue #43
2020-02-25 13:35:13 +01:00
Marc-Antoine Arnaud
13d6db9280 add unit tests to parse attributes 2020-02-24 18:41:49 +01:00
Marc-Antoine Arnaud
dc79806128 add default_namespace attribute
issue #45
2020-02-24 14:47:18 +01:00
Dmitry Samoylov
4aadc78fc1 Fix (de)serialization for elements with nested namespaces 2020-02-18 15:56:09 +07:00
Marc-Antoine Arnaud
9272a5a684 bump to 0.3.12 2020-02-16 11:53:49 +01:00
Marc-Antoine ARNAUD
c15e289fec
Merge pull request #40 from DmitrySamoylov/refactoring
Refactoring
2020-02-16 11:25:25 +01:00
Dmitry Samoylov
1f3de44a98 Add skipping of unrecognized elements (fixes #12) 2020-02-13 19:34:47 +07:00
Dmitry Samoylov
476fd3790e Put struct and simple_type visitors close to each other 2020-02-12 19:38:02 +07:00
Dmitry Samoylov
20d7db6d73 Remove mem::transmute (closes #39) 2020-02-12 19:09:07 +07:00
Dmitry Samoylov
3e08dee3f4 Simplify de visitor generation 2020-02-12 18:37:42 +07:00
Dmitry Samoylov
cad7f88c4e Add support for Option<struct> in 'attribute' fields 2020-02-12 15:45:30 +07:00
Dmitry Samoylov
fd8257e047 Bump version to 0.3.11 2020-02-06 18:01:26 +07:00
Dmitry Samoylov
6063ff393a Implement flatten (ser) 2020-02-06 15:52:09 +07:00
Dmitry Samoylov
cc7cf76a45 Implement flatten (de) 2020-02-06 15:50:35 +07:00
Dmitry Samoylov
f9e8d91590 Use actual spans instead of Span::call_site() 2020-02-04 19:56:22 +07:00
Dmitry Samoylov
65838ced80 Reduce code duplication when handling simple types 2020-02-04 19:08:05 +07:00
Dmitry Samoylov
5a0f0e55a7 Remove unneeded Option's and unsafe's 2020-02-04 17:50:16 +07:00
Dmitry Samoylov
703a238d02 Simplify tokenstream folding 2020-02-04 17:47:14 +07:00
Dmitry Samoylov
688ab0b160 Fix compilation errors when element name contains dots 2020-02-04 15:18:09 +07:00
Dmitry Samoylov
f1c7818656 Fix unnamed enum variants serialized ignoring namespace prefix 2020-01-20 17:55:51 +07:00
Dmitry Samoylov
7d8923a785 Make custom serializer be called only once (#25) 2020-01-15 18:23:29 +07:00
Marc-Antoine Arnaud
1bdc7200ff bump to 0.3.10 2020-01-09 09:07:41 +01:00
superuzir
8079f00415 Fix more clippy warnings 2019-12-31 14:58:28 +07:00
superuzir
9bc1cfd5ea Fix clippy warning 2019-12-31 14:40:49 +07:00
Dmitry Samoylov
95f826b41f Add serialization for enums with unnamed fields (#8) 2019-12-30 22:38:45 +07:00
Dmitry Samoylov
d277d5137b Add deserialization for enums with values (#8) 2019-12-27 20:37:56 +07:00
Marc-Antoine Arnaud
a2bf70c5bd bump to 0.3.9 2019-12-15 12:44:20 +01:00
Dmitry Samoylov
85f461573b Allow struct fields be named as 'name' (issue #21) 2019-12-10 13:16:28 +07:00
Marc-Antoine Arnaud
9af780cb6b update dependencies 2019-12-05 09:15:31 +01:00
Dmitry Samoylov
5a81a5add8 Fix formatting 2019-12-05 14:29:20 +07:00
Dmitry Samoylov
ab03d32cfb Add support for field types with multiple PathSegment's 2019-12-04 20:52:21 +07:00
Marc-Antoine Arnaud
2b701262ac fix clippy feedbacks and format code 2019-10-08 10:19:50 +02:00
Marc-Antoine Arnaud
29e6736d8d format code 2019-10-08 09:04:29 +02:00
Marc-Antoine Arnaud
dd5ca6df6b update dependencies with 1.0 releases 2019-10-08 09:04:00 +02:00
Marc-Antoine Arnaud
54cf32c26d release v0.3.7 2019-01-12 11:57:16 +01:00
Marc-Antoine Arnaud
ae3f873d69 fix check namespace 2018-12-29 14:13:50 +01:00
Marc-Antoine Arnaud
7255e85925 improve error message for incorrect namespace item 2018-12-21 14:04:21 +01:00
Marc-Antoine Arnaud
381dd59ea0 bump to 0.3.6 2018-12-13 13:33:39 +01:00
Marc-Antoine Arnaud
28c13f5861 skip serialization if value equals to default 2018-12-07 10:21:59 +01:00