Agromonitoring · API Governance Rules

Agromonitoring API Rules

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

20 Rules error 10 warn 10
View Rules File View on GitHub

Rule Categories

agromonitoring

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

Spectral Ruleset

Raw ↑
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/{}_-]+$"