Skip to content

Examples

This section contains runnable code examples that demonstrate real-world usage of disdantic. Each example is self-contained and demonstrates key architectural features of the library.

[!NOTE] All examples assume you have completed Installation.

Example Categories

Polymorphic Messaging


Simple, self-contained example demonstrating core registry capabilities, case-insensitive lookahead routing, and cascading validation schema rebuilding.

View Code

Telemetry & Settings


Demonstrates loading configurations from workspace pyproject.toml with strict precedence, default key fallbacks, and structured JSON logging with OpenTelemetry tracing context.

View Code

Lazy Loading & Introspection


Showcases deferred loading via thread-safe LazyProxy, SingletonMeta double-checked locking, and recursive, circular-reference-safe runtime self-introspection with InfoMixin.

View Code

Auto-Discovery & Diagnostics


Demonstrates automatic package scanning and registration using AutoImporterMixin, programmatic and CLI-based registry diagnostics, and schema exports.

View Code

Contributing an Example

Have a useful snippet or pattern to share? See the Contributing Guide to learn how to add a new example to this section.