VS Code Marketplace · API Governance Rules

VS Code Marketplace API Rules

Spectral linting rules defining API design standards and conventions for VS Code Marketplace.

9 Rules error 2 warn 4 info 3
View Rules File View on GitHub

Rule Categories

vscode

Rules

warn
vscode-marketplace-operation-ids-camel-case
Operation IDs must use camelCase.
$.paths[*][*].operationId
warn
vscode-marketplace-tags-title-case
Tags must use Title Case.
$.paths[*][*].tags[*]
error
vscode-marketplace-operation-summary-required
All operations must have a summary.
$.paths[*][get,post,put,patch,delete]
info
vscode-marketplace-operation-description-required
All operations should have a description.
$.paths[*][get,post,put,patch,delete]
error
vscode-marketplace-post-has-request-body
POST operations must define a request body.
$.paths[*].post
warn
vscode-marketplace-response-200-or-202
GET and POST operations must define a 200 response.
$.paths[*][get,post]
info
vscode-marketplace-api-version-query-param
Marketplace Gallery API endpoints require an api-version query parameter.
$.paths[*][post,get].parameters[*]
warn
vscode-marketplace-path-lowercase
API path segments should be lowercase.
$.paths
info
vscode-marketplace-schema-descriptions
Schema properties should have descriptions.
$.components.schemas[*].properties[*]

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  vscode-marketplace-operation-ids-camel-case:
    description: Operation IDs must use camelCase.
    message: "Operation ID '{{value}}' must be camelCase."
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  vscode-marketplace-tags-title-case:
    description: Tags must use Title Case.
    message: "Tag '{{value}}' must use Title Case."
    severity: warn
    given: "$.paths[*][*].tags[*]"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 \\-]*$"

  vscode-marketplace-operation-summary-required:
    description: All operations must have a summary.
    message: "Operation must have a summary."
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: defined

  vscode-marketplace-operation-description-required:
    description: All operations should have a description.
    message: "Operation should have a description."
    severity: info
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: description
      function: defined

  vscode-marketplace-post-has-request-body:
    description: POST operations must define a request body.
    message: "POST operation must define a requestBody."
    severity: error
    given: "$.paths[*].post"
    then:
      field: requestBody
      function: defined

  vscode-marketplace-response-200-or-202:
    description: GET and POST operations must define a 200 response.
    message: "GET/POST operation must define a 200 response."
    severity: warn
    given: "$.paths[*][get,post]"
    then:
      field: responses.200
      function: defined

  vscode-marketplace-api-version-query-param:
    description: >-
      Marketplace Gallery API endpoints require an api-version query parameter.
    message: "Marketplace API operations should document the api-version parameter."
    severity: info
    given: "$.paths[*][post,get].parameters[*]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          properties:
            name:
              type: string

  vscode-marketplace-path-lowercase:
    description: API path segments should be lowercase.
    message: "Path '{{path}}' should use lowercase segments."
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(\\/[a-z0-9{}\\-._~]*)*$"

  vscode-marketplace-schema-descriptions:
    description: Schema properties should have descriptions.
    message: "Schema property should have a description."
    severity: info
    given: "$.components.schemas[*].properties[*]"
    then:
      field: description
      function: defined