arXiv · API Governance Rules

arXiv API Rules

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

7 Rules error 4 warn 3
View Rules File View on GitHub

Rule Categories

arxiv

Rules

error
arxiv-info-contact
arXiv specs must declare an info.contact pointing to [email protected].
$.info
error
arxiv-info-license
arXiv specs must point at the API Terms of Use as their license link.
$.info.license
error
arxiv-server-https
arXiv servers must be HTTPS (export.arxiv.org or oaipmh.arxiv.org).
$.servers[*].url
warn
arxiv-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
error
arxiv-operation-id-required
Every operation must declare an operationId.
$.paths[*][get,post,put,patch,delete]
warn
arxiv-atom-response
Query API responses should advertise application/atom+xml or text/xml content.
$.paths[*][*].responses[*].content
warn
arxiv-tag-title-case
Tags must use Title Case.
$.tags[*].name

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
  - spectral:asyncapi
documentationUrl: https://info.arxiv.org/help/api/user-manual.html
functions: []
rules:
  arxiv-info-contact:
    description: arXiv specs must declare an info.contact pointing to [email protected].
    severity: error
    given: $.info
    then:
      - field: contact
        function: truthy
      - field: contact.url
        function: truthy
  arxiv-info-license:
    description: arXiv specs must point at the API Terms of Use as their license link.
    severity: error
    given: $.info.license
    then:
      - field: name
        function: truthy
      - field: url
        function: pattern
        functionOptions:
          match: "info\\.arxiv\\.org\\/help\\/api\\/tou"
  arxiv-server-https:
    description: arXiv servers must be HTTPS (export.arxiv.org or oaipmh.arxiv.org).
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https:\\/\\/(export|oaipmh)\\.arxiv\\.org"
  arxiv-summary-title-case:
    description: All operation summaries must use Title Case.
    severity: warn
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9]*(\\s[A-Za-z0-9\\-:]+)*$"
  arxiv-operation-id-required:
    description: Every operation must declare an operationId.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  arxiv-atom-response:
    description: Query API responses should advertise application/atom+xml or text/xml content.
    severity: warn
    given: $.paths[*][*].responses[*].content
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ["application/atom+xml"]
            - required: ["text/xml"]
  arxiv-tag-title-case:
    description: Tags must use Title Case.
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][A-Za-z0-9\\-]*(\\s[A-Z][A-Za-z0-9\\-]*)*$|^OAI-PMH$"