Documentation Completeness Ruleset

October 24, 2022 ยท View on GitHub

The Documentation Completeness Ruleset consists of 2 domains:

  • API definition completeness (paths, schemas, response status and error codes):
    • Must be a well-formed JSON or YAML document
    • Must have an OAS version
    • Must be a well-formed OpenAPI document
    • Must contain meta information about the API itself
    • Must contain a schema definition
    • Must have response schema defined
    • Must have success status code definitions
    • Must have error status code definitions
  • Reference documentation completeness (descriptions, examples):
    • Must have descriptions for every attribute
    • Must have examples for every schema

Rules

name_iddescriptionseveritymitigation
oas[2/3]-schemaMalformed OAS document, not adhering to the OpenAPI v2/v3 specifications.errorPlease fix the items identified to adhere to the OpenAPI v2/v3 specifications. Reference
oas-versionThe version of OpenAPI is not specified.errorPlease add the OpenAPI attributes identified as missing and provide values for these attributes. Reference
info-contactInfo object must have contact object.warningPlease add missing contact object. Reference
info-descriptionInfo object must have a non-empty description.warningPlease add missing description. Reference
info-licenseInfo object must have license object.warningPlease add missing license object. Reference
license-urlLicense object must have a url.warningPlease add missing url. Reference
oas[2/3]-missing-schema-definitionSome schema definitions are missing.errorPlease add schema definitions for the items detected. Reference
general-schema-definitionSome schemas are partially defined.errorPlease fully describe the schema for the items detected as using object. Reference
oas[2/3]-missing-returned-representationSome responses do not define a schema.errorPlease add a schema for the items detected. Reference
success-status-codeSome operations do not define a success status code.errorPlease add a success status code in the 1xx, 2xx or 3xx range for the items identified. Reference
error-status-codeSome operations do not define errors.warningPlease add an error status code for the items identified. Reference
description-for-every-attributeSome attributes do not provide a description.warningPlease add a description for the items identified. Reference
examples-for-every-schemaExamples are not provided for some of the schemas.warningPlease add examples for the schemas identified. Reference

API Definition Completeness

Check the completeness of an OAS document.

Well-formed JSON or YAML document

  • The document must be syntactically correct regarding the JSON or YAML syntax, parser should not complain

oas-version: Version of the OAS is missing

  • The document must specify the OAS version it is supporting.

oas[2|3]-schema: Well-formed OpenAPI document

  • The document must be syntactically correct regarding the version of OAS it declares

Meta Information about the API itself

The following fields must be present (note: list of fields depend on the OAS version) List for OAS v2:

  • info
  • title
  • version
  • basepath
  • License
  • SecurityDefinitions

List of that are implemented for this check.

  • oas[2|3]-meta-info
  • info-contact
  • info-description
  • info-license

oas[2|3]-missing-schema-definition: Missing Schema Definition

  • There is no schema attribute for a component

general-schema-definition: Generic Schema Definition

  • Some of the defined schema use object as a final field when describing their object structure.

oas[2-3]-missing-returned-representation: Missing Returned Representation

  • 2XX (except 204) and 4xx responses must have a response schema defined.

success-status-code: Missing Success Status Code

  • For every operation in the OAS document, there should be at least one success status code defined.

  • A successful status code is in the 1xx, 2xx or 3xx range series, and generally a 200, 201 or 204. Missing response schema object properties.

error-status-code: Missing Error Status Codes

  • There should be at least one error status code either 4xx or 5xx (or default per the OpenAPI spec / search for Default Response)

  • There are no error codes, only 200 OK

Reference Documentation Completeness

description-for-every-attribute: Descriptions for Every Attribute

  • For every attribute that is present in the OAS document, if a description is proposed as optional to complement that attribute, then yes it must be present.

examples-for-every-schema: Examples for Every Schema

  • For every schema provided in the OAS document, at least one example must be present