検索

記事
· 2024年5月8日 4m read

Implemented Ideas: Wizard to generate ObjectScript from an OpenAPI

The OpenAPI Specification (OAS) defines a standard, language-agnostic interface to HTTP APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. While for SOAP based APIs there is a special wizard in InterSystems IRIS that cuts down orchestrations development time, not all APIs used in integrations are SOAP. That's why @Jaime Lerga suggested to add a wizard similar to the SOAP wizard to generate a REST client from OpenAPI specification. Implementation of this idea cuts down the development time of the REST API orchestrations with InterSystems IRIS. This idea is one of most popular ideas on the InterSystems ideas. This article, the third in the "Implemented Ideas" series, focuses on the OpenAPI Suite solution developed by @Lorenzo Scalese.
 

In short, OpenAPI-Suite is a set of tools (packages and libraries), to generate ObjectScript code from an OpenAPI specification version 3.0. These tools allow to:  

  • Generate server-side class.  
  • Generate HTTP client classes.
  • Generate client production (business services, business operation, business process, Ens.Request, Ens.Response) classes.
  • A web interface to generate and download the code or generate and compile directly on the server.
  • Convert specification from version 1.x, 2.x to version 3.0.

The scheme above provides the list of all packages developed in OpenAPI-Suite, and used libraries and web-services. Detailed description of each package and library, as well as other important details about solution are available in the series of articles written by the author of the implementation: OpenAPI Suite - Part 1 , OpenAPI Suite - Part 2

Special thanks to @Lorenzo Scalese for answering the questions about the implementation of this. Below is a short compilation based on his answers and articles dedicated to the OpenAPI-Suite application.

Scalese highlighted several reasons why he was intrigued by the implementation of this idea:

  • He often found himself repeating the same tasks when designing REST APIs, both on the server and client sides. It was both time-consuming and inefficient.
  • He noticed a gap in the field of API development - a lack of suitable tools for generating ObjectScript code from OpenAPI version 3 specifications.
  • It is an extremely stimulating and professionally enriching technical challenge to design a code generator to address this issue.

During the implementation, the developer was impressed mostly by the ease with which he was able to generate ObjectScript classes. The use of the %Dictionary API proved to be an extremely valuable resource, greatly simplifying the process. Additionally, he was struck by the variety of expressions the OAS 3 specification allowed to achieve the same result. Managing this variability and ensuring coverage of all possible cases was one of the main challenges Scalese encountered.

The OpenAPI-Suite developer would like to make significant improvements to the user interface of the solution. Currently, it is rather basic and lacks customization options. Many features are only available in terminal mode, so he plans to add more advanced customization functionalities. Additionally, @Lorenzo Scalese is motivated to develop a full-fledged front-end application to enhance the user experience. Sometimes he also wonders whether creating a Swagger plugin for ObjectScript might not have been a better option, allowing direct generation of code accessible via https://editor.swagger.io/. This could enable more seamless integration into existing developer workflows.

The OpenAPI-Suite solution aroused great interest from InterSystems Developer Community members. It was installed 135 times using IPM, has 4 reviews from developers and has 5 stars rating. @Theo Stolker says in his review that OpenAPI-suite is the best possible option when the developer's goal is to generate client code for an API published as OpenAPI specification.


Please share your feedback about the highlighted solution and idea in the comments.

Don’t forget to post your ideas, vote and comment on existing ideas, implement Community Opportunity ideas!

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
お知らせ
· 2024年5月8日

One-on-One Learning Opportunities at Global Summit

Personal training and learning plan consultations at Global Summit. Book your session today!  


At Global Summit 2024 in June, take advantage of two learning opportunities:

👩‍💻Talk one-on-one with a technical trainer to refresh your knowledge of a concept or learn about InterSystems technologies.

👨‍🎓 Meet with a learning plan consultant to discuss your training needs and see what resources are available.

Find details and sign-up information, and save your spot today!

ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
質問
· 2024年5月7日

docker run iris ,the container log always show Starting InterSystems IRIS instance IRIS... and can not open web page

here is the command I run 

 

docker pull containers.intersystems.com/intersystems/iris-community:2024.1

docker run --name iris -d --publish 1972:1972 --publish 52773:52773 91b900c4baf5

docker ps

CONTAINER ID   IMAGE                                        COMMAND                  CREATED          STATUS                      PORTS                                                                                                                      NAMES
9b92e6dabb2f   91b900c4baf5                                 "/tini -- /iris-main"    44 minutes ago   Up 44 minutes (unhealthy)   0.0.0.0:1972->1972/tcp, :::1972->1972/tcp, 2188/tcp, 53773/tcp, 0.0.0.0:52773->52773/tcp, :::52773->52773/tcp, 54773/tcp   iris
 

docker logs iris


[INFO] Executing command /home/irisowner/irissys/startISCAgent.sh 2188...
[INFO] Writing status to file: /home/irisowner/irissys/iscagent.status
Reading configuration from file: /home/irisowner/irissys/iscagent.conf
ISCAgent[17]: Starting
ISCAgent[19]: Starting ApplicationServer on *:2188
[INFO] ...executed command /home/irisowner/irissys/startISCAgent.sh 2188
[INFO] Starting InterSystems IRIS instance IRIS...
 

 

I have tried many versions, but these problems always occur. I cannot open the 52337 web page and cannot connect to the iris database. When I enter the container and run the following command

irisowner@9b92e6dabb2f:~/irissys$ iris terminal IRIS
Sign-on inhibited: Startup or Installation in progress
irisowner@9b92e6dabb2f:~/irissys$ iris start IRIS
IRIS is already up: Sign-on inhibited.
irisowner@9b92e6dabb2f:~/irissys$ iris restart IRIS
Sign-on inhibited. See messages.log for details.
irisowner@9b92e6dabb2f:~/irissys$ cd irisdb
bash: cd: irisdb: Not a directory
irisowner@9b92e6dabb2f:~/irissys$ iris stop IRIS
Sign-on inhibited. See messages.log for details.

Is there something I'm doing wrong? Please give me some advice! Thanks!

17 Comments
ディスカッション (17)2
続けるにはログインするか新規登録を行ってください
ディスカッション (0)1
続けるにはログインするか新規登録を行ってください
お知らせ
· 2024年5月7日

Recapitulação do InterSystems Developer Community, Abril 2024

Olá e Bem-vindo à recapitulação da Comunidade de Desenvolvedores Abril 2024.
Estatísticas gerais
21 novas postages publicadas em Abril:
 12 novos artigos
 9 novos anúncios
2 novos membros ingressaram em Abril
1,049 postagens publicadas ao todo
575 membros ingressaram ao todo
Principais publicações
Principais autores do mês
Artigos
#InterSystems IRIS
 
#Caché
Depurando a Web
Por Danusa Calixto
 
#HealthShare
 
#Outro
 
Anúncios
#InterSystems IRIS
 
#Developer Community Oficial
 
#InterSystems IRIS for Health
 
#Global Masters
 
#InterSystems Oficial
 
#Portal de Aprendizagem
 
Abril, 2024Month at a GlanceInterSystems Developer Community
ディスカッション (0)1
続けるにはログインするか新規登録を行ってください