The category & specs registry is a powerful configuration system that helps you organize and validate your product data. It enables you to:
Define component categories with standardized attributes and specifications
Import pre-built category templates from Duro's standard library
Create custom validation rules and constraints for your parts data
Establish consistent part numbering schemes across your library
Enforce data quality standards through automated validation
This registry serves as the foundation for maintaining clean, well-structured product data that can scale with your organization.
Schema
The category & specs registry is defined in a YAML file that is used to define the relationships between your part specifications and their constraints (ie. validation rules).
As a Library Registry Maintainer, you'll have the ability to define, override, and extend the structure of your library parts, and author custom validations on the specification values directly or in relation to other specifications.
Import Default Category Sets
Import pre-defined category sets from Duro to leverage existing definitions.
Selectively exclude specific categories from imported sets that aren't relevant to your library.
excludes:
- "Basic Electrical Component" # Excludes category with name "Basic Electrical Component"
- "Capacitance" # Excludes category with name "Capacitance"
Define Common Specifications
Create reusable specifications that can be referenced across multiple categories. Common specs are organized in a hierarchical structure:
commonSpecs:
dimensions:
standard_length:
name: "Length"
type: "string"
validation:
pattern: "^\\d+(\\.\\d+)?\\s*(mm|cm|m|in)$"
description: "Must be a number followed by a valid unit"
standard_width:
name: "Width"
type: "string"
validation:
pattern: "^\\d+(\\.\\d+)?\\s*(mm|cm|m|in)$"
description: "Must be a number followed by a valid unit"
Define Custom Categories
Create new categories with specific attributes and specifications.
Apply common specifications across all categories of a specific type. This helps maintain consistency and reduces repetition in your category definitions.
categoryTypeSpecs:
ASSEMBLY:
- $ref: "#/commonSpecs/dimensions/*" # Reference all dimension specs
required: "Prototype"
- $ref: "#/commonSpecs/physical/weight"
required: Production
severity: Warning
ELECTRICAL:
- $ref: "#/commonSpecs/electrical/*" # Reference all electrical specs
- $ref: "#/commonSpecs/quality/iso_certification"
required: Production
You can:
Reference entire specification groups using wildcards (/*)
Reference individual specifications
Set default required stages and severity levels
Apply specifications across all categories of a specific type
This is particularly useful when:
You want to enforce standard specifications across category types
You need to maintain consistent validation rules
You want to reduce repetition in your category definitions
Implement Validation Rules
Define validation rules for specifications using different data types and formats.
specs:
- name: Voltage
type: string
validation:
pattern: "^\\d+(\\.\\d+)?\\s*V$"
description: "Must be a number followed by V (e.g., 5V, 3.3V)"
- name: PPAPLevel
type: integer
validation:
minimum: 1
maximum: 5
description: "Production Part Approval Process level (1-5)"
- name: Material
type: string
validation:
enum: [Plastic, Metal, Glass, Ceramic, Wood, Composite]
description: "Must be one of the specified materials"
Specify Lifecycle Requirements
Define when specifications are required based on the item's lifecycle stage.
Import all specifications from a set using the wildcard (*) operator. This is useful when you need to include an entire group of related specifications.
specs:
# Imports all dimension specifications from Duro's mechanical specs
- $ref: "duro/mechanical-categories/specs/dimensions/*"
required: Prototype
# This will include Height, Width, Length, Thickness, etc. as defined in the Duro specs
# Each imported spec will maintain its validation rules while inheriting the required status
The wildcard import is particularly powerful when:
You need all specifications from a logical grouping
You want to maintain consistency with a standard specification set
You want to reduce repetitive references to individual specifications
Define Warning-Level Requirements
Specify requirements that trigger warnings rather than errors when not met.
Specify quality-related specifications and their validation rules.
specs:
- name: QualityInspectionFreq
type: string
required: "Production"
validation:
enum: [PerBatch, PerShift, Daily, Weekly, Monthly]
description: "Frequency of quality inspections"
- name: ISOCertification
type: string
required: "In Review"
severity: "Warning"
validation:
pattern: "^ISO\\d{4,5}:\\d{4}$"
description: "ISO certification number and year"
Available Category Types
Define the type of category being created. The type affects validation rules and available specifications.
categories:
- code: "920"
# Available types:
type: MECHANICAL # For mechanical parts and assemblies
# OR
type: ELECTRICAL # For electrical components
# OR
type: ASSEMBLY # For combined assemblies
# OR
type: DOCUMENT # For documentation
# OR
type: SOFTWARE # For software components
Validation Types Reference
Define specifications using different validation types and formats.
String Validation
commonSpecs:
validation:
# Pattern-based string validation
- name: PartNumber
type: string
validation:
pattern: "^[A-Z]{2}-\\d{6}$"
description: "Must be 2 capital letters followed by 6 digits"
# Enum-based string validation
- name: Material
type: string
validation:
enum: [Plastic, Metal, Glass, Ceramic]
description: "Must be one of the allowed materials"
# Unit-based measurements
- name: Length
type: string
validation:
pattern: "^\\d+(\\.\\d+)?\\s*(mm|cm|m|in)$"
description: "Number with valid unit (e.g., 10mm, 2.5cm)"
Integer Validation
commonSpecs:
validation:
# Range-based integer validation
- name: Quantity
type: integer
validation:
minimum: 1
maximum: 1000
description: "Must be between 1 and 1000"
# Simple integer validation
- name: PinCount
type: integer
validation:
minimum: 1
description: "Must be at least 1"
The conditional validation supports two types of validation rules:
Range-based conditions: Define minimum and maximum values based on another field's value
Enum-based conditions: Define specific allowed values based on another field's value
You can also specify a display format using the display property, which determines how the combined values should be presented. For example, "{baseColor} {number}" will show values like "Red 40" or "Yellow 5".
Version Format Reference
When referencing external categories or specifications, you can use different version formats:
uses:
# Full semantic version
- duro/mechanical-categories@v1.0.0
# Minor version only (equivalent to latest patch)
- duro/electrical-categories@v1.0
# Major version only (equivalent to latest minor.patch)
- duro/software-categories@v1
Note: Using shorter versions will automatically use the latest compatible version within that scope.