Hi Jasdip,
Il 12/06/2023 22:24, Jasdip Singh ha scritto:
Hello Mario,
After reviewing the PatchObject data type [1] in JSContact, one question: How
would the JSON serialization/deserialization work for a JSONPointer as a key
(read: member name) in a PatchObject, given a programming language like Java
does not allow a forward slash ( '/' ) in a variable name, AFAIK?
It depends on how you deserialize the JSON content. A suggestion about
how to implement the PatchObject in Java can be derived from its
definition in JSContact:
A PatchObject is of type String[*], and represents an unordered set
of patches on a JSON object. Each key is a path represented in a
subset of JSON pointer format [RFC6901].
Terms such as "unordered se" and "key" may suggest that the use of a
Java Map can be the way to go to implemet PatchObject. After all, since
you can localize every JSContact value no matter if its type is
primitive, an object or an array and if the property to localize is a
standard property or an extension, it would be inefficient to
deserialize a PatchObject in an object whose members are fixed in adavance.
In jscontact-tools, the "localizations" property is defined as in the
following:
Map<String,Map<String,JsonNode>> localizations;
where JsonNode is the base class for all JSON nodes in jackson library.
Serialization/deserialization takes place straightforwardly without
customizations.
FYI, you can find some examples of localizations handling by
jscontact-tools at
https://github.com/consiglionazionaledellericerche/jscontact-tools/blob/master/src/test/java/it/cnr/iit/jscontact/tools/test/localizations/LocalizationsTest.java
.
Hope it could be helpful.
Yesterday I talked with Robert Stepanek and we agreed the PatchObject is
more difficult to formally describe than to implement ;-)
Best,
Mario
Jasdip
[1]https://www.ietf.org/archive/id/draft-ietf-calext-jscontact-11.html#name-patchobject
On 6/9/23, 11:41 AM, "Andrew Newton" <a...@hxr.us <mailto:a...@hxr.us>> wrote:
...
TBH, it was the JSContact patchobject that made me re-examine this
space. I don't know the requirements for CalExt, but the necessity to
implement a JSON patching framework to parse postal addresses seems to
me to be beyond what is reasonable for RDAP. James has also pointed
out several times that the JSContact UID may not be a good fit for
RDAP.
...
--
Dott. Mario Loffredo
Technological Unit “Digital Innovation”
Institute of Informatics and Telematics (IIT)
National Research Council (CNR)
via G. Moruzzi 1, I-56124 PISA, Italy
Phone: +39.0503153497
Web:http://www.iit.cnr.it/mario.loffredo
_______________________________________________
regext mailing list
regext@ietf.org
https://www.ietf.org/mailman/listinfo/regext