Upwork · API Governance Rules

Upwork API Rules

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

27 Rules error 13 warn 13 info 1
View Rules File View on GitHub

Rule Categories

error get info no openapi operation parameter path query response schema security servers

Rules

warn
info-title-upwork-prefix
API title must start with "Upwork"
$.info.title
error
info-description-required
API must have a description
$.info
error
info-version-required
API must define a version
$.info
error
openapi-version-3
Specs must use OpenAPI 3.x
$
error
servers-defined
API must define servers
$
error
servers-https-only
Server URLs must use HTTPS
$.servers[*].url
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-upwork-prefix
Summaries must start with "Upwork"
$.paths[*][get,post,put,patch,delete].summary
error
operation-id-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
operation-id-camel-case
operationId should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
error
operation-tags-required
Operations must have tags
$.paths[*][get,post,put,patch,delete]
warn
operation-description-required
Operations must have descriptions
$.paths[*][get,post,put,patch,delete]
warn
parameter-description-required
Parameters must have descriptions
$.paths[*][*].parameters[*]
error
response-success-required
Operations must have success responses
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-required
Authenticated operations should define 401
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
Responses must have descriptions
$.paths[*][*].responses[*]
warn
schema-description-required
Schemas should have descriptions
$.components.schemas[*]
warn
schema-type-defined
Schemas should define a type
$.components.schemas[*]
error
security-schemes-defined
Security schemes must be defined
$.components.securitySchemes
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
error
no-empty-descriptions
Descriptions must not be empty
$..description
warn
servers-expected-domain
Server URLs should be on the upwork.com domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (GraphQLError) should be defined for error payloads.
$.components.schemas

Spectral Ruleset

Raw ↑
# upwork — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 2/2 servers on upwork.com
#   - path-params-casing: snake @ 100% (n=6)
#   - query-params-casing: snake @ 92% (n=13)
#   - operationid-casing: camel @ 100% (n=13)
#   - schema-names-casing: pascal @ 100% (n=24)
#   - schema-properties-casing: snake @ 82% (n=89)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: GraphQLError
#   - merge: kept 21 existing, added 6 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined
extends:
  - spectral:oas
rules:
  info-title-upwork-prefix:
    description: API title must start with "Upwork"
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Upwork
  info-description-required:
    description: API must have a description
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: API must define a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  openapi-version-3:
    description: Specs must use OpenAPI 3.x
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  servers-defined:
    description: API must define servers
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    description: Server URLs must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  operation-summary-required:
    description: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  operation-summary-upwork-prefix:
    description: Summaries must start with "Upwork"
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^Upwork '
  operation-id-required:
    description: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  operation-id-camel-case:
    description: operationId should use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  operation-tags-required:
    description: Operations must have tags
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  operation-description-required:
    description: Operations must have descriptions
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  parameter-description-required:
    description: Parameters must have descriptions
    severity: warn
    given: $.paths[*][*].parameters[*]
    then:
      field: description
      function: truthy
  response-success-required:
    description: Operations must have success responses
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: truthy
  response-401-required:
    description: Authenticated operations should define 401
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  response-description-required:
    description: Responses must have descriptions
    severity: error
    given: $.paths[*][*].responses[*]
    then:
      field: description
      function: truthy
  schema-description-required:
    description: Schemas should have descriptions
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  schema-type-defined:
    description: Schemas should define a type
    severity: warn
    given: $.components.schemas[*]
    then:
      field: type
      function: truthy
  security-schemes-defined:
    description: Security schemes must be defined
    severity: error
    given: $.components.securitySchemes
    then:
      function: truthy
  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  no-empty-descriptions:
    description: Descriptions must not be empty
    severity: error
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: ^.{1,}
  servers-expected-domain:
    description: Server URLs should be on the upwork.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: upwork\.com
  path-params-casing:
    description: Path parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: snake
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  error-schema-defined:
    description: A shared error schema (GraphQLError) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: GraphQLError
      function: truthy