Sitefinity CMS · API Governance Rules

Sitefinity CMS API Rules

Spectral linting rules defining API design standards and conventions for Sitefinity CMS.

10 Rules error 3 warn 4 info 3
View Rules File View on GitHub

Rule Categories

sitefinity

Rules

warn
sitefinity-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][*].summary
error
sitefinity-operation-id-camel-case
Operation IDs must use camelCase
$.paths[*][*].operationId
info
sitefinity-odata-collection-response
List responses should use OData value wrapper with @odata.count
$.paths[*].get.responses['200'].content['application/json'].schema
info
sitefinity-cookie-auth-scheme
Sitefinity CMS uses cookie-based ASP.NET authentication
$.components.securitySchemes
warn
sitefinity-delete-returns-204
DELETE operations should return 204 No Content
$.paths[*].delete.responses
error
sitefinity-post-has-request-body
POST operations must include a request body
$.paths[*].post
info
sitefinity-pascal-case-model-names
Schema model names should use PascalCase (Sitefinity .NET convention)
$.components.schemas
error
sitefinity-servers-defined
API must define at least one server
$
warn
sitefinity-info-contact
Info section must include contact details
$.info
warn
sitefinity-tags-defined
Root tags must be defined for all operation tags
$.tags

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  sitefinity-operation-summary-title-case:
    description: All operation summaries must use Title Case
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z\\s]*$"

  sitefinity-operation-id-camel-case:
    description: Operation IDs must use camelCase
    severity: error
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  sitefinity-odata-collection-response:
    description: List responses should use OData value wrapper with @odata.count
    severity: info
    given: "$.paths[*].get.responses['200'].content['application/json'].schema"
    then:
      function: schema
      functionOptions:
        schema:
          type: object

  sitefinity-cookie-auth-scheme:
    description: Sitefinity CMS uses cookie-based ASP.NET authentication
    severity: info
    given: "$.components.securitySchemes"
    then:
      function: truthy

  sitefinity-delete-returns-204:
    description: DELETE operations should return 204 No Content
    severity: warn
    given: "$.paths[*].delete.responses"
    then:
      field: "204"
      function: truthy

  sitefinity-post-has-request-body:
    description: POST operations must include a request body
    severity: error
    given: "$.paths[*].post"
    then:
      field: requestBody
      function: truthy

  sitefinity-pascal-case-model-names:
    description: Schema model names should use PascalCase (Sitefinity .NET convention)
    severity: info
    given: "$.components.schemas"
    then:
      function: schema
      functionOptions:
        schema:
          type: object

  sitefinity-servers-defined:
    description: API must define at least one server
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  sitefinity-info-contact:
    description: Info section must include contact details
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy

  sitefinity-tags-defined:
    description: Root tags must be defined for all operation tags
    severity: warn
    given: "$.tags"
    then:
      function: truthy