1Password · API Governance Rules

1Password API Rules

Spectral linting rules defining API design standards and conventions for 1Password.

6 Rules warn 5 info 1
View Rules File View on GitHub

Rule Categories

defs no property schema

Rules

warn
schema-declares-$schema
Every JSON Schema document should declare its $schema (draft).
$
warn
schema-draft-consistency
$schema should reference the 2020-12 draft (this API's convention).
$.$schema
info
schema-has-title
JSON Schema documents should declare a title.
$
warn
property-name-casing
Schema properties should be snake_case (the dominant convention in this API).
$..properties
warn
defs-name-casing
Schema $defs names should be PascalCase (the dominant convention in this API).
$..$defs
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# 1password — JSON Schema Spectral ruleset (strengthened)
# Plain Spectral. Rules measured from this provider's own JSON Schema
# conventions by strengthen_jsonschema.py, then self-validated against them.
#
# Provenance:
#   - schema-declares-$schema: 29/29 roots
#   - schema-draft-consistency: 2020-12 @ 100%
#   - schema-has-title: 29/29 roots
#   - property-name-casing: snake @ 92% (n=223)
#   - def-name-casing: pascal @ 100% (n=11)
rules:
  schema-declares-$schema:
    description: Every JSON Schema document should declare its $schema (draft).
    severity: warn
    given: $
    then:
      field: $schema
      function: truthy
  schema-draft-consistency:
    description: $schema should reference the 2020-12 draft (this API's convention).
    severity: warn
    given: $.$schema
    then:
      function: pattern
      functionOptions:
        match: 2020\-12
  schema-has-title:
    description: JSON Schema documents should declare a title.
    severity: info
    given: $
    then:
      field: title
      function: truthy
  property-name-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: warn
    given: $..properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  defs-name-casing:
    description: Schema $defs names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $..$defs
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy