Apache Jena · API Governance Rules

Apache Jena API Rules

Spectral linting rules defining API design standards and conventions for Apache Jena.

15 Rules error 8 warn 4 info 3
View Rules File View on GitHub

Rule Categories

info no openapi operation parameter paths response schema servers sparql

Rules

warn
info-title-prefix
Info title should start with Apache Jena
$.info
error
info-version-required
Info must have a version
$.info
error
openapi-version
Must use OpenAPI 3.x
$
error
servers-defined
Servers must be defined
$
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
error
operation-id-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
error
operation-tags-required
Every operation must have tags
$.paths[*][get,post,put,patch,delete]
error
response-description-required
Responses must have descriptions
$.paths[*][get,post,put,patch,delete].responses[*]
error
response-2xx-required
Every operation must have a 2xx response
$.paths[*][get,post,put,patch,delete].responses
warn
response-400-sparql
SPARQL endpoints should document 400 for invalid queries
$.paths[*].post.responses
info
sparql-media-types
SPARQL query endpoints should support sparql-results+json
$.paths[*].get.responses.200.content
warn
no-empty-descriptions
Descriptions must not be empty
$..description
info
schema-description-required
Component schemas should have descriptions
$.components.schemas[*]
warn
parameter-description-required
Parameters should have descriptions
$.paths[*][get,post].parameters[*]
info
paths-no-trailing-slash
Paths must not have trailing slashes
$.paths

Spectral Ruleset

Raw ↑
rules:
  info-title-prefix:
    description: Info title should start with Apache Jena
    severity: warn
    given: "$.info"
    then:
      field: title
      function: pattern
      functionOptions:
        match: "^Apache Jena"

  info-version-required:
    description: Info must have a version
    severity: error
    given: "$.info"
    then:
      field: version
      function: truthy

  openapi-version:
    description: Must use OpenAPI 3.x
    severity: error
    given: "$"
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: "^3\\."

  servers-defined:
    description: Servers must be defined
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  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-id-required:
    description: Every operation must have an operationId
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

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

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

  response-2xx-required:
    description: Every operation must have a 2xx response
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].responses"
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ["200"]
            - required: ["201"]
            - required: ["204"]

  response-400-sparql:
    description: SPARQL endpoints should document 400 for invalid queries
    severity: warn
    given: "$.paths[*].post.responses"
    then:
      field: "400"
      function: truthy

  sparql-media-types:
    description: SPARQL query endpoints should support sparql-results+json
    severity: info
    given: "$.paths[*].get.responses.200.content"
    then:
      field: "application/sparql-results+json"
      function: truthy

  no-empty-descriptions:
    description: Descriptions must not be empty
    severity: warn
    given: "$..description"
    then:
      function: pattern
      functionOptions:
        match: ".+"

  schema-description-required:
    description: Component schemas should have descriptions
    severity: info
    given: "$.components.schemas[*]"
    then:
      field: description
      function: truthy

  parameter-description-required:
    description: Parameters should have descriptions
    severity: warn
    given: "$.paths[*][get,post].parameters[*]"
    then:
      field: description
      function: truthy

  paths-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: info
    given: "$.paths"
    then:
      field: "@key"
      function: pattern
      functionOptions:
        notMatch: "\\/$"