Class DataspecerBaseSchemaProviderAbstract

Abstract base class for providing schema-related functionalities in the Dataspecer application.

This class serves as a foundation for schema providers, offering methods to retrieve schema artifacts and handle schema files for specific aggregates. It interacts with a remote server to fetch the necessary data and processes it to extract schema information.

Hierarchy (View Summary)

Constructors

Properties

_api: default
_dataSpecificationIri: string

Methods

  • Retrieves schema files for the structure models defined within a data specification and navigates to the subdirectory which contains the schemas for a specified aggregate. Currently, the schemas are provided by Dataspecer backend service.

    Parameters

    • aggregate: AggregateMetadata

      The metadata for an aggregate for which the schemas should be retrieved.

    Returns Promise<JSZip>

    A promise that resolves to a JSZip object containing the schemas for the specified aggregate.

    Throws an error if the Dataspecer backend service response is not valid or if the requested schemas are missing in the zip archive.

  • This method attempts to retrieve a human-readable label for specified data specification which is represented by IRI.

    Parameters

    • dataSpecificationIri: string

      The IRI identifier of the data specification.

    Returns Promise<string>

    A promise that resolves as normalized directory name.

  • Retrieves the schema artifact for a given aggregate.

    Parameters

    • aggregate: AggregateMetadata

      The metadata for an aggregate for which the schemas should be retrieved.

    Returns Promise<LayerArtifact>

    A promise that resolves to the layer artifact file describing the schema of the aggregate. The schema is format-specific and is defined within the configuration.

    Throw an error if no corresponding schemas is found for the given aggregate or if multiple schema files are found.

  • Generates a layer artifact which contains the data schema for the specified aggregate. The classes which implement this method generate a format-specific schema artifacts.

    Parameters

    • file: JSZipObject

      The JSZipObject representing the file to be processed.

    • aggregate: AggregateMetadata

      The aggregate metadata for which the schema is being generated.

    Returns Promise<LayerArtifact>

    A promise that resolves to a LayerArtifact containing the schema.