CodeSpec Class
A Code Specification captures the rules for encoding and decoding significant business information into and from a Code (string). This specification is used to generate and validate Codes.
A CodeSpec defines the format of a Code for a certain type of Element in an IModel. A CodeSpec can identify an external system that maintains and/or assigns Codes.
Methods
| Name | Description | |
|---|---|---|
| create(iModel: IModel, name: string, scopeType: CodeScopeSpec.Type, scopeReq?: CodeScopeSpec.ScopeRequirement): CodeSpec Static | Create a new CodeSpec from the specified parameters | 
Properties
| Name | Type | Description | |
|---|---|---|---|
| id | string | The id of this CodeSpec. | |
| iModel | IModel | The iModel holding this CodeSpec. | |
| isExternal Accessor ReadOnly | boolean | ||
| isValid Accessor ReadOnly | boolean | Will be true if the id of this CodeSpec is valid. | |
| name | string | The name of this CodeSpec. | |
| scopeReq Accessor | CodeScopeSpec.ScopeRequirement | Will be CodeScopeSpec.ScopeRequirement.FederationGuidif the scoping element is required to have a FederationGuid or | |
| scopeReq Setter | scopeReq(req: CodeScopeSpec.ScopeRequirement): void | ||
| scopeType Accessor | CodeScopeSpec.Type | The scope type of this CodeSpec. | |
| scopeType Setter | scopeType(scopeType: CodeScopeSpec.Type): void | 
Defined in
- core/common/src/Code.ts Line 275
Last Updated: 24 October, 2025
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.