Generate service description on demand
Access a description of a REST web service through a query string on the URL of the web service.
You can output the OpenAPI description for the web service in a browser tab in either JSON or YAML format. For a web service server started with Genero Application Server (GAS) the OpenAPI description URL would be:
http://myServer:myPort/gas/ws/r/myGroup/myXcf/myService?openapi.jsonOr
The feature for generating the OpenAPI documentation in YAML format is experimental and may change.
To generate the OpenAPI documentation for a specific
version of operations, add the
"&version=version_name
" query string to the
URI:
http://myServer:myPort/gas/ws/r/myXcf/myService?openapi.json&version=v3
The GWS service must be running in order to provide the output.
The OpenAPI description provides information about the operations defined in a web service. When developing client applications that access web services, you may need to refer to the OpenAPI description for the web service for details of the resource endpoints, operations, supported media types, version, and so on. To learn more about the OpenAPI specification, refer to the OpenAPI documentation.
The sections highlighted in this topic are valuable in respect to Genero RESTful web services. The samples are in JSON format.
Service information
Paths
/sub/{f}
, /mult/{coef}/hello, and so on) and the HTTP verb
(GET, POST, and so on) used by operations. If operations are versioned by URI, the path will also
include information about the version. The version identified is displayed as a prefix to the
resource path. For example, "/v3
" is the version identifier for operations shown in
Figure 2. Parameters
enum
keyword as shown in Figure 3. To
read more about versioning, see Specify version mode.Body requests and responses
WSMedia
and whether objects are defined
as types (named types) in the Genero BDL code. - If
WSMedia
is set forapplication/xml
as the content type, or the object type is not named (an anonymous or unknown type), the GWS engine exposes the object content (properties) in theschema
sub part. - If
WSMedia
is set forapplication/json
(the default) on a named content type, the GWS engine outputs the type as a reference ($ref
) in aschema
sub part.The reference uses an XPath expression to locate where in theIf the GWS detects the same type name (for example,"recType" in Figure 5) is used for another type, error 15580 is raised.components/schemas
section the properties are exposed. This named type may be referenced in several resources but only has its properties exposed once.Important: Reference to definition ($ref)A reference definition (
$ref
) is only allowed in named types used on a body with a JSON schema and error handling types (for example, usingWSError
attribute). Parameters likeWSHeader
,WSQuery
, orWSCookies
are not affected.
Responses
WSError
attribute) are set for application/json
(the default), the GWS engine outputs the
type as a reference ($ref
) in the responses
sub parts. The
reference will use an XPath expression to point to where in components/responses
section the properties are exposed.