Class ParsingOptions
Class ParsingOptions
defines properties that can be passed into the ModelParser constructor to configure its behavior.
Inherited Members
Namespace: DTDLParser
Assembly: DTDLParser.dll
Syntax
public class ParsingOptions
Fields
| Edit this page View SourceMaxKnownDtdlVersion
The highest version of DTDL understood by this version of ModelParser.
Declaration
public const int MaxKnownDtdlVersion = 4
Field Value
Type | Description |
---|---|
int |
MinKnownDtdlVersion
The lowest version of DTDL understood by this version of ModelParser.
Declaration
public const int MinKnownDtdlVersion = 2
Field Value
Type | Description |
---|---|
int |
Properties
| Edit this page View SourceAllowUndefinedExtensions
Gets or sets a value indicating whether and when the parser should continue parsing if it encounters a reference to an extension that cannot be resolved.
If this property is Never, an undefined extension context in a model will result in a ParsingException with a ParsingError indicating a ValidationID
of dtmi:dtdl:parsingError:unresolvableContextSpecifier or dtmi:dtdl:parsingError:unresolvableContextVersion.
If this property is Always, an undefined extension context in a model will not interrupt parsing, and furthermore the presence of this undefined context will allow the model to use undefined co-types and to use undefined properties in elements that have undefined co-types.
If this property is not set or is set to PerDefault, the parsing behavior is determined according to the version of the DTDL context specified by the model.
Declaration
public WhenToAllow AllowUndefinedExtensions { get; set; }
Property Value
Type | Description |
---|---|
WhenToAllow |
Remarks
For DTDL v2, the default behavior is to allow undefined extensions. For DTDL v3, the default behavior is to disallow undefined extensions. For DTDL v4, the default behavior is to disallow undefined extensions.
DtdlResolveLocator
Gets or sets an optional DtdlResolveLocator
delegate that will be called to convert a resolve DTMI and line number into a source name and line number.
Declaration
public DtdlResolveLocator DtdlResolveLocator { get; set; }
Property Value
Type | Description |
---|---|
DtdlResolveLocator |
DtmiResolver
Gets or sets an optional DtmiResolver
callback that will be called to resolve @context
references or undefined identifiers during execution of the Parse(IEnumerable<string>, DtdlParseLocator) API.
Declaration
public DtmiResolver DtmiResolver { get; set; }
Property Value
Type | Description |
---|---|
DtmiResolver |
DtmiResolverAsync
Gets or sets an optional DtmiResolverAsync
callback that will be called to resolve @context
references or undefined identifiers during execution of the ParseAsync(IAsyncEnumerable<string>, DtdlParseLocator, CancellationToken) API.
Declaration
public DtmiResolverAsync DtmiResolverAsync { get; set; }
Property Value
Type | Description |
---|---|
DtmiResolverAsync |
ExtensionLimitContexts
Gets or sets an optional list of Dtmi
context specifiers of limit extensions that are acceptable; if an unacceptable context is referenced in a modedl, a ParsingException will be thrown with a ParsingError indicating a ValidationID
of dtmi:dtdl:parsingError:disallowedLimitContext.
Declaration
public List<Dtmi> ExtensionLimitContexts { get; set; }
Property Value
Type | Description |
---|---|
List<Dtmi> |
Remarks
An entry in the list with no version suffix accepts all major/minor versions of the indicated limit extension. (E.g., "dtmi:dtdl:limits:example" accepts "dtmi:dtdl:limits:example;1", "dtmi:dtdl:limits:example;2", etc.)
An entry in the list with a version suffix accepts the indicated major version and all equal or greater minor versions. (E.g., "dtmi:dtdl:limits:example;2" accepts "dtmi:dtdl:limits:example;2", "dtmi:dtdl:limits:example;2.1", etc.)
Core DTDL limits are always acceptable. This option specifies additional limit definitions that are also acceptable.
MaxDtdlVersion
Gets or sets an integer value that restricts the highest DTDL version the parser should accept; if a higher version model is submitted, a ParsingException will be thrown with a ParsingError indicating a ValidationID
of dtmi:dtdl:parsingError:disallowedContextVersion.
Declaration
public int MaxDtdlVersion { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
The default value is 4, because this is the highest version of DTDL understood by this version of ModelParser.