Salesforce Net Zero Cloud · API Governance Rules

Salesforce Net Zero Cloud API Rules

Spectral linting rules defining API design standards and conventions for Salesforce Net Zero Cloud.

9 Rules error 5 warn 4
View Rules File View on GitHub

Rule Categories

salesforce

Rules

warn
salesforce-nzc-operation-summary-title-case
Operation summaries must use Title Case
$.paths[*][*].summary
warn
salesforce-nzc-operation-id-camel-case
OperationIds must use camelCase
$.paths[*][*].operationId
warn
salesforce-nzc-tags-title-case
All tags must use Title Case
$.paths[*][*].tags[*]
warn
salesforce-nzc-emission-scope-required
Carbon emission records should specify scope
$.components.schemas.CarbonEmissionInput.required
error
salesforce-nzc-response-200-description
All 200 responses must have a description
$.paths[*][*].responses['200']
error
salesforce-nzc-contact-required
API info must include contact details
$.info
error
salesforce-nzc-version-required
API must have a version
$.info
error
salesforce-nzc-servers-required
API must define servers
$
error
salesforce-nzc-security-defined
API must define security requirements
$

Spectral Ruleset

Raw ↑
rules:
  salesforce-nzc-operation-summary-title-case:
    description: Operation summaries must use Title Case
    message: "Summary '{{value}}' must use Title Case"
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"

  salesforce-nzc-operation-id-camel-case:
    description: OperationIds must use camelCase
    message: "OperationId '{{value}}' must use camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  salesforce-nzc-tags-title-case:
    description: All tags must use Title Case
    severity: warn
    given: "$.paths[*][*].tags[*]"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z]"

  salesforce-nzc-emission-scope-required:
    description: Carbon emission records should specify scope
    message: "Carbon emission input should include Scope field"
    severity: warn
    given: "$.components.schemas.CarbonEmissionInput.required"
    then:
      function: schema
      functionOptions:
        schema:
          type: array

  salesforce-nzc-response-200-description:
    description: All 200 responses must have a description
    severity: error
    given: "$.paths[*][*].responses['200']"
    then:
      field: description
      function: truthy

  salesforce-nzc-contact-required:
    description: API info must include contact details
    severity: error
    given: "$.info"
    then:
      field: contact
      function: truthy

  salesforce-nzc-version-required:
    description: API must have a version
    severity: error
    given: "$.info"
    then:
      field: version
      function: truthy

  salesforce-nzc-servers-required:
    description: API must define servers
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  salesforce-nzc-security-defined:
    description: API must define security requirements
    severity: error
    given: "$"
    then:
      field: security
      function: truthy