Rework YangInstanceIdentifier/URI path conversion 73/111073/24
authorlubos-cicut <lubos.cicut@pantheon.tech>
Tue, 26 Mar 2024 14:27:41 +0000 (15:27 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 3 Apr 2024 11:37:35 +0000 (13:37 +0200)
commitb14e3fb6a934e373c2f88d9d58c6585acddb81f5
treeb716c252b236489229f1ee55abb31b69396c6a3a
parent7096cd4cfb030f48fa7e43171718e7f49664e800
Rework YangInstanceIdentifier/URI path conversion

YangInstanceIdentifierSerializer has a rather ambiguous name and
description, but essentially it does what it advertizes: it takes a
YangInstanceIdentifier and creates a String corresponding to
ApiPath.parse().

Unfortunately this process handles values through String.valueOf(),
which obviously does the wrong thing for non-trivial values, such as
identityref and instance-identifier.

We already have a component handling ApiPath -> YangInstanceIdentifier
conversion, the ApiPathNormalizer.

This patch completely replaces
YangInstanceIdentifierSerializer.serializePath() with
ApiPathNormalizer.canonicalize(). It essentially does the same thing,
but returns an ApiPath as the result. Users can use ApiPath.toString()
to then get the String representation, if needed.

JIRA: NETCONF-1264
Change-Id: I1093eb2cbd84ae269430f918e48b98cc2fb4e805
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/transactions/RestconfStrategy.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierSerializer.java [deleted file]
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/PatchBody.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/mdsal/streams/devnotif/SubscribeDeviceNotificationRpc.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/mdsal/streams/dtcl/CreateDataChangeEventSubscriptionRpc.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/spi/ApiPathNormalizer.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/spi/HackJsonWriter.java [new file with mode: 0644]
restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/YangInstanceIdentifierSerializerTest.java
restconf/restconf-nb/src/test/resources/restconf/parser/serializer/serializer-test-included.yang
restconf/restconf-nb/src/test/resources/restconf/parser/serializer/serializer-test.yang