Table of Contents

Class ResourceCatalog

Namespace
Nexus.DataModel
Assembly
Nexus.Extensibility.dll

A catalog is a top level element and holds a list of resources.

public record ResourceCatalog : IEquatable<ResourceCatalog>
Inheritance
ResourceCatalog
Implements
Inherited Members

Constructors

ResourceCatalog(string, IReadOnlyDictionary<string, JsonElement>?, IReadOnlyList<Resource>?)

Initializes a new instance of the ResourceCatalog.

public ResourceCatalog(string id, IReadOnlyDictionary<string, JsonElement>? properties = null, IReadOnlyList<Resource>? resources = null)

Parameters

id string

The catalog identifier.

properties IReadOnlyDictionary<string, JsonElement>

The properties.

resources IReadOnlyList<Resource>

The list of resources.

Exceptions

ArgumentException

Thrown when the resource identifier is not valid.

Properties

Id

Gets the identifier.

public string Id { get; init; }

Property Value

string

Properties

Gets the properties.

public IReadOnlyDictionary<string, JsonElement>? Properties { get; init; }

Property Value

IReadOnlyDictionary<string, JsonElement>

Resources

Gets the list of representations.

public IReadOnlyList<Resource>? Resources { get; init; }

Property Value

IReadOnlyList<Resource>

ValidIdExpression

[GeneratedRegex("^(?:\\/[a-zA-Z_][a-zA-Z_0-9]*)+$")]
public static Regex ValidIdExpression { get; }

Property Value

Regex

Remarks

Pattern:

^(?:\\/[a-zA-Z_][a-zA-Z_0-9]*)+$

Explanation:
○ Match if at the beginning of the string.
○ Loop greedily at least once.
    ○ Match '/'.
    ○ Match a character in the set [A-Z_a-z].
    ○ Match a character in the set [0-9A-Z_a-z] atomically any number of times.
○ Match if at the end of the string or if before an ending newline.

Methods

Merge(ResourceCatalog)

Merges another catalog with this instance.

public ResourceCatalog Merge(ResourceCatalog catalog)

Parameters

catalog ResourceCatalog

The catalog to merge into this instance.

Returns

ResourceCatalog

The merged catalog.