UiPath · API Governance Rules

UiPath API Rules

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

40 Rules error 15 warn 20 info 5
View Rules File View on GitHub

Rule Categories

delete external get info no openapi operation parameter paths request response schema security servers tags

Rules

error
info-title-required
API title must be present and start with "UiPath"
$.info.title
error
info-description-required
API info must have a description with at least 50 characters
$.info.description
error
info-version-required
API info must include a version
$.info.version
warn
info-contact-url
API contact should include a URL
$.info.contact.url
warn
info-terms-of-service
API should reference UiPath terms of service
$.info.termsOfService
error
openapi-version
OpenAPI version must be 3.0.x or 3.1.x
$.openapi
error
servers-defined
At least one server must be defined
$.servers
error
servers-https
All server URLs must use HTTPS
$.servers[*].url
warn
servers-description
Each server should have a description
$.servers[*].description
warn
paths-kebab-case
Path segments must use kebab-case (no underscores or camelCase)
$.paths[*]~
warn
paths-no-trailing-slash
Paths must not have a trailing slash
$.paths[*]~
error
paths-no-query-string
Paths must not contain query strings
$.paths[*]~
error
operation-operationId-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-operationId-camelCase
OperationId must use camelCase
$.paths[*][get,post,put,patch,delete].operationId
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-summary-uipath-prefix
Operation summary must start with "UiPath"
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation must have a description
$.paths[*][get,post,put,patch,delete,head,options]
error
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete]
info
operation-operationId-verb-prefix
OperationId should start with a standard verb (list, get, create, update, delete, add, remove, search, run, upload)
$.paths[*][get,post,put,patch,delete].operationId
warn
tags-global-defined
Global tags array should be defined
$.tags
warn
tags-description
All tags should have descriptions
$.tags[*].description
warn
parameter-description-required
Every parameter must have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
warn
parameter-schema-type
Every parameter schema must have a type defined
$.paths[*][get,post,put,patch,delete].parameters[*].schema
info
parameter-pagination-pageSize
Pagination size parameter should be named 'pageSize' (not 'limit' or 'size')
$.paths[*][get].parameters[*]
error
parameter-no-api-key-in-query
API keys should be passed in headers, not query parameters
$.paths[*][get,post,put,patch,delete].parameters[?(@.name == 'api_key' || @.name == 'apiKey' || @.name == 'access_token')]
warn
request-body-json-content
Request body should include application/json content type
$.paths[*][post,put,patch].requestBody.content
info
request-body-description
Request body should have a description
$.paths[*][post,put,patch].requestBody
error
response-success-required
Every operation must define at least one 2xx response
$.paths[*][get,post,put,patch,delete].responses
warn
response-error-401
Operations should define a 401 Unauthorized response
$.paths[*][get,post,put,patch,delete].responses
warn
response-error-400
Operations with request bodies should define a 400 Bad Request response
$.paths[*][post,put,patch].responses
error
response-description-required
Every response must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
warn
schema-description
Top-level schemas should have a description
$.components.schemas[*]
warn
schema-type-defined
Schema properties should have a type defined
$.components.schemas[*].properties[*]
info
schema-property-camelCase
Schema property names should use camelCase
$.components.schemas[*].properties[*]~
warn
security-schemes-defined
Security schemes should be defined in components
$.components.securitySchemes
warn
security-global-defined
Global security should be defined at the spec level
$.security
warn
delete-no-request-body
DELETE operations should not have a request body
$.paths[*].delete
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
error
no-empty-descriptions
Descriptions must not be empty strings
$..description
info
external-docs-encouraged
API spec should include externalDocs pointing to documentation
$.externalDocs

Spectral Ruleset

Raw ↑
rules:
  # ============================================================
  # INFO / METADATA
  # ============================================================
  info-title-required:
    description: API title must be present and start with "UiPath"
    severity: error
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: "^UiPath"

  info-description-required:
    description: API info must have a description with at least 50 characters
    severity: error
    given: $.info.description
    then:
      function: length
      functionOptions:
        min: 50

  info-version-required:
    description: API info must include a version
    severity: error
    given: $.info.version
    then:
      function: truthy

  info-contact-url:
    description: API contact should include a URL
    severity: warn
    given: $.info.contact.url
    then:
      function: truthy

  info-terms-of-service:
    description: API should reference UiPath terms of service
    severity: warn
    given: $.info.termsOfService
    then:
      function: truthy

  # ============================================================
  # OPENAPI VERSION
  # ============================================================
  openapi-version:
    description: OpenAPI version must be 3.0.x or 3.1.x
    severity: error
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: "^3\\.(0|1)\\."

  # ============================================================
  # SERVERS
  # ============================================================
  servers-defined:
    description: At least one server must be defined
    severity: error
    given: $.servers
    then:
      function: length
      functionOptions:
        min: 1

  servers-https:
    description: All server URLs must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  servers-description:
    description: Each server should have a description
    severity: warn
    given: $.servers[*].description
    then:
      function: truthy

  # ============================================================
  # PATHS — NAMING CONVENTIONS
  # ============================================================
  paths-kebab-case:
    description: Path segments must use kebab-case (no underscores or camelCase)
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: "_[a-z]|[a-z][A-Z]"

  paths-no-trailing-slash:
    description: Paths must not have a trailing slash
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: "\\/$"

  paths-no-query-string:
    description: Paths must not contain query strings
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: "\\?"

  # ============================================================
  # OPERATIONS
  # ============================================================
  operation-operationId-required:
    description: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: operationId
      function: truthy

  operation-operationId-camelCase:
    description: OperationId must use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  operation-summary-required:
    description: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: summary
      function: truthy

  operation-summary-uipath-prefix:
    description: Operation summary must start with "UiPath"
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: "^UiPath"

  operation-description-required:
    description: Every operation must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: description
      function: truthy

  operation-tags-required:
    description: Every operation must have at least one tag
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy

  operation-operationId-verb-prefix:
    description: OperationId should start with a standard verb (list, get, create, update, delete, add, remove, search, run, upload)
    severity: info
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: "^(list|get|create|update|delete|add|remove|search|run|upload|submit|validate|execute|process|start|stop|cancel|manage)"

  # ============================================================
  # TAGS
  # ============================================================
  tags-global-defined:
    description: Global tags array should be defined
    severity: warn
    given: $.tags
    then:
      function: truthy

  tags-description:
    description: All tags should have descriptions
    severity: warn
    given: $.tags[*].description
    then:
      function: truthy

  # ============================================================
  # PARAMETERS
  # ============================================================
  parameter-description-required:
    description: Every parameter must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy

  parameter-schema-type:
    description: Every parameter schema must have a type defined
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[*].schema
    then:
      field: type
      function: truthy

  parameter-pagination-pageSize:
    description: Pagination size parameter should be named 'pageSize' (not 'limit' or 'size')
    severity: info
    given: $.paths[*][get].parameters[*]
    then:
      function: pattern
      functionOptions:
        notMatch: "^(limit|page_size|size)$"

  parameter-no-api-key-in-query:
    description: API keys should be passed in headers, not query parameters
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.name == 'api_key' || @.name == 'apiKey' || @.name == 'access_token')]
    then:
      field: in
      function: pattern
      functionOptions:
        notMatch: "^query$"

  # ============================================================
  # REQUEST BODIES
  # ============================================================
  request-body-json-content:
    description: Request body should include application/json content type
    severity: warn
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      field: application/json
      function: truthy

  request-body-description:
    description: Request body should have a description
    severity: info
    given: $.paths[*][post,put,patch].requestBody
    then:
      field: description
      function: truthy

  # ============================================================
  # RESPONSES
  # ============================================================
  response-success-required:
    description: Every operation must define at least one 2xx response
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ['200']
            - required: ['201']
            - required: ['202']
            - required: ['204']

  response-error-401:
    description: Operations should define a 401 Unauthorized response
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy

  response-error-400:
    description: Operations with request bodies should define a 400 Bad Request response
    severity: warn
    given: $.paths[*][post,put,patch].responses
    then:
      field: '400'
      function: truthy

  response-description-required:
    description: Every response must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy

  # ============================================================
  # SCHEMAS — PROPERTY NAMING
  # ============================================================
  schema-description:
    description: Top-level schemas should have a description
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy

  schema-type-defined:
    description: Schema properties should have a type defined
    severity: warn
    given: $.components.schemas[*].properties[*]
    then:
      field: type
      function: truthy

  schema-property-camelCase:
    description: Schema property names should use camelCase
    severity: info
    given: $.components.schemas[*].properties[*]~
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  # ============================================================
  # SECURITY
  # ============================================================
  security-schemes-defined:
    description: Security schemes should be defined in components
    severity: warn
    given: $.components.securitySchemes
    then:
      function: truthy

  security-global-defined:
    description: Global security should be defined at the spec level
    severity: warn
    given: $.security
    then:
      function: truthy

  # ============================================================
  # HTTP METHOD CONVENTIONS
  # ============================================================
  delete-no-request-body:
    description: DELETE operations should not have a request body
    severity: warn
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy

  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy

  # ============================================================
  # GENERAL QUALITY
  # ============================================================
  no-empty-descriptions:
    description: Descriptions must not be empty strings
    severity: error
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: ".+"

  external-docs-encouraged:
    description: API spec should include externalDocs pointing to documentation
    severity: info
    given: $.externalDocs
    then:
      function: truthy