Jefferson Health · API Governance Rules

Jefferson Health API Rules

Spectral linting rules defining API design standards and conventions for Jefferson Health.

8 Rules error 5 warn 3
View Rules File View on GitHub

Rule Categories

jefferson

Rules

error
jefferson-fhir-r4-base-url
Server URL must be the canonical Jefferson Health FHIR R4 endpoint.
$.servers[*].url
error
jefferson-fhir-r4-fhir-version-tag
API version must report FHIR R4 (4.0.1).
$.info.version
warn
jefferson-fhir-r4-fhir-media-type
All FHIR responses must use the application/fhir+json media type.
$.paths[*][*].responses[*].content
warn
jefferson-fhir-r4-summary-title-case
Operation summaries must use Title Case.
$.paths[*][*].summary
error
jefferson-fhir-r4-smart-on-fhir-security
API must declare SMART on FHIR / OAuth 2.0 security.
$.components.securitySchemes
error
jefferson-fhir-r4-smart-authorization-url
Authorization URL must be Jefferson's OAuth 2.0 authorize endpoint.
$.components.securitySchemes.smartOnFhir.flows.authorizationCode.authorizationUrl
error
jefferson-fhir-r4-smart-token-url
Token URL must be Jefferson's OAuth 2.0 token endpoint.
$.components.securitySchemes.smartOnFhir.flows.authorizationCode.tokenUrl
warn
jefferson-fhir-r4-uscdi-resources
API should document core USCDI FHIR resources (Patient, Observation, Condition, Encounter, MedicationRequest, AllergyIntolerance, DocumentReference).
$.paths

Spectral Ruleset

Raw ↑
extends:
- spectral:oas
rules:
  jefferson-fhir-r4-base-url:
    description: Server URL must be the canonical Jefferson Health FHIR R4 endpoint.
    message: Server URL should match https://fhir.jefferson.edu/FHIRProxy/api/FHIR/R4
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: '^https://fhir\.jefferson\.edu/FHIRProxy/api/FHIR/R4$'

  jefferson-fhir-r4-fhir-version-tag:
    description: API version must report FHIR R4 (4.0.1).
    message: FHIR version must be 4.0.1.
    severity: error
    given: $.info.version
    then:
      function: pattern
      functionOptions:
        match: '^4\.0\.1$'

  jefferson-fhir-r4-fhir-media-type:
    description: All FHIR responses must use the application/fhir+json media type.
    message: Use application/fhir+json for FHIR responses.
    severity: warn
    given: $.paths[*][*].responses[*].content
    then:
      function: truthy
      field: application/fhir+json

  jefferson-fhir-r4-summary-title-case:
    description: Operation summaries must use Title Case.
    message: Operation summary should be 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]*)*$'

  jefferson-fhir-r4-smart-on-fhir-security:
    description: API must declare SMART on FHIR / OAuth 2.0 security.
    message: smartOnFhir security scheme is required.
    severity: error
    given: $.components.securitySchemes
    then:
      field: smartOnFhir
      function: truthy

  jefferson-fhir-r4-smart-authorization-url:
    description: Authorization URL must be Jefferson's OAuth 2.0 authorize endpoint.
    message: Use https://fhir.jefferson.edu/FHIRProxy/oauth2/authorize as authorizationUrl.
    severity: error
    given: $.components.securitySchemes.smartOnFhir.flows.authorizationCode.authorizationUrl
    then:
      function: pattern
      functionOptions:
        match: '^https://fhir\.jefferson\.edu/FHIRProxy/oauth2/authorize$'

  jefferson-fhir-r4-smart-token-url:
    description: Token URL must be Jefferson's OAuth 2.0 token endpoint.
    message: Use https://fhir.jefferson.edu/FHIRProxy/oauth2/token as tokenUrl.
    severity: error
    given: $.components.securitySchemes.smartOnFhir.flows.authorizationCode.tokenUrl
    then:
      function: pattern
      functionOptions:
        match: '^https://fhir\.jefferson\.edu/FHIRProxy/oauth2/token$'

  jefferson-fhir-r4-uscdi-resources:
    description: API should document core USCDI FHIR resources (Patient, Observation, Condition, Encounter, MedicationRequest, AllergyIntolerance, DocumentReference).
    message: Document the USCDI core resource paths.
    severity: warn
    given: $.paths
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required:
          - /Patient
          - /Observation
          - /Condition
          - /Encounter
          - /MedicationRequest
          - /AllergyIntolerance
          - /DocumentReference