Lunar Energy · API Governance Rules

Lunar Energy API Rules

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

8 Rules error 4 warn 4
View Rules File View on GitHub

Rule Categories

gridshare

Rules

error
gridshare-info-contact
Gridshare OpenAPI documents must declare a Lunar Energy / Gridshare contact.
$.info.contact
error
gridshare-server-base-url
Servers must point at developer-api.{partner,customer}.[dev0.]{us.,}mygridshare.com.
$.servers[*].url
error
gridshare-bearer-only
All Gridshare endpoints use OAuth 2.0 bearer tokens — no API keys.
$.components.securitySchemes[*]
warn
gridshare-tag-title-case
Tags must be Title Case (e.g. Flex Groups, Operation Mode).
$.tags[*].name
warn
gridshare-operation-summary-title-case
Operation summaries must be Title Case.
$.paths[*][*].summary
error
gridshare-synthid-parameter-name
Device path parameter must be named synthId (synthetic identifier).
$.paths[?(@property =~ /\\{synthId\\}/)]
warn
gridshare-energy-fields-opt-in
Telemetry endpoints must document the include query parameter so energy_Wh fields can be requested.
$.paths[?(@property =~ /telemetry/)].get.parameters[?(@.name == 'include')]
warn
gridshare-error-shape
Error responses (400/401/403/422) reference the documented {message, code} shape.
$.paths[*][*].responses['400','401','403','422'].content.application/json.schema.$ref

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
rules:
  gridshare-info-contact:
    description: Gridshare OpenAPI documents must declare a Lunar Energy / Gridshare contact.
    severity: error
    given: $.info.contact
    then:
      - field: email
        function: pattern
        functionOptions:
          match: "@(gridshare|lunarenergy)\\.com$"
  gridshare-server-base-url:
    description: Servers must point at developer-api.{partner,customer}.[dev0.]{us.,}mygridshare.com.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://developer-api\\.(partner|customer)(\\.dev0)?(\\.us)?\\.mygridshare\\.com$"
  gridshare-bearer-only:
    description: All Gridshare endpoints use OAuth 2.0 bearer tokens — no API keys.
    severity: error
    given: $.components.securitySchemes[*]
    then:
      function: schema
      functionOptions:
        schema:
          oneOf:
            - properties: { type: { const: http }, scheme: { const: bearer } }
              required: [type, scheme]
            - properties: { type: { const: oauth2 } }
              required: [type, flows]
  gridshare-tag-title-case:
    description: Tags must be Title Case (e.g. Flex Groups, Operation Mode).
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9]*( [A-Z][A-Za-z0-9]*)*$"
  gridshare-operation-summary-title-case:
    description: Operation summaries must be Title Case.
    severity: warn
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][A-Za-z0-9]*)( ([A-Z][A-Za-z0-9]*|[A-Z]+))*$"
  gridshare-synthid-parameter-name:
    description: Device path parameter must be named synthId (synthetic identifier).
    severity: error
    given: $.paths[?(@property =~ /\\{synthId\\}/)]
    then:
      function: truthy
  gridshare-energy-fields-opt-in:
    description: Telemetry endpoints must document the include query parameter so energy_Wh fields can be requested.
    severity: warn
    given: $.paths[?(@property =~ /telemetry/)].get.parameters[?(@.name == 'include')]
    then:
      function: truthy
  gridshare-error-shape:
    description: Error responses (400/401/403/422) reference the documented {message, code} shape.
    severity: warn
    given: $.paths[*][*].responses['400','401','403','422'].content.application/json.schema.$ref
    then:
      function: pattern
      functionOptions:
        match: "Response$"

Work with this as data

Every ruleset here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This ruleset
curl "https://apis.io/api/v1/rules/gridshare-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.