Best practices for generating OpenAPI Specification documentation
OpenAPI Specification (OAS) documentation is automatically generated for every REST service rule. The OAS documentation for each REST service included in a service package is then combined into a single OAS document.
To generate accurate and complete OAS documentation in your application, review the following best practices:
- Use the following options in the Map to and
Map from fields to generate a complete schema:
- Automation input/output
- Clipboard
- JSON
- Avoid using the following options in the Map to and
Map from fields. If you use the XML or HTML
options, the generated schema only displays the type. For example, for an
XML Parse input, the schema displays type:XML.
For all of the other options, the system does not generate a schema.
- Map to options
- XML Parse
- HTML Postdata
- Delimited Parse Rule
- Parse Structured
- Functions created in the
MapTo
library
- Map from options
- XML Stream
- HTML Stream
- HTML Frame
- Functions created in the
MapFrom
library
- If you use the Clipboard option, avoid setting the Map to key and Map from key values to a parameter reference in your REST service rules. If you use a parameter reference, the generated schema displays type:string.
- If you use the Clipboard option, avoid setting the Map to key and Map from key values to a top-level page, for example, MyUndefinedPage. If you use an undefined page, the system does not generate a schema.
- Use valid property references, for example, .Prop1.Prop2.
- Use page, page list, and string mode properties. Use of other modes is not recommended, even if you use a property reference.
- Specify an HTTP response code in the response condition of each of the REST
service rules that are included in your service package. Note the
following:
- If multiple response conditions use the same HTTP code, only the first condition generates.
- If a response condition uses a property or parameter reference for its HTTP code, the response condition is set as default in the generated OAS.
- If multiple response conditions use a property or parameter reference for the HTTP code, only the first response condition generates.
For more information, see Service REST methods.
Previous topic Integrating with Pega APIs and services Next topic Generating OpenAPI Specification documentation for application-specific REST APIs