HR Partner · API Governance Rules

HR Partner API Rules

Spectral linting rules defining API design standards and conventions for HR Partner.

HR Partner API Rules is a Spectral governance ruleset published by HR Partner on the APIs.io network, containing 18 lint rules.

The ruleset includes 14 error-severity rules and 4 warning-severity rules.

Tagged areas include HR, HRIS, Human Resources, Employee Records, and Leave Management.

Rulesets can be applied to your own OpenAPI specs via Spectral to enforce the same governance standards.

18 Rules error 14 warn 4
View Rules File View on GitHub

Rule Categories

employee info no operation path response schema security servers tag

Rules

error
info-title-required
Info title must be present
$.info
error
info-description-required
Info description must be present
$.info
error
info-contact-required
Info contact must be present
$.info
error
operation-operationid-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
error
operation-description-required
Every operation must have a description
$.paths[*][get,post,put,patch,delete]
error
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-title-case
Operation summaries must be Title Case
$.paths[*][get,post,put,patch,delete].summary
error
response-description-required
Every response must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-200-required
Every operation should declare a 200 response
$.paths[*][get,post]
error
servers-defined
At least one server must be defined
$
error
servers-base-url-hr-partner
Production server must point at api.hrpartner.io
$.servers[0]
error
security-apikey-header
API must declare the x-api-key apiKey header security scheme
$.components.securitySchemes
error
no-empty-descriptions
Descriptions must not be empty
$..description
error
schema-types-required
All schemas must declare a type
$.components.schemas[*]
error
tag-description-required
All top-level tags must have a description
$.tags[*]
warn
path-kebab-or-lower-case
Paths should be lowercase and may use hyphens
$.paths[*]~
warn
employee-code-path-param
Employee-scoped paths must use employeeCode path parameter, not id
$.paths[/employee/{employeeCode}]

Spectral Ruleset

Raw ↑
rules:
  info-title-required:
    description: Info title must be present
    severity: error
    given: $.info
    then: {field: title, function: truthy}
  info-description-required:
    description: Info description must be present
    severity: error
    given: $.info
    then: {field: description, function: truthy}
  info-contact-required:
    description: Info contact must be present
    severity: error
    given: $.info
    then: {field: contact, function: truthy}
  operation-operationid-required:
    description: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then: {field: operationId, 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-description-required:
    description: Every operation must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then: {field: description, function: truthy}
  operation-tags-required:
    description: Every operation must have at least one tag
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then: {field: tags, function: truthy}
  operation-summary-title-case:
    description: Operation summaries must be Title Case
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^([A-Z][a-z0-9]*)( [A-Z][a-z0-9]*)*$'
  response-description-required:
    description: Every response must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then: {field: description, function: truthy}
  response-200-required:
    description: Every operation should declare a 200 response
    severity: warn
    given: $.paths[*][get,post]
    then:
      field: responses.200
      function: truthy
  servers-defined:
    description: At least one server must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-base-url-hr-partner:
    description: Production server must point at api.hrpartner.io
    severity: error
    given: $.servers[0]
    then:
      field: url
      function: pattern
      functionOptions:
        match: '^https://api\.hrpartner\.io'
  security-apikey-header:
    description: API must declare the x-api-key apiKey header security scheme
    severity: error
    given: $.components.securitySchemes
    then:
      field: apiKeyHeader
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty
    severity: error
    given: $..description
    then: {function: truthy}
  schema-types-required:
    description: All schemas must declare a type
    severity: error
    given: $.components.schemas[*]
    then: {field: type, function: truthy}
  tag-description-required:
    description: All top-level tags must have a description
    severity: error
    given: $.tags[*]
    then: {field: description, function: truthy}
  path-kebab-or-lower-case:
    description: Paths should be lowercase and may use hyphens
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: '^/[a-z0-9\-/{}]+$'
  employee-code-path-param:
    description: Employee-scoped paths must use employeeCode path parameter, not id
    severity: warn
    given: $.paths[/employee/{employeeCode}]
    then:
      function: truthy