Web of Science APIs · API Governance Rules

Web of Science APIs API Rules

Spectral linting rules defining API design standards and conventions for Web of Science APIs.

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

Rule Categories

wos

Rules

error
wos-openapi-version
Web of Science API specs must use OpenAPI 3.0.x
$
error
wos-info-title
API must have a title
$.info
warn
wos-info-description
API must have a description
$.info
error
wos-info-version
API must have a version
$.info
warn
wos-operation-summary
All operations must have a summary
$.paths[*][get,post,put,delete,patch]
info
wos-operation-description
All operations should have a description
$.paths[*][get,post,put,delete,patch]
error
wos-operation-operationid
All operations must have an operationId
$.paths[*][get,post,put,delete,patch]
warn
wos-operation-tags
All operations must have tags
$.paths[*][get,post,put,delete,patch]
error
wos-operation-responses
All operations must have responses defined
$.paths[*][get,post,put,delete,patch]
error
wos-response-200
GET operations must have a 200 response
$.paths[*][get]
warn
wos-response-401
All operations should have a 401 response
$.paths[*][get,post,put,delete,patch]
info
wos-schema-properties-description
Schema properties should have descriptions
$.components.schemas[*].properties[*]
warn
wos-parameter-description
Parameters should have descriptions
$.paths[*][get,post,put,delete,patch].parameters[*]
error
wos-apikey-security
API must define API key security scheme
$.components.securitySchemes
warn
wos-security-defined
API must have global security defined
$
info
wos-operation-tags-valid
Operations should use valid Web of Science tags
$.paths[*][get,post].tags[*]
error
wos-servers-defined
API must define servers
$
info
wos-pagination-limit
Search operations should support limit/count parameter
$.paths.~1documents[get]
info
wos-microcks-operation
Operations should have Microcks extensions for testing
$.paths[*][get,post,put,delete,patch]
warn
wos-search-query-parameter
Search endpoints should have query parameter
$.paths.~1documents[get].parameters[*]
info
wos-uid-format
UID parameters should describe Web of Science identifier format
$.paths[*][get].parameters[?(@.name == 'uniqueId')]
info
wos-info-contact
API info should include contact details
$.info

Spectral Ruleset

Raw ↑
rules:
  wos-openapi-version:
    description: Web of Science 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\\."

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

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

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

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

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

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

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

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

  wos-response-200:
    description: GET operations must have a 200 response
    message: "GET operations must define a 200 response"
    severity: error
    given: "$.paths[*][get]"
    then:
      field: responses.200
      function: truthy

  wos-response-401:
    description: All operations should have a 401 response
    message: "Operations should define a 401 Unauthorized response"
    severity: warn
    given: "$.paths[*][get,post,put,delete,patch]"
    then:
      field: responses.401
      function: truthy

  wos-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

  wos-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

  wos-apikey-security:
    description: API must define API key security scheme
    message: "API must require API key authentication"
    severity: error
    given: "$.components.securitySchemes"
    then:
      field: ApiKeyAuth
      function: truthy

  wos-security-defined:
    description: API must have global security defined
    message: "API must have security defined at global level"
    severity: warn
    given: "$"
    then:
      field: security
      function: truthy

  wos-operation-tags-valid:
    description: Operations should use valid Web of Science tags
    message: "Operations should use standard WOS API tags"
    severity: info
    given: "$.paths[*][get,post].tags[*]"
    then:
      function: enumeration
      functionOptions:
        values:
          - documents
          - journals
          - search
          - records
          - citations
          - reports

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

  wos-pagination-limit:
    description: Search operations should support limit/count parameter
    message: "Search/list operations should support pagination limit parameter"
    severity: info
    given: "$.paths.~1documents[get]"
    then:
      function: schema
      functionOptions:
        schema:
          required: [parameters]

  wos-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

  wos-search-query-parameter:
    description: Search endpoints should have query parameter
    message: "Search operations must have a query parameter"
    severity: warn
    given: "$.paths.~1documents[get].parameters[*]"
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            name:
              type: string
          required: [name]

  wos-uid-format:
    description: UID parameters should describe Web of Science identifier format
    message: "UID parameters should describe WOS unique identifier format"
    severity: info
    given: "$.paths[*][get].parameters[?(@.name == 'uniqueId')]"
    then:
      field: description
      function: truthy

  wos-info-contact:
    description: API info should include contact details
    message: "Info object should have contact information"
    severity: info
    given: "$.info"
    then:
      field: contact
      function: truthy