Default version of the OpenAPI document

Set a default set of operations to display in the OpenAPI documentation.

A Web service information record may contain a WSVersion attribute set to a specific version of operations of the Web service that are displayed in the OpenAPI document.

With a default version, there is no need to specify the version in the query string in the URI to generate the OpenAPI documentation. For example, with a standard URI request for JSON output, http://myServer:myPort/gas/ws/r/myGroup/myXcf/myService?openapi.json, the GWS generates documentation for the version of operations set as default.
Important: Setting a default version is optional but if not specified, and you do not request a version in the query string of the URI to generate the OpenAPI documentation, the client will get a 404 (Not found) error response and internally the server will throw error 41.
There are considerations for setting a default version for the OpenAPI document. The version selected must make up a complete set of operations for the Web service to include:
  • operations whose version name matches the version name set in the WSVersion of REST functions.
    Tip: First version

    It is possible to use a version name which is not used in any operation. This new version will only display operations without WSVersion or with WSVersion="default". This option is useful if you want to use versioning in the first release of your Web service (for example, WSVersion="v1"), where, in fact, no operation has been versioned. It will introduce clients to the concept of version control in your Web service.

  • operations with a default version. These are operations which are general to all versions as they either do not have a WSVersion set in the function or are set with WSVersion=default.

Default OpenAPI version

In the example, WSVersion is set to "v3". This defines version v3 as the default version of operations displayed in the OpenAPI documentation of the Web service.
Warning: When using WSVersion at the module level, be aware that it can only contain one value, and the value must not be called "default". Setting more than one version or setting WSVersion ="default" is only allowed with WSVersion, but causes compilation error-9140 to be thrown when detected at the module level.
PUBLIC DEFINE myInfo RECORD ATTRIBUTE(WSInfo, WSVersion = "v3")
   title STRING
   # ...
END RECORD