Schema Registry Artifacts
The items stored in the Schema Registry are known as registry artifacts. The code sample below shows an example of an Apache Avro artifact in JSON format that defines an Avro record schema for a simple share price application:
{ "type": "record", "name": "price", "namespace": "com.example", "fields": [ { "name": "symbol", "type": "string" }, { "name": "price", "type": "string" } ] }
When a schema is added to the Schema Registry, client applications can then use that schema to validate that the client messages conform to the correct data structure at runtime.
The following sections provide overview information about:
For detailed information about supported artifact types, the possible states for artifact versions, and the list of metadata, see the Solace Schema Registry Artifact Reference.
For information about managing the content of the Schema Registry, see Using Solace Schema Registry Web Console and Solace Schema Registry REST API documentation.
Artifact Metadata
Artifacts have metadata, both generated and editable. Standard metadata for an artifact includes (but may not be limited to):
- Generated or immutable properties:
-
- groupId
- artifactId
- artifactType
- createdOn
- modifiedBy
- modifiedOn
- Editable Properties:
-
- name
- description
- labels
- owner
Artifact Versions
Every artifact is composed of zero or more artifact versions. Only artifact versions have actual content (as well as metadata). These versions represent the evolution of the content of an artifact, and are immutable. An artifact is an ordered sequence of versions, typically with the most recent version representing the "current" schema content.
Artifact versions have metadata, both generated and editable. Standard metadata for an artifact version includes (but may not be limited to):
- Generated or immutable properties
-
- groupId
- artifactId
- version
- globalId
- contentId
- owner
- createdOn
- modifiedBy
- modifiedOn
- Editable Properties
-
- name
- description
- labels
- state
Artifact Groups
An artifact group is an optional named collection of schemas. Each group contains a logically related set of schemas, typically managed by a single entity, belonging to a particular application or organization.
You can create optional artifact groups when adding your schemas to organize them in the Schema Registry. For example, you could create groups to match your development
and production
application environments, or your sales
and engineering
organizations.
Schema groups can contain multiple artifact types. For example, you could have Avro and JSON Schema artifacts in the same group.
Groups have metadata, both generated and editable. Standard metadata for a group includes (but may not be limited to):
- Generated Or Immutable Properties
-
- groupId
- owner
- createdOn
- modifiedBy
- modifiedOn
- Editable Properties
-
- description
- labels
You can create artifacts and groups using the Schema Registry web console and REST API.
Specifying a group is optional when using the Schema Registry web console, and the default
group is used automatically. If you are using the REST API, specify the default
group in the API path if you do not want to create a unique group.
References to Other Artifacts
Artifacts can include artifact references from one artifact file to another. You can create efficiencies by defining reusable schema components, and then referencing them from multiple locations. For example, you can specify a reference in JSON Schema using a $ref
statement or in Apache Avro using a nested namespace.
The following example shows a simple Avro schema named TradeKey
that includes a reference to another schema named Exchange
using a nested namespace:
{ "namespace": "com.corporate.schema.trade", "type": "record", "name": "TradeKey", "fields": [ { "name": "exchange", "type": "com.corporate.schema.common.Exchange" }, { "name": "key", "type": "string" } ] }
The schema below is the referenced Exchange
schema:
{ "namespace": "com.corporate.schema.common", "type": "enum", "name": "Exchange", "symbols" : ["GEMINI"] }
An artifact reference is stored in the Schema Registry as a collection of artifact metadata that maps from an artifact type-specific reference to an internal Schema Registry reference. Each artifact reference in the Schema Registry is composed of the following:
- Group ID
- Artifact ID
- Artifact version
- Artifact reference name
You can manage artifact references using the Schema Registry REST API and the serializer/deserializer . The Schema Registry stores the artifact references along with the artifact content. The Schema Registry also maintains a collection of all artifact references so you can search them or list all references for a specific artifact.
The Schema Registry currently supports artifact references for the following artifact types only:
- Avro
- JSON Schema