Vineyard · API Governance Rules

Vineyard API Rules

Spectral linting rules defining API design standards and conventions for Vineyard.

8 Rules error 3 warn 5
View Rules File View on GitHub

Rule Categories

vineyard

Rules

warn
vineyard-operation-ids-kebab-case
Operation IDs should use camelCase consistent with vineyard Python SDK naming
$.paths[*][*].operationId
error
vineyard-tags-required
All operations must have at least one tag for grouping
$.paths[*][*]
warn
vineyard-path-kebab-case
All path segments should use kebab-case
$.paths
error
vineyard-description-required
All operations must have a description
$.paths[*][*]
warn
vineyard-response-200-or-201
Successful operations should return 200 or 201
$.paths[*][post,put,patch]
warn
vineyard-object-id-string
ObjectIDs in vineyard are 64-bit unsigned integers represented as strings for JSON compatibility
$.paths[*][*].parameters[?(@.name == 'objectId')]
error
vineyard-server-defined
At least one server must be defined in the spec
$
warn
vineyard-info-contact
The info object should include contact information
$.info

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  vineyard-operation-ids-kebab-case:
    description: Operation IDs should use camelCase consistent with vineyard Python SDK naming
    message: "Operation ID '{{value}}' should be camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]+$"

  vineyard-tags-required:
    description: All operations must have at least one tag for grouping
    message: "Operation is missing tags - use Connection, Objects, Metadata, Names, Blobs, or Persistence"
    severity: error
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  vineyard-path-kebab-case:
    description: All path segments should use kebab-case
    message: "Path '{{path}}' should use kebab-case"
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9-{}/]+)+$"

  vineyard-description-required:
    description: All operations must have a description
    message: "Operation at '{{path}}' is missing a description"
    severity: error
    given: "$.paths[*][*]"
    then:
      field: description
      function: truthy

  vineyard-response-200-or-201:
    description: Successful operations should return 200 or 201
    message: "Operation should define a 200 or 201 success response"
    severity: warn
    given: "$.paths[*][post,put,patch]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          oneOf:
            - required: ['200']
            - required: ['201']

  vineyard-object-id-string:
    description: >-
      ObjectIDs in vineyard are 64-bit unsigned integers represented as strings
      for JSON compatibility
    message: "ObjectID path parameter should be type string"
    severity: warn
    given: "$.paths[*][*].parameters[?(@.name == 'objectId')]"
    then:
      field: schema.type
      function: enumeration
      functionOptions:
        values:
          - string

  vineyard-server-defined:
    description: At least one server must be defined in the spec
    message: "The spec should define at least one server"
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  vineyard-info-contact:
    description: The info object should include contact information
    message: "info.contact should be defined for community support"
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy