Provide service information

Provide information about the service, such as title, version, contact details, etc., that is generated in the OpenAPI specification file.

In your service module:

  1. Define a PUBLIC record with a WSInfo attribute. This record allows you to provide metadata about your REST service, which can be generated according to the OpenAPI standard and used by clients. This example record follows that OpenAPI specification:
    # service module
    PUBLIC DEFINE serviceInfo RECORD ATTRIBUTE(WSInfo)
      title STRING,
      description STRING,
      termOfService STRING,
      contact RECORD
        name STRING,
        url STRING,
        email STRING
      END RECORD,
      version STRING
      END RECORD = (
        title: "my service", 
        version: "1.0", 
        contact: ( email:"helpdesk@mysite.com") )
    
    # ... service functions ...
    Note: If you do not set a service information record, the default value as the name of the service module is used for the service title.
  2. Add record fields as required. The GWS does not check the record structure used with WSInfo attribute. You are therefore allowed to add the fields you want to be available in the OpenAPI specification.
  3. Add values for the record fields.

The information provided is then generated in the openapi.json or openapi.yaml specification file.