registry check and rules - apigee/registry GitHub Wiki
registry check applies a set of rules to the registry to ensure the stored data is well-formed and appropriately populated. Rules can be grouped into sets and enabled or disabled. Configs can be read from yaml or json files. Rules are documented below.
Examples
List all rules.
registry check --list-rules --enable all
Run default and apihub checks on a specific api.
registry check --enable apihub apis/my-awesome-api
Rules
General Registry rules
These rules ensure proper API Registry data.
registry::0100::api-availability-single-word
Api availability:
- [info] should be a single word
registry::0101::api-recommended-version-ref
Api recommended_version:
- [ERROR] must be a valid ApiVersion name
- [ERROR] must be a child of this Api
- [ERROR] must exist in the registry
registry::0102::api-recommended-deployment-ref
Api recommended_deployment:
- [ERROR] must be a valid ApiDeployment name
- [ERROR] must be a child of this Api
- [ERROR] must exist in the registry
registry::0103::version-state-single-word
ApiVersion state:
- [info] should be a single word
registry::0104::version-primary-spec-ref
ApiVersion primary_spec:
- [ERROR] must be a valid ApiSpec name
- [ERROR] must be an API sibling of this Version
- [ERROR] must exist in the registry
registry::0105::apispec-sourceuri-format
ApiSpec source_uri:
- [ERROR] must be an absolute URI
registry::0106::deployment-api-spec-revision-ref
ApiDeployment api_spec_revision:
- [ERROR] must be a valid ApiSpecRevision name
- [ERROR] must include the revision ID
- [ERROR] must be an API sibling of this Deployment
- [ERROR] must exist in the registry
registry::0107::apideployment-endpoint-uri-format
ApiDeployment endpoint_uri:
- [ERROR] must be an absolute URI
registry::0108::apideployment-external-channel-uri-format
ApiDeployment external_channel_uri:
- [ERROR] must be an absolute URI
registry::0109::display-name-format
All display_name fields:
- [ERROR] must contain only UTF-8 characters
- [ERROR] must have a max length of 64 characters
registry::0110::description-format
All description fields:
- [ERROR] must contain only UTF-8 characters
- [ERROR] must have a max length of 5000 characters
registry::0111::mime-type-detected-contents
All mime_type fields:
- [ERROR] must not be empty
- [ERROR] must be a valid media type
- [WARN] should match detected type for contents
registry::0112::labels-format
Label set:
- [ERROR] must have a maximum of 64 labels
Label keys:
- [ERROR] must start with a lowercase unicode letter
- [ERROR] all characters must be a lowercase unicode letter, number, underscore, or dash
- [ERROR] must have a max length of 63 characters
Label values:
- [ERROR] all characters must be a lowercase unicode letter, number, underscore, or dash
- [ERROR] must have a max length of 63 characters
registry::0113::annotations-format
Annotation set:
- [ERROR] must have a max total size of 256k
Annotation keys:
- [ERROR] must start with a lowercase unicode letter
- [ERROR] all characters must be a lowercase unicode letter, number, underscore, or dash
- [ERROR] must have a max length of 63 characters
API Hub rules
These rules ensure proper API Hub operation.
apihub::1000::required-artifacts
[ERROR] Required Project Artifacts:
- apihub-lifecycle
- apihub-taxonomies
[ERROR] Required Taxonomies:
- apihub-target-users
- apihub-style
- apihub-team
- apihub-business-unit
- apihub-gateway
apihub::1001::taxonomy-labels
All entities: [ERROR] If entity contains a label key that matches a Taxonomy name, the value must match one of the Taxonomy Element's ID
apihub::1002::internal-mime-type-contents
All mime_type fields:
- [ERROR] internal types ("google.cloud.apigeeregistry." or "gnostic.metrics.") must map to a registered proto type
- [ERROR] contents must load into associated proto type
apihub::1003::version-state-lifecycle-stage
APIVersion state:
- [ERROR] must not be empty
- [ERROR] must match an entry in apihub-lifecycle project artifact