(johnzon) branch master updated (b377d513 -> 93430a24)
This is an automated email from the ASF dual-hosted git repository. jlmonteiro pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git from b377d513 Merge pull request #119 from jungm/versionbump-tck-modules add a5a0e4df Update specs referenced in site add 0e0a5953 Fix site generation add 1942fc82 Fix links in User Guide menu add 84a3476f Update/fix download links add 6f8e06a0 Update documentation - Removal of johnzon-jsonp-strict - Properties added to jsonb for BigInteger/BigDecimal mapping add a913a27f typo add 972c0e20 Johnzon 2.0.0 download links, replace binary links with maven central add e0245e37 proper mvn central url add 6d11a83f Add note that parsson is a hardcoded default in json-p api jar new 93430a24 Merge pull request #113 from jungm/site-updates The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: pom.xml | 2 +- src/site/markdown/download.md | 53 +-- src/site/markdown/index.md| 19 +++- src/site/site.xml | 4 ++-- 4 files changed, 52 insertions(+), 26 deletions(-)
(johnzon) branch master updated (904c0810 -> f775f710)
This is an automated email from the ASF dual-hosted git repository. jlmonteiro pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git from 904c0810 [JOHNZON-401] fix serialization of nested polymorphic objects add ef966dc9 [JOHNZON-402] Reworked scanning for @JsonbTypeInfo annotations new f775f710 Merge pull request #120 from jungm/402-jsonbtypeinfoscanning-rework The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../org/apache/johnzon/jsonb/JsonbMappings.java| 1 - .../polymorphism/JsonbPolymorphismHandler.java | 157 - .../polymorphism/JsonbPolymorphismTypeInfo.java| 38 - .../jsonb/polymorphism/JsonbPolymorphismTest.java | 13 ++ 4 files changed, 143 insertions(+), 66 deletions(-)
(johnzon) 01/01: Merge pull request #113 from jungm/site-updates
This is an automated email from the ASF dual-hosted git repository. jlmonteiro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git commit 93430a245401eb66ee808eae146c8d4dd5453f63 Merge: b377d513 6d11a83f Author: Jean-Louis Monteiro AuthorDate: Fri Feb 2 16:46:37 2024 +0100 Merge pull request #113 from jungm/site-updates Site updates pom.xml | 2 +- src/site/markdown/download.md | 53 +-- src/site/markdown/index.md| 19 +++- src/site/site.xml | 4 ++-- 4 files changed, 52 insertions(+), 26 deletions(-)
(johnzon) 01/01: Merge pull request #119 from jungm/versionbump-tck-modules
This is an automated email from the ASF dual-hosted git repository. jlmonteiro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git commit b377d51356f2eb3516fdcee8d91d00097d325675 Merge: f775f710 970b0176 Author: Jean-Louis Monteiro AuthorDate: Fri Feb 2 16:46:23 2024 +0100 Merge pull request #119 from jungm/versionbump-tck-modules Align version of TCK modules again tck/jsonb/pom.xml | 2 +- tck/jsonp/pom.xml | 2 +- tck/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
(johnzon) branch master updated (f775f710 -> b377d513)
This is an automated email from the ASF dual-hosted git repository. jlmonteiro pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git from f775f710 Merge pull request #120 from jungm/402-jsonbtypeinfoscanning-rework add 970b0176 Align version of TCK modules again new b377d513 Merge pull request #119 from jungm/versionbump-tck-modules The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: tck/jsonb/pom.xml | 2 +- tck/jsonp/pom.xml | 2 +- tck/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
(johnzon) 01/01: Merge pull request #120 from jungm/402-jsonbtypeinfoscanning-rework
This is an automated email from the ASF dual-hosted git repository. jlmonteiro pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git commit f775f710e4d6c37dd4ad1e4d944765366bdf99ad Merge: 904c0810 ef966dc9 Author: Jean-Louis Monteiro AuthorDate: Fri Feb 2 16:46:08 2024 +0100 Merge pull request #120 from jungm/402-jsonbtypeinfoscanning-rework [JOHNZON-402] Reworked scanning for @JsonbTypeInfo annotations .../org/apache/johnzon/jsonb/JsonbMappings.java| 1 - .../polymorphism/JsonbPolymorphismHandler.java | 157 - .../polymorphism/JsonbPolymorphismTypeInfo.java| 38 - .../jsonb/polymorphism/JsonbPolymorphismTest.java | 13 ++ 4 files changed, 143 insertions(+), 66 deletions(-)
(johnzon) branch master updated: [JOHNZON-401] fix serialization of nested polymorphic objects
This is an automated email from the ASF dual-hosted git repository. rmannibucau pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/johnzon.git The following commit(s) were added to refs/heads/master by this push: new 904c0810 [JOHNZON-401] fix serialization of nested polymorphic objects 904c0810 is described below commit 904c08102d82e4fb5ca443e13d3a9251787f4899 Author: Markus Jung AuthorDate: Fri Jan 26 08:15:49 2024 +0100 [JOHNZON-401] fix serialization of nested polymorphic objects --- .../johnzon/jsonb/polymorphism/JsonbPolymorphismTest.java | 15 +++ .../org/apache/johnzon/mapper/MappingGeneratorImpl.java | 12 ++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/polymorphism/JsonbPolymorphismTest.java b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/polymorphism/JsonbPolymorphismTest.java index 87d83899..52351430 100644 --- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/polymorphism/JsonbPolymorphismTest.java +++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/polymorphism/JsonbPolymorphismTest.java @@ -41,6 +41,17 @@ public class JsonbPolymorphismTest { @Rule public JsonbRule jsonb = new JsonbRule(); +@Test +public void testNestedSerialization() { +Labrador labrador = new Labrador(); +labrador.dogAge = 3; +labrador.labradorName = "john"; +AnimalWrapper wrapper = new AnimalWrapper(); +wrapper.animal = labrador; + + assertEquals("{\"animal\":{\"@animal\":\"dog\",\"@dog\":\"labrador\",\"dogAge\":3,\"labradorName\":\"john\"}}", jsonb.toJson(wrapper)); +} + @Test public void testSerialization() { Labrador labrador = new Labrador(); @@ -100,6 +111,10 @@ public class JsonbPolymorphismTest { } +public static class AnimalWrapper { +public Animal animal; +} + @JsonbTypeInfo(key = "@animal", value = @JsonbSubtype(alias = "dog", type = Dog.class)) public interface Animal { } diff --git a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingGeneratorImpl.java b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingGeneratorImpl.java index cf44c5c7..c06f38df 100644 --- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingGeneratorImpl.java +++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MappingGeneratorImpl.java @@ -192,12 +192,6 @@ public class MappingGeneratorImpl implements MappingGenerator { generator.writeStartObject(); } -if (classMapping.serializedPolymorphicProperties != null) { -for (Map.Entry polymorphicProperty : classMapping.serializedPolymorphicProperties) { -generator.write(polymorphicProperty.getKey(), polymorphicProperty.getValue()); -} -} - final boolean writeEnd = doWriteObjectBody(object, ignoredProperties, jsonPointer, generator); if (writeEnd && writeBody) { generator.writeEnd(); @@ -376,6 +370,12 @@ public class MappingGeneratorImpl implements MappingGenerator { return true; } +if (classMapping.serializedPolymorphicProperties != null) { +for (Map.Entry polymorphicProperty : classMapping.serializedPolymorphicProperties) { +generator.write(polymorphicProperty.getKey(), polymorphicProperty.getValue()); +} +} + for (final Map.Entry getterEntry : classMapping.getters.entrySet()) { final Mappings.Getter getter = getterEntry.getValue(); if (ignored != null && ignored.contains(getterEntry.getKey())) {