Options
All
  • Public
  • Public/Protected
  • All
Menu

DS-Utilities

Index

Type aliases

AvailableVersions: { 5.0: DsUtilitiesV5; 7.0: DsUtilitiesV7 }

These are the available DS-Specification versions (with their corresponding DS-Utilities classes) that are supported by this library.

Type declaration

DataTypeDsV7: typeof dataTypesDs[keyof typeof dataTypesDs]

These are the Data Types used in DS-Specification 7.0.

They are listed in the DS-V7 Specification in the XSD column.

DataTypeSchemaV7: typeof dataTypesSchema[keyof typeof dataTypesSchema]

These are the original Data Types from Schema.org, that are mapped in DS-Specification 7.0.

They are listed in the DS-V7 Specification in the Schema.org column.

PathTokenObjectV7: { currentPath: string; dsPathNodeType: PathGrammarNodeTypeV7; grammarNodeType: DsGrammarNodeTypeV7; label: string; restPath: string; token: string }

This type is used by the function tokenizeDsPath() to represent a single path-token.

DsGrammarNodeTypeV7 (type of a DS-Node from the DS-Grammar point of view) can be one of the following:

PathGrammarNodeTypeV7 (type of a DS-Node from the DS-Path point of view) can be one of the following:

  • RootNode
  • Context
  • InternalReferenceDefinition
  • ExternalReferenceDefinition
  • InternalExternalReferenceDefinition
  • RootReference
  • InternalReference
  • ExternalReference
  • InternalExternalReference
  • Property
  • Class
  • Enumeration
  • DataType
example
const dsPath = "$.schema:creditText/xsd:string";
// a PathTokenObject representing the ".schema:creditText" part would look like this:
const dsPathToken2 = {
token: '.schema:creditText',
label: 'creditText',
grammarNodeType: 'Property',
dsPathNodeType: 'Property',
currentPath: '$.schema:creditText',
restPath: '/xsd:string'
};

Type declaration

  • currentPath: string
  • dsPathNodeType: PathGrammarNodeTypeV7
  • grammarNodeType: DsGrammarNodeTypeV7
  • label: string
  • restPath: string
  • token: string
VerificationReportV7: { errors: ErrorEntryV7[]; result: VerificationResultV7 }

This type is used by the function verifyDs() to represent a verification result for the Meta verification of a Domain Specification.

A verification report has only 2 fields:

  • result is a string that represents the overall result of the verification. The value can be Valid, ValidWithWarnings , or Invalid.
  • errors is an array of errors detected. Each error entry has the following fields:
    • severity. The value can be Warning, Error, or Critical.
    • path. A path pointing to the error part of the DS. (null if none)
    • description. A textual description about the error.

Type declaration

  • errors: ErrorEntryV7[]
  • result: VerificationResultV7

Functions

  • getAvailableVersions(): string[]
  • Returns the available DS-Specification versions that are supported by this library as an array of strings.

    example
    const versions = DsUtil.getAvailableVersions();
    // [ "7.0", "5.0" ]

    Returns string[]

    available versions as an array string

  • Creates a corresponding DS-Utilities instance based on the DS-Specification version used by the given input Domain Specification.

    example
    const myDsUtilities = DsUtil.getDsUtilitiesForDs(myDs);
    // returns a new DsUtilitiesV7 instance (assuming the given DS 'myDs' uses DsV7)

    Type parameters

    Parameters

    • ds: DsGeneric

      the input DS

    Returns AvailableVersions[T]

    a corresponding DS-Utilities instance

  • Creates a corresponding DS-Utilities instance based on the DS-Specification version given.

    example
    const myDsUtilities = DsUtil.getDsUtilitiesForDsSpecVersion("7.0");
    // returns a new DsUtilitiesV7 instance

    Type parameters

    Parameters

    • dsSpecVersion: T

      the desired DS-Specification version

    Returns AvailableVersions[T]

    a corresponding DS-Utilities instance