Jentic · API Governance Rules

Jentic API Rules

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

14 Rules error 9 warn 5
View Rules File View on GitHub

Rule Categories

jentic

Rules

error
jentic-info-title
API title must include "Jentic".
$.info.title
error
jentic-info-description-required
API info.description is required and must be substantive.
$.info
error
jentic-info-contact-required
API must have a contact entry pointing at Jentic Support.
$.info.contact
error
jentic-server-url-https
All server URLs must use HTTPS.
$.servers[*].url
warn
jentic-server-versioned-path
Production server path must include the /api/v1 prefix.
$.servers[?(@.description == 'Production')].url
error
jentic-operation-id-camel-case
operationId must be camelCase.
$.paths.*.*.operationId
warn
jentic-summary-title-case
Operation summaries must use Title Case.
$.paths.*.*.summary
error
jentic-description-required
Every operation must have a description.
$.paths.*.*
error
jentic-tags-required
Every operation must be tagged with at least one tag.
$.paths.*.*.tags
warn
jentic-tag-allowed-values
Operation tags must come from the canonical Jentic tag set.
$.paths.*.*.tags[*]
error
jentic-api-key-header
API key auth must use the X-JENTIC-API-KEY header.
$.components.securitySchemes.apiKeyAuth
warn
jentic-uuid-pattern
Operation/workflow UUID fields must enforce op_/wf_ prefix.
$.components.schemas..[?(@property === 'uuid')].pattern
warn
jentic-error-response-schema
4xx/5xx responses must reference ErrorResponse.
$.paths.*.*.responses[?(@property.match(/^[45]/))].content.application/json.schema
error
jentic-execution-type-enum
ExecutionRequest.execution_type must be enum operation|workflow.
$.components.schemas.ExecutionRequest.properties.execution_type.enum

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas

documentationUrl: https://docs.jentic.com/

functions: []

rules:
  jentic-info-title:
    description: API title must include "Jentic".
    severity: error
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: '(?i)jentic'

  jentic-info-description-required:
    description: API info.description is required and must be substantive.
    severity: error
    given: $.info
    then:
      field: description
      function: truthy

  jentic-info-contact-required:
    description: API must have a contact entry pointing at Jentic Support.
    severity: error
    given: $.info.contact
    then:
      - field: name
        function: truthy
      - field: url
        function: truthy

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

  jentic-server-versioned-path:
    description: Production server path must include the /api/v1 prefix.
    severity: warn
    given: $.servers[?(@.description == 'Production')].url
    then:
      function: pattern
      functionOptions:
        match: '/api/v1'

  jentic-operation-id-camel-case:
    description: operationId must be camelCase.
    severity: error
    given: $.paths.*.*.operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'

  jentic-summary-title-case:
    description: Operation summaries must use Title Case.
    severity: warn
    given: $.paths.*.*.summary
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][a-zA-Z0-9]*)(\s+([A-Z][a-zA-Z0-9]*|A|An|And|As|At|But|By|For|If|In|Of|On|Or|The|To|Up|Via))*$'

  jentic-description-required:
    description: Every operation must have a description.
    severity: error
    given: $.paths.*.*
    then:
      field: description
      function: truthy

  jentic-tags-required:
    description: Every operation must be tagged with at least one tag.
    severity: error
    given: $.paths.*.*.tags
    then:
      function: length
      functionOptions:
        min: 1

  jentic-tag-allowed-values:
    description: Operation tags must come from the canonical Jentic tag set.
    severity: warn
    given: $.paths.*.*.tags[*]
    then:
      function: enumeration
      functionOptions:
        values:
          - Authentication
          - Search
          - Execution

  jentic-api-key-header:
    description: API key auth must use the X-JENTIC-API-KEY header.
    severity: error
    given: $.components.securitySchemes.apiKeyAuth
    then:
      - field: type
        function: pattern
        functionOptions:
          match: '^apiKey$'
      - field: in
        function: pattern
        functionOptions:
          match: '^header$'
      - field: name
        function: pattern
        functionOptions:
          match: '^X-JENTIC-API-KEY$'

  jentic-uuid-pattern:
    description: Operation/workflow UUID fields must enforce op_/wf_ prefix.
    severity: warn
    given: $.components.schemas..[?(@property === 'uuid')].pattern
    then:
      function: pattern
      functionOptions:
        match: 'op_|wf_'

  jentic-error-response-schema:
    description: 4xx/5xx responses must reference ErrorResponse.
    severity: warn
    given: $.paths.*.*.responses[?(@property.match(/^[45]/))].content.application/json.schema
    then:
      field: $ref
      function: pattern
      functionOptions:
        match: 'ErrorResponse'

  jentic-execution-type-enum:
    description: ExecutionRequest.execution_type must be enum operation|workflow.
    severity: error
    given: $.components.schemas.ExecutionRequest.properties.execution_type.enum
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          items:
            type: string
            enum: [operation, workflow]
          minItems: 2
          maxItems: 2