here.platform.schema.schema_registry module#

A registry for parsed protobuf schemas, so that they can be managed, cached, etc.

class here.platform.schema.schema_registry.SchemaRegistry(platform_config: PlatformConfig, artifact_api: ArtifactApi)[source]#

Bases: object

HERE platform schema registry.

get_schema(schema_hrn: str) Schema[source]#

Return the schema by the provided schema HRN identifier. The schema must be already available in the schema registry by registering it or by obtaining it and registering it.

Parameters:

schema_hrn – Schema HRN

Returns:

Schema instance for the given hrn

Raises:

ValueError – in case the requested schema is not available

has_schema(schema_hrn: str) bool[source]#

Check whether a given schema has already been registered.

Parameters:

schema_hrn – Schema HRN

Returns:

a bool flag indicating if schema is already registered.

load_and_register_schema(schema_file, schema_hrn, content_type: str | None = None) Schema[source]#

Register Schema object by given zip artifact and schema hrn .

Parameters:
  • schema_file – zip artifact

  • schema_hrn – Schema HRN

  • content_type – The MIME type of the blobs stored in the layer

Returns:

Schema instance for the given hrn

obtain_and_register_schema(schema_hrn: str, content_type: str | None = None) Schema[source]#

Obtain a schema from the Artifact service and register it in the schema registry. Return the registered schema. If the schema is already available, it’s simply returned.

Parameters:
  • schema_hrn – the HRN of the schema

  • content_type – The MIME type of the blobs stored in the layer

Returns:

the schema just obtained or already available

register_schema(schema_hrn: str, schema: Schema)[source]#

Register a new schema in the registry.

If a schema with the same HRN is present, it’s discarded. This does not upload the schema to the Artifact service.

Parameters:
  • schema_hrn – the HRN of the schema

  • schema – the schema to be registered