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
It seems you cannot use ax XData block of "MimeType = application/json" within a class that extends %JSON.Adaptor.
Put your XData block in a different class that does not extends %JSON.Adaptor.
This may be a bug, (it looks so to me), you may want to report it to WRC.
Enrico
I've reported this to WRC more then a year ago, They didn't seemed bothered.
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....
FWIW, I've nudged internally on the bug report for this and mentioned the post.
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():
PS: by the way, I didn't quite understand why need to check "configName", given that "Name" is a required field. Any ideas?
Maybe that's old code that's been carried over through some copying and pasting. I have a Cache 2012 instance and Name is not required in it.
Yes, most likely this is legacy code.
For some reason I thought that since the %JSON package classes appeared only in IRIS, the code would also have to be new.
PS: by the way, can you compile an XData block without a name? Studio doesn't highlight the error?
Thanks @Vitaliy Serdtsev
I'll try this!