Closed ldacol closed 2 years ago
Resolved in YDK-0.8.6.3; see this commit for details.
Test script:
import unittest
import logging
from test_utils import enable_logging
from ydk.providers import CodecServiceProvider
from ydk.services import CodecService
from ydk.models.ydktest import ydktest_sanity as ysanity
class SanityTest(unittest.TestCase):
def setUp(self):
self.codec_service = CodecService()
self.json_provider = CodecServiceProvider(type='json')
enable_logging(logging.DEBUG)
def test_json_empty_string(self):
r = ysanity.Runner()
r.ytypes.built_in_t.name = ""
payload = self.codec_service.encode(self.json_provider, r)
expected = '''{
"ydktest-sanity:runner": {
"ytypes": {
"built-in-t": {
"name": ""
}
}
}
}
'''
self.assertEqual(expected, payload)
entity = self.codec_service.decode(self.json_provider, payload)
self.assertEqual(r, entity)
if __name__ == '__main__':
suite = unittest.TestSuite()
testloader = unittest.TestLoader()
testnames = testloader.getTestCaseNames(SanityTest)
for name in testnames:
suite.addTest(SanityTest(name))
ret = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful()
Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.
Expected Behavior
Conversion from JSON to XML finalizes successfully
Current Behavior
An IndexError: basic_string::at is returned when attempting a conversion from JSON to XML with payload choice-value:"" The payload is correctly converted from XML to JSON to fail when converted back to XML.
Steps to Reproduce
Issue is shown when attempting to convert the following JSON payload
Your Script
Logs
Enable logging and post the logs below
System Information
Red Hat Enterprise Linux Server release 7.9 (Maipo) Python 3.6.9