Last updated

scorecard

Reunite's scorecard feature enables you to add and create sets of rules and test your API description files against them. Using these rules you can maintain quality across your existing APIs and ensure that newly-added or updated APIs match your criteria. An API scorecard can include multiple sets of rules, corresponding to different quality levels.

Options

OptionTypeDescription
levels[Level Object]List of levels to score against.
targets[Target Object]Provide custom minimumLevel for specific targets.
teamMetadataProperty[Team Metadata Object]Provide custom team label and team metadata property.

Level Object

OptionTypeDescription
namestringName of the level.
extends[string]Inherit configurations. In case of conflict, priority goes to configurations further down the list. Finally, explicit declarations inline takes precedence over configurations inherited through the extends feature. Built-in configurations include recommended and minimal.
rulesRule ObjectChange the severity level of any rules in your extended configurations. Some rules may also receive additional configurations.

Target Object

OptionTypeDescription
minimumLevelstringThe minimum level refers to a level using the name defined in levels.
whereWhere ObjectSpecify which API descriptions to apply the minimumLevel to.
rulesRule ObjectCustomize rules for the target. Useful for disabling rules based on the metadata.

Where Object

OptionTypeDescription
metadataWhere Metadata ObjectSpecify which API descriptions to apply the minimumLevel to based on the metadata.

Where Metadata Object

OptionTypeDescription
(name of metadata key)stringSpecify the exact value of the metadata key to match against. Also supports ISO 8601 date range.

Team Metadata Object

OptionTypeDescription
propertystringThe property name to use for the team name.
labelstringThe label to use for the team name.
defaultstringThe default team name to use when the property is not found.

Examples

The following example redocly.yaml file configuration adds three levels to the project's API scorecard: Baseline, Silver, and Gold:

redocly.yaml
scorecard:
  levels:
    - name: Baseline
      extends:
        - ./api-ruleset-baseline.yaml
    - name: Silver
      extends:
        - ./api-ruleset-silver.yaml
    - name: Gold
      extends:
        - ./api-ruleset-gold.yaml

The following sample ruleset configuration file is for the Baseline level and applies the Redocly minimal ruleset and adds a few additional built-in rules:

api-ruleset-baseline.yaml
extends:
  - minimal
rules:
  no-ambiguous-paths: error # This rule enforces paths to match only one PathItem entry, including template variables
  no-invalid-schema-examples: error # This rule enforces schema examples to match their declared types
  spec-strict-refs: error # This rule enforces $refs to reference elements in the component section

The following sample ruleset configuration is for the Silver level and applies the Redocly minimal ruleset, adds a few additional built-in rules, and a few additional configurable rules:

api-ruleset-silver.yaml
extends:
  - minimal
rules:
  no-ambiguous-paths: error # This rule enforces paths match only one PathItem entry, including template variables
  no-invalid-schema-examples: error # This rule enforces schema examples to match their declared types
  spec-strict-refs: error # This rule enforces $refs to reference elements in the component section
  paths-kebab-case: error # This rule enforces all paths to be written using kebab case
  rule/operationId-casing: # The following configurable three rules enforce camel case for operation ids, parameters, and schema properties
    subject:
      type: Operation
      property: operationId
    assertions:
      casing: camelCase
  rule/parameter-casing:
    subject:
      type: Parameter
    assertions:
      casing: camelCase
  rule/schema-properties-casing:
    subject:
      type: Schema
      property: properties
    assertions:
      casing: camelCase

The following sample ruleset configuration is for the Gold level:

api-ruleset-gold.yaml
extends:
  - minimal
rules:
  no-ambiguous-paths: error # This rule enforces paths match only one PathItem entry, including template variables
  no-invalid-schema-examples: error # This rule enforces schema examples to match their declared types
  spec-strict-refs: error # This rule enforces $refs to reference elements in the component section
  paths-kebab-case: error # This rule enforces all paths to be written using kebab case
  rule/operationId-casing: # The following configurable three rules enforce camel case for operation ids, parameters, and schema properties
    subject:
      type: Operation
      property: operationId
    assertions:
      casing: camelCase
  rule/parameter-casing:
    subject:
      type: Parameter
    assertions:
      casing: camelCase
  rule/schema-properties-casing:
    subject:
      type: Schema
      property: properties
    assertions:
      casing: camelCase
  rule/headers-include-example: # The following two configurable rules enforce that headers and parameters include examples
    subject:
      type: Header
    assertions:
      requireAny:
        - example
        - examples
  rule/params-must-include-examples:
    subject:
      type: Parameter
    assertions:
      requireAny:
        - example
        - examples
      mutuallyExclusive:
        - example
        - examples
  rule/operation-security-defined: # This configurable rule enforces the security property of the Paths Operation OpenAPI node type is defined
    subject:
      type: Operation
      property: security
    where:
      - subject:
          type: Paths
        assertions:
          defined: true
    assertions:
      defined: true
    message: "Property `security` must be defined"
  rule/terms-url: # This configurable rule enforces the terms of service property of the Info OpenAPI node type is defined
    subject:
      type: Info
      property: termsOfService
    assertions:
      defined: true
  • Check out the different ways you can customize the behavior and appearance of integrated API documentation on the OpenAPI reference page.
  • Learn more about the different ways you can configure an API catalog, using the Catalog reference.

Resources

  • Learn more about the Scorecard feature including what it displays and where to find the reports.
  • Learn how to add either Redocly built-in rule sets or custom rule sets to the scorecard for your projects in Configure scorecard.