Weaviate · API Governance Rules

Weaviate API Rules

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

22 Rules error 8 warn 6 info 8
View Rules File View on GitHub

Rule Categories

weaviate

Rules

error
weaviate-openapi-version
Weaviate API specs must use OpenAPI 3.0.x
$
error
weaviate-info-title
API must have a title
$.info
warn
weaviate-info-description
API must have a description
$.info
error
weaviate-info-version
API must have a version
$.info
warn
weaviate-operation-summary
All operations must have a summary
$.paths[*][get,post,put,delete,patch,head,options]
info
weaviate-operation-description
All operations should have a description
$.paths[*][get,post,put,delete,patch,head,options]
error
weaviate-operation-operationid
All operations must have an operationId
$.paths[*][get,post,put,delete,patch,head,options]
warn
weaviate-operation-tags
All operations must have tags
$.paths[*][get,post,put,delete,patch,head,options]
error
weaviate-operation-responses
All operations must have responses
$.paths[*][get,post,put,delete,patch,head,options]
warn
weaviate-response-200
GET and POST operations should have a 200 response
$.paths[*][get,post]
info
weaviate-schema-properties-description
Schema properties should have descriptions
$.components.schemas[*].properties[*]
info
weaviate-path-kebab-case
Path segments should use kebab-case
$.paths
warn
weaviate-parameter-description
Parameters should have descriptions
$.paths[*][get,post,put,delete,patch].parameters[*]
error
weaviate-request-body-content
Request bodies must define content
$.paths[*][post,put,patch].requestBody
warn
weaviate-security-schemes
API must define security schemes
$.components
info
weaviate-operation-id-camel-case
OperationIds should use camelCase
$.paths[*][get,post,put,delete,patch].operationId
info
weaviate-schema-type
Schema objects should have a type defined
$.components.schemas[*]
error
weaviate-no-empty-paths
Path items must have at least one operation
$.paths[*]
info
weaviate-vector-db-tags
Vector database operations should be tagged appropriately
$.paths[*][get,post,put,delete,patch].tags[*]
info
weaviate-uuid-format
Object IDs should use UUID format
$.components.schemas[*].properties.id
info
weaviate-microcks-operation
Operations should have Microcks extensions for testing
$.paths[*][get,post,put,delete,patch]
error
weaviate-servers-defined
API must define servers
$

Spectral Ruleset

Raw ↑
rules:
  weaviate-openapi-version:
    description: Weaviate API specs must use OpenAPI 3.0.x
    message: "OpenAPI version must be 3.0.x"
    severity: error
    given: "$"
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: "^3\\.0\\."

  weaviate-info-title:
    description: API must have a title
    message: "Info object must have a title"
    severity: error
    given: "$.info"
    then:
      field: title
      function: truthy

  weaviate-info-description:
    description: API must have a description
    message: "Info object must have a description"
    severity: warn
    given: "$.info"
    then:
      field: description
      function: truthy

  weaviate-info-version:
    description: API must have a version
    message: "Info object must have a version"
    severity: error
    given: "$.info"
    then:
      field: version
      function: truthy

  weaviate-operation-summary:
    description: All operations must have a summary
    message: "Operation must have a summary"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch,head,options]"
    then:
      field: summary
      function: truthy

  weaviate-operation-description:
    description: All operations should have a description
    message: "Operation should have a description"
    severity: info
    given: "$.paths[*][get,post,put,delete,patch,head,options]"
    then:
      field: description
      function: truthy

  weaviate-operation-operationid:
    description: All operations must have an operationId
    message: "Operation must have an operationId"
    severity: error
    given: "$.paths[*][get,post,put,delete,patch,head,options]"
    then:
      field: operationId
      function: truthy

  weaviate-operation-tags:
    description: All operations must have tags
    message: "Operation must have tags"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch,head,options]"
    then:
      field: tags
      function: truthy

  weaviate-operation-responses:
    description: All operations must have responses
    message: "Operation must have responses defined"
    severity: error
    given: "$.paths[*][get,post,put,delete,patch,head,options]"
    then:
      field: responses
      function: truthy

  weaviate-response-200:
    description: GET and POST operations should have a 200 response
    message: "GET/POST operations should define a 200 response"
    severity: warn
    given: "$.paths[*][get,post]"
    then:
      field: responses.200
      function: truthy

  weaviate-schema-properties-description:
    description: Schema properties should have descriptions
    message: "Schema properties should have descriptions"
    severity: info
    given: "$.components.schemas[*].properties[*]"
    then:
      field: description
      function: truthy

  weaviate-path-kebab-case:
    description: Path segments should use kebab-case
    message: "Path segments should use kebab-case (lowercase with hyphens)"
    severity: info
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9{}-]+)+/?$"

  weaviate-parameter-description:
    description: Parameters should have descriptions
    message: "Parameter should have a description"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch].parameters[*]"
    then:
      field: description
      function: truthy

  weaviate-request-body-content:
    description: Request bodies must define content
    message: "Request body must have content defined"
    severity: error
    given: "$.paths[*][post,put,patch].requestBody"
    then:
      field: content
      function: truthy

  weaviate-security-schemes:
    description: API must define security schemes
    message: "Security schemes must be defined in components"
    severity: warn
    given: "$.components"
    then:
      field: securitySchemes
      function: truthy

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

  weaviate-schema-type:
    description: Schema objects should have a type defined
    message: "Schema should define a type"
    severity: info
    given: "$.components.schemas[*]"
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: [type]
            - required: [allOf]
            - required: [anyOf]
            - required: [oneOf]

  weaviate-no-empty-paths:
    description: Path items must have at least one operation
    message: "Path item must have at least one HTTP method defined"
    severity: error
    given: "$.paths[*]"
    then:
      function: schema
      functionOptions:
        schema:
          minProperties: 1

  weaviate-vector-db-tags:
    description: Vector database operations should be tagged appropriately
    message: "Operations should use standard Weaviate tags"
    severity: info
    given: "$.paths[*][get,post,put,delete,patch].tags[*]"
    then:
      function: enumeration
      functionOptions:
        values:
          - objects
          - schema
          - backups
          - batch
          - graphql
          - nodes
          - oidc
          - authz
          - users
          - replication
          - tenants
          - classifications
          - aliases
          - namespaces
          - cluster
          - mcp
          - well-known

  weaviate-uuid-format:
    description: Object IDs should use UUID format
    message: "ID properties should use UUID format"
    severity: info
    given: "$.components.schemas[*].properties.id"
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            format:
              enum: [uuid]

  weaviate-microcks-operation:
    description: Operations should have Microcks extensions for testing
    message: "Operation should include x-microcks-operation extension"
    severity: info
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: x-microcks-operation
      function: truthy

  weaviate-servers-defined:
    description: API must define servers
    message: "Servers array must be defined"
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy