Enphase Energy · API Governance Rules

Enphase Energy API Rules

Spectral linting rules defining API design standards and conventions for Enphase Energy.

6 Rules error 1 warn 3 info 2
View Rules File View on GitHub

Rule Categories

enphase

Rules

error
enphase-paths-must-be-versioned
All Enphase Enlighten Systems API paths must include /api/v4/ (or /api/v2/ for legacy specs).
$.paths.*~
warn
enphase-operation-summary-title-case
Operation summaries should use Title Case for consistency with API Evangelist catalog conventions.
$.paths.*.*.summary
warn
enphase-oauth2-required
v4 operations should require OAuth 2.0 security plus the application API key.
$.paths[?(@property =~ /^\/api\/v4\//)].*.security
warn
enphase-system-id-parameter
System-scoped paths must declare the system_id path parameter as integer.
$.paths[?(@property.indexOf('{system_id}') > -1)].*.parameters[?(@.name == 'system_id')]
info
enphase-date-params-iso-format
start_date and end_date parameters should be string format=date (YYYY-MM-DD).
$.paths.*.*.parameters[?(@.name == 'start_date' || @.name == 'end_date')]
info
enphase-throttle-409-documented
Operations should document the 409 Conflict response that Enphase returns when per-minute throttle is exceeded.
$.paths.*.get.responses

Spectral Ruleset

Raw ↑
extends: [[spectral:oas, all]]
rules:
  enphase-paths-must-be-versioned:
    description: All Enphase Enlighten Systems API paths must include /api/v4/ (or /api/v2/ for
      legacy specs).
    severity: error
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        match: '^/api/v[24]/'

  enphase-operation-summary-title-case:
    description: Operation summaries should use Title Case for consistency with API Evangelist
      catalog conventions.
    severity: warn
    given: $.paths.*.*.summary
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z]'

  enphase-oauth2-required:
    description: v4 operations should require OAuth 2.0 security plus the application API key.
    severity: warn
    given: $.paths[?(@property =~ /^\/api\/v4\//)].*.security
    then:
      function: truthy

  enphase-system-id-parameter:
    description: System-scoped paths must declare the system_id path parameter as integer.
    severity: warn
    given: $.paths[?(@property.indexOf('{system_id}') > -1)].*.parameters[?(@.name == 'system_id')]
    then:
      field: schema.type
      function: enumeration
      functionOptions:
        values: [integer]

  enphase-date-params-iso-format:
    description: start_date and end_date parameters should be string format=date (YYYY-MM-DD).
    severity: info
    given: $.paths.*.*.parameters[?(@.name == 'start_date' || @.name == 'end_date')]
    then:
      field: schema.format
      function: enumeration
      functionOptions:
        values: [date]

  enphase-throttle-409-documented:
    description: Operations should document the 409 Conflict response that Enphase returns when
      per-minute throttle is exceeded.
    severity: info
    given: $.paths.*.get.responses
    then:
      field: '409'
      function: truthy