CPN Schema Reference
Overview
This document provides a complete reference for the CPN (Component Part Number) Schema YAML specification. The schema defines the structure and constraints for CPN generation schemes in the Duro PLM system.
Schema Information
Schema Version: 1.0
JSON Schema:
https://json-schema.org/draft-07/schema#
Type: Object
Root Level Properties
version
string
Yes
Version of the CPN schema. Must match pattern ^\d+\.\d+$
schema_type
string
Yes
Must be "cpn_generation_scheme"
settings
object
Yes
Global settings for CPN generation
elements
array
Yes
Array of element definitions
examples
array
Yes
Array of example CPNs that follow the scheme
Settings Object
The settings
object contains global configuration options for CPN generation.
allow_override
boolean
Yes
Whether manual CPN override is allowed
allow_freeform
boolean
Yes
Whether freeform CPNs are allowed
case_sensitive
boolean
Yes
Whether CPNs are case-sensitive
Elements
The elements
array contains definitions for each component of the CPN. Each element must be one of the following types:
List Element
Constant Element
Numeric Counter
Hex Counter
Group Element
Common Element Properties
All elements share these base properties:
type
string
Yes
Element type identifier
name
string
Yes
Unique name for the element
required
boolean
No
Whether the element is required
List Element
values
array|string
Yes
Array of values or template reference
validation.pattern
string
No
Regex pattern for additional validation
Values can be one of:
Array of strings
Array of objects with
id
,name
, and optionaldescription
Template reference in format
${{namespace.field}}
List Element Examples
Constant Element
value
string
Yes
The constant value
Constant Element Example
Numeric Counter
attachedTo
array
No
Names of elements this counter is attached to
format.min_value
integer
Yes
Minimum value (must be ≥ 0)
format.max_value
integer
Yes
Maximum value
Numeric Counter Example
Hex Counter
attachedTo
array
No
Names of elements this counter is attached to
format.min_value
string
Yes
Minimum value in hex (pattern: ^[0-9A-F]+$
)
format.max_value
string
Yes
Maximum value in hex (pattern: ^[0-9A-F]+$
)
Hex Counter Example
Group Element
Combines multiple elements, useful for optional sections.
elements
array
Yes
Array of nested element definitions
Group elements can contain any other element type, including:
List elements
Constant elements
Free text elements (only available within groups)
Numeric counters
Hex counters
Group Element Example
Free Text Element (Group Only)
validation.pattern
string
Yes
Regex pattern for validation
validation.max_length
integer
Yes
Maximum length of the text
Examples Array
The examples
array must contain at least one example CPN that follows the defined scheme.
Template References
Template references allow dynamic value lists to be pulled from the system:
Template references must match the pattern: ^\$\{\{\s*[\w\.]+\s*\}\}$
. Currently, the only supported namespace is duro
. and the only supported fields are categories
and families
.
Complete Schema Example
Validation Rules
Version must match pattern
^\d+\.\d+$
Schema type must be exactly
"cpn_generation_scheme"
All referenced element names must be unique within their scope
Counter ranges must be valid (min ≤ max) and min must be ≥ 0
Hex counter values must be valid hexadecimal strings
Template references must match the specified pattern
At least one example CPN must be provided
Group elements must contain at least one element
Free text elements can only appear within groups
All elements must be valid and referenced correctly
Groups can be optional even if they contain required elements
Best Practices
Structure
Place required elements before optional ones
Group related elements together
Use consistent naming conventions
Validation
Always include regex patterns for list values
Set appropriate counter ranges for your volume
Consider case sensitivity implications
Documentation
Include descriptions for all list values
Provide diverse examples
Comment complex regex patterns
Maintenance
Use template references for shared value sets
Keep counter ranges generous for future growth
Consider versioning implications
Last updated