Question
· Dec 17, 2023

Error While Extending %JSON.Adaptor in xData MimeType of application/json

Hello Community,

I've extended the a class %JSON.Adaptor in my class definition and it contains the xData block MimeType of application/json. I got the error while compiling. Why this error occurs and how to resolve it

Product version: IRIS 2023.2
$ZV: RIS for Windows (x86-64) 2023.2
Discussion (8)4
Log in or sign up to continue

Yeah, it has happened to me too, it seems WRC is not interested in fixing/reporting bugs when any sort of workaround is possible/available, like using a different class in this case.

The community is frequented by InterSystems product managers, developers, sales engineers and many other InterSystems people, maybe out of compassion will report it and will get it fixed, so maybe in IRIS 2026 we will see it fixed! 😂

Fixing this does not seems to be difficult, it's just  matter of filtering/checking the XData block  before (blindly) using it as JSON map.

I'm not holding my breath....

It is strange that the bug has not been fixed yet, because it is easy to fix it by adding one line to ##class(%JSON.Generator).GenerateMappingFromXdata():

<..>
For i=1:1:count {
  Set xdata=compiledclass.XDatas.GetAt(i)
  Set configName=xdata.Name
  If configName="" Continue ; since the Name field is required, how can it be empty?
  If xdata.MimeType'="text/xml" Continue
<..>

PS: by the way, I didn't quite understand why need to check "configName", given that "Name" is a required field. Any ideas?