Written by

Senior Developer at Greater Manchester Mental Health Services
Question Andy Stobirski · Jan 20, 2024

Using ^%REST to Create a Service - Correct OpenAPI 2.0 version was not specified

Update - I answered my own question, so I'll just leave this here in case it can help someone.

Hi All

I'm following the tutorial Creating and Editing REST Services and have reached the step Using ^%REST to Create a Service and have encountered an error.

Here is grab of the terminal command:

PARISCONNECT>do ^%REST
 
REST Command Line Interface (CLI) helps you CREATE or DELETE a REST application.
Enter an application name or (L)ist all REST applications (L): PcConRest
REST application not found: PcConRest
Do you want to create a new REST application? Y or N (Y): Y
 
File path or absolute URL of a swagger document.
If no document specified, then create an empty application.
OpenAPI 2.0 swagger: e:\temp\schema.json
OpenAPI 2.0 swagger document: e:\temp\schema.json
Confirm operation, Y or N (Y): Y
 
-----Creating REST application: PcConRest-----
Error creating application
ERROR #8738: Correct OpenAPI 2.0 version was not specified: . <$.swagger>
  > ERROR #5490: Error running generator for method '%OnCompile:PcConRest.spec'
ERROR: %REST.Spec.cls(%OnCompile) of generated code compiling subclass 'PcConRest.spec'
    > ERROR #5030: An error occurred while compiling class 'PcConRest.spec'
 
Enter an application name or (L)ist all REST applications (L):

The error produced is Correct OpenAPI 2.0 version was not specified, and I have downloaded the OpenAPI-Specification v2.0 schema from here  - this location was taken directly from the tutorial document referenced above. Where can I find the correct version, or am I doing something wrong?

Cheers

Andy

Product version: IRIS 2021.1
$ZV: IRIS for Windows (x86-64) 2021.2.1 (Build 654U) Fri Mar 18 2022 06:09:35 EDT

Comments

Ashok Kumar T · Jan 21, 2024

Hello @Andy Stobirski 

The property "swagger" is an mandatory field and the value  should be string value "2.0" not even integer 2 or anything other than "2.0". If you defined the mandatory fields then it should work.

0
Andy Stobirski  Jan 21, 2024 to Ashok Kumar T

Hi Ashok, thanks for your reply and link, which was very interesting.

I have checked the swagger document and it appears to contain the correct value though:

   "properties": {
        "swagger": {
            "type": "string",
            "enum": [
                "2.0"
            ],
            "description": "The Swagger version of this document."
        }
   }
0
Andy Stobirski · Jan 21, 2024

UPDATE
I was making a mistake - the file I was using was is the empty schema. I needed something that contains valid content, such as the example given here.

When used that file, the Rest Command Line Interface Worked correctly.

0