Agromonitoring · API Governance Rules

Agromonitoring API Rules

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

27 Rules error 11 warn 16
View Rules File View on GitHub

Rule Categories

agromonitoring error no query schema servers

Rules

warn
agromonitoring-operation-summary-title-case
Operation summaries must use Title Case
$.paths[*][*].summary
warn
agromonitoring-operation-summary-prefix
Operation summaries should start with a verb
$.paths[*][*].summary
error
agromonitoring-operationid-camelcase
OperationId must use camelCase
$.paths[*][*].operationId
error
agromonitoring-appid-query-required
All operations must require the appid query parameter for authentication
$.paths[*][get,post,put,delete,patch]
error
agromonitoring-response-200-defined
All operations must define a 200 response
$.paths[*][*].responses
warn
agromonitoring-response-400-defined
All operations should define a 400 error response
$.paths[*][*].responses
warn
agromonitoring-response-401-defined
All operations should define a 401 unauthorized response
$.paths[*][*].responses
warn
agromonitoring-schema-ref-components
Response schemas should use $ref to components/schemas
$.paths[*][*].responses[*].content[*].schema
warn
agromonitoring-info-contact
API info must include contact details
$.info
error
agromonitoring-info-version
API info must include version
$.info
warn
agromonitoring-tags-defined
All operations must have at least one tag
$.paths[*][*]
warn
agromonitoring-property-snake-case
Schema properties should use snake_case
$.components.schemas[*].properties
error
agromonitoring-polygon-id-field
Polygon schema must include an id field
$.components.schemas.Polygon.properties
error
agromonitoring-geo-json-coordinates
GeoJson schema must include coordinates field
$.components.schemas.GeoJson.properties
warn
agromonitoring-ndvi-value-range
NDVI values should include minimum/maximum bounds
$.components.schemas.NdviRecord.properties.ndvi
error
agromonitoring-weather-temp-field
WeatherData schema must include temp field
$.components.schemas.WeatherData.properties
error
agromonitoring-soil-moisture-field
SoilData schema must include moisture field
$.components.schemas.SoilData.properties
error
agromonitoring-server-url-defined
API must define at least one server URL
$.servers
error
agromonitoring-security-scheme-apikey
API must define an API key security scheme
$.components.securitySchemes
warn
agromonitoring-path-lowercase
Path segments should use lowercase
$.paths
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
servers-expected-domain
Server URLs should be on the agromonitoring.com domain.
$.servers[*].url
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
error-schema-defined
A shared error schema (ErrorResponse) should be defined for error payloads.
$.components.schemas
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# agromonitoring — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on agromonitoring.com
#   - query-params-casing: snake @ 100% (n=26)
#   - operationid-casing: camel @ 100% (n=10)
#   - schema-names-casing: pascal @ 100% (n=11)
#   - schema-properties-casing: snake @ 100% (n=45)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: ErrorResponse
#   - operation-documents-401: 80% adherence
#   - merge: kept 20 existing, added 7 measured, upgraded 0
#   - added: servers-https-only, servers-expected-domain, query-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  agromonitoring-operation-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 ]+$
  agromonitoring-operation-summary-prefix:
    description: Operation summaries should start with a verb
    severity: warn
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: ^(List|Get|Create|Update|Delete|Search|Post|Put|Patch|Fetch)
  agromonitoring-operationid-camelcase:
    description: OperationId must use camelCase
    severity: error
    given: $.paths[*][*].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]+$
  agromonitoring-appid-query-required:
    description: All operations must require the appid query parameter for authentication
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      function: truthy
  agromonitoring-response-200-defined:
    description: All operations must define a 200 response
    severity: error
    given: $.paths[*][*].responses
    then:
      field: '200'
      function: defined
  agromonitoring-response-400-defined:
    description: All operations should define a 400 error response
    severity: warn
    given: $.paths[*][*].responses
    then:
      field: '400'
      function: defined
  agromonitoring-response-401-defined:
    description: All operations should define a 401 unauthorized response
    severity: warn
    given: $.paths[*][*].responses
    then:
      field: '401'
      function: defined
  agromonitoring-schema-ref-components:
    description: Response schemas should use $ref to components/schemas
    severity: warn
    given: $.paths[*][*].responses[*].content[*].schema
    then:
      function: schema
      functionOptions:
        schema:
          oneOf:
          - required:
            - $ref
          - required:
            - type
  agromonitoring-info-contact:
    description: API info must include contact details
    severity: warn
    given: $.info
    then:
      field: contact
      function: defined
  agromonitoring-info-version:
    description: API info must include version
    severity: error
    given: $.info
    then:
      field: version
      function: defined
  agromonitoring-tags-defined:
    description: All operations must have at least one tag
    severity: warn
    given: $.paths[*][*]
    then:
      field: tags
      function: defined
  agromonitoring-property-snake-case:
    description: Schema properties should use snake_case
    severity: warn
    given: $.components.schemas[*].properties
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  agromonitoring-polygon-id-field:
    description: Polygon schema must include an id field
    severity: error
    given: $.components.schemas.Polygon.properties
    then:
      field: id
      function: defined
  agromonitoring-geo-json-coordinates:
    description: GeoJson schema must include coordinates field
    severity: error
    given: $.components.schemas.GeoJson.properties
    then:
      field: coordinates
      function: defined
  agromonitoring-ndvi-value-range:
    description: NDVI values should include minimum/maximum bounds
    severity: warn
    given: $.components.schemas.NdviRecord.properties.ndvi
    then:
      function: truthy
  agromonitoring-weather-temp-field:
    description: WeatherData schema must include temp field
    severity: error
    given: $.components.schemas.WeatherData.properties
    then:
      field: temp
      function: defined
  agromonitoring-soil-moisture-field:
    description: SoilData schema must include moisture field
    severity: error
    given: $.components.schemas.SoilData.properties
    then:
      field: moisture
      function: defined
  agromonitoring-server-url-defined:
    description: API must define at least one server URL
    severity: error
    given: $.servers
    then:
      function: length
      functionOptions:
        min: 1
  agromonitoring-security-scheme-apikey:
    description: API must define an API key security scheme
    severity: error
    given: $.components.securitySchemes
    then:
      function: defined
  agromonitoring-path-lowercase:
    description: Path segments should use lowercase
    severity: warn
    given: $.paths
    then:
      function: pattern
      functionOptions:
        match: ^/[a-z0-9/{}_-]+$
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-expected-domain:
    description: Server URLs should be on the agromonitoring.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: agromonitoring\.com
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  error-schema-defined:
    description: A shared error schema (ErrorResponse) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: ErrorResponse
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy