Roblox Engine API · API Governance Rules

Roblox Engine API API Rules

Spectral linting rules defining API design standards and conventions for Roblox Engine API.

11 Rules error 2 warn 5 info 4
View Rules File View on GitHub

Rule Categories

roblox

Rules

warn
roblox-operation-has-tag
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
error
roblox-operation-has-summary
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
error
roblox-operation-has-operation-id
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
roblox-api-key-auth
Roblox Open Cloud uses x-api-key header authentication
$.components.securitySchemes[*]
info
roblox-versioned-cloud-paths
Open Cloud v2 paths should use /cloud/v2/ prefix
$.paths[*]~
warn
roblox-universe-id-path-param
Universe endpoints should use universeId as path parameter
$.paths[*][*].parameters[?(@.in === 'path' && @.name === 'universe_id')]
warn
roblox-camel-case-operation-id
OperationIds should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
info
roblox-pagination-uses-page-token
Cloud v2 list endpoints should use pageToken for pagination
$.paths[*].get.parameters[?(@.name === 'pageToken')]
warn
roblox-responses-have-error-schema
Error responses should reference an error schema
$.paths[*][*].responses[4*].content[*]
info
roblox-patch-uses-update-mask
PATCH operations should support updateMask query parameter
$.paths[*].patch
info
roblox-schema-has-description
Schema components should have descriptions
$.components.schemas[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  # Roblox Open Cloud API Conventions

  roblox-operation-has-tag:
    description: All operations must have at least one tag
    message: Operation {{path}} is missing a tag
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  roblox-operation-has-summary:
    description: All operations must have a summary
    message: Operation {{path}} is missing a summary
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  roblox-operation-has-operation-id:
    description: All operations must have an operationId
    message: Operation {{path}} is missing an operationId
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  roblox-api-key-auth:
    description: Roblox Open Cloud uses x-api-key header authentication
    message: Security scheme should use apiKey with x-api-key header
    severity: warn
    given: "$.components.securitySchemes[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            type:
              type: string
              enum:
                - apiKey
            in:
              type: string
              enum:
                - header
            name:
              type: string
              enum:
                - x-api-key

  roblox-versioned-cloud-paths:
    description: Open Cloud v2 paths should use /cloud/v2/ prefix
    message: Cloud API path {{path}} should use /cloud/v2/ prefix
    severity: info
    given: "$.paths[*]~"
    then:
      function: pattern
      functionOptions:
        match: "^/(cloud|datastores|messaging-service|assets|universes)/"

  roblox-universe-id-path-param:
    description: Universe endpoints should use universeId as path parameter
    message: Universe ID path parameter should be named universeId
    severity: warn
    given: "$.paths[*][*].parameters[?(@.in === 'path' && @.name === 'universe_id')]"
    then:
      function: falsy

  roblox-camel-case-operation-id:
    description: OperationIds should use camelCase
    message: OperationId {{value}} should use camelCase
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  roblox-pagination-uses-page-token:
    description: Cloud v2 list endpoints should use pageToken for pagination
    message: List operation {{path}} should support pageToken for pagination
    severity: info
    given: "$.paths[*].get.parameters[?(@.name === 'pageToken')]"
    then:
      field: schema.type
      function: pattern
      functionOptions:
        match: "^string$"

  roblox-responses-have-error-schema:
    description: Error responses should reference an error schema
    message: Error response {{path}} should define a schema
    severity: warn
    given: "$.paths[*][*].responses[4*].content[*]"
    then:
      field: schema
      function: truthy

  roblox-patch-uses-update-mask:
    description: PATCH operations should support updateMask query parameter
    message: PATCH operation {{path}} should support updateMask for partial updates
    severity: info
    given: "$.paths[*].patch"
    then:
      field: parameters
      function: truthy

  roblox-schema-has-description:
    description: Schema components should have descriptions
    message: Schema {{path}} is missing a description
    severity: info
    given: "$.components.schemas[*]"
    then:
      field: description
      function: truthy