Is it implemented yet? Found the need for it too :)
- Log in to post comments
Is it implemented yet? Found the need for it too :)
Yes! That'd be ideal!
Great article, @Timothy Leavitt ! I think it is questionable the recommendation not to use AI for the spheres you are not familiar with.
E.g. I'm not a frontend developer at all but the AI capabilities in AI generation are awesome and give me an opportunity to immediately have an MVP in frontend and also to build prototypes fast which was impossible in a preAI times.
also, thanks to @Semion Makarov swagger ui app is updated to support Swagger 3.1 version. and functionality is improved greatly! 
Great article! Thank you @Pablo Frigolett !
Also, if you develop in Docker there is an issue with server name, and my version of the same GetSpec method is:
ClassMethod GetSpec() As%DynamicObject
{
Set spec = {}.%FromJSON(##class(%Dictionary.CompiledXData).%OpenId("dc.Sample.v2rest.spec||OpenAPI").Data)
Set url = $Select(%request.Secure:"https",1:"http") _ "://"_$Get(%request.CgiEnvs("SERVER_NAME")) _ ":" _ $Get(%request.CgiEnvs("SERVER_PORT")) _ %request.ApplicationSet spec.servers = [{"url" : (url)}]
Quit spec
}Thanks to @Lorenzo Scalese !
@Mario Sanchez Macias concluded the final most optimal option here.
It can convert from %DynamicObject but not into. Unfortunately.
How can we improve it - is to publish more "good" ObjectScript to Github and other open-source repositories and share best practices here :)
Hi @Anna Golitsyna ! I appreciate you watched the video. Indeed it (AI Copilot) is not that bad sometimes especially in simple cases and sometimes can even surprise like "reading thoughts" what to put next so VSCode+Copilot could be more effective in coding ObjectScript vs just Studio and occasional copy-paste from ChatGPT.
But I agree with @Dmitry Maslennikov that the very fact that AI can "talk" ObjectScript/Mumps is mostly because of Open Exchange initiative and its impact on Github.com, where ObjectScript is listed as a recognizable language (thanks again to @Dmitry Maslennikov to his impact to it about 10 years ago).
Yes. But you cannot return String in this method - either dynamic object, or Stream object.
BTW, I’d even expect this functionality over %JSON.Adapter, as there is an option to import (construct) persistent from dynamic in it:
Set person=##class(dc.Sample.Person).%New()
do person.%JSONImport(dynamicPerson)
But person.%JSONExport() does JSON string into device. Would be wonderful to have:
D person.%JSONExport(.dynobj)
Thank you so much, @Laura Blázquez García ! This is a great catch!
This does the job! The only concern is that I'd love to see something like:
set dynObj=$System.JSON.Persistent2Dynamic(person)
Especially since VSCode highlights %Zen as a deprecated package. (Are there any plans? calling @Timothy Leavitt )
Wow, @Robert Cemper ! Thank you as usual!
But 3 lines. Could it be a one command by any chance? :)
I compete with the following:
/// Get JSON for a person with a given idClassMethod personsidGET(messageRequest As dc.Sample.v3rest.requests.personsidGET) As%Status
{
Set person = ##class(dc.Sample.Person).%OpenId(messageRequest.pathid)
set stream=##class(%Stream.TmpCharacter).%New()
d person.%JSONExportToStream(.stream)
return stream
}This works, but with an unnecessary "to stream, out of stream" exercise IMHO.
Looks very promising, but doesn't work for me:
USER>set dynObj = {}.%FromJSON(person.%ToJSON())
SET dynObj = {}.%FromJSON(person.%ToJSON())
^
<METHOD DOES NOT EXIST> *%ToJSON,dc.Sample.Person
USER>
Thanks, Brett! They are not ideal as we can see :) Me too ;)
%Zen is deprecated in 2025.1. but this method is still useful:
set dynObj = ##class(%ZEN.Auxiliary.altJSONProvider).%ObjectToAET(obj)Are there any similar or "system" methods now to convert persistent instances into a dynamic object?
Thanks for the clarification, @John Murray ! That's helpful! From a UX standpoint, I'd prefer one menu that "goes to the origin" for both cases, so I don't do calc everytime 'if it is a method, then definition if a variable, then declaration'.
Too complex?
The example is in your article:
Class petstoreserver.impl Extends%REST.Impl [ ProcedureBlock ] { Parameter ExposeServerExceptions = 1; /// Service implemntation for post /pet ClassMethod addPet(messageRequest As petstoreserver.requests.addPet) As%Status
{ ; Implement your service here. ; Return {} $$$ThrowStatus($$$ERROR($$$NotImplemented))
} ... }The declaration returns %Status.
The generated stub suggests return {} meaning the method should return json (which is true)
and below it throws status.
I think nothing can be fixed here :) Do we have any datatype to provide meaning that we expect the method to return JSON? %JSON? ))
But this discrepancy is quite confusing when you look at it for the first time.
I managed to get it work.
What was confusing is that REST methods return %Status in a declaration but in fact are expected to return JSON objects
HI @Lorenzo Scalese !
Do you have any examples of implementation classes with your suite?
I managed to generate classes vs openapi v 3.0 but cannot receive any data from implementation methods: either errors or empty results. Not sure what am I doing wrong.
Thank you @Enrico Parisi , this is helpful!
Very useful command, thank you @Vitaliy Serdtsev
BTW, there is another very interesting tool to help in building AI agents - MCP protocol, introduced by Anthropic.
Here is the related video
Here is the related demo project on OEX.
Amazing contributions! Thanks to all the participants!
I see! Thank you, @Luis Angel Pérez Ramos
Hi @Bukhtiar Ahmad ! Both IRIS for Health and Health Connect are equally suitable for high-performance transaction volume use cases. It depends, of course, on the implementation and tasks, but this is not what differentiates these two products from each other.
@Luis Angel Pérez Ramos, great thing! For the sake of testing, could you please share the repo so I can try it locally? And bust the myth on my laptop? )
Thanks @Vitaliy Serdtsev ! Glad to see yet another solution to this question!
Thank you, @Enrico Parisi!
The only thing I have a concern about here is "what is Ensemble,"? and why not Include IRIS? :)
But it is not a question to you of course.
The parameter: set configData.MaxSearchResults = 10000
And an example of how this could be set up.