Skip to content

quickmodel / QConfig

Variable: QConfig ​

const QConfig: QModelConfigService

Global Singleton for QuickModel Configuration.

QConfig provides a central point to configure the behavior of QuickModel across your entire application. It allows you to set global defaults, security limits, and strict mode settings that apply to all models unless explicitly overridden.

Key Features:

  • 🌍 Global Defaults: Set unknownPropertyPolicy: 'error' once for the whole app.
  • 🛡️ Security Limits: Configure maxArrayLength to prevent DoS attacks.
  • ⚙️ Hot Reload: Configuration can be updated at runtime (though usually done at startup).

Examples ​

1. Enable Strict Mode Globally

typescript
// Reject any property not defined in the model
QConfig.configure({
  defaults: {
    unknownPropertyPolicy: 'error'
  }
});

2. Configure Security Limits

typescript
QConfig.configure({
  defaults: {
    maxArrayLength: 5000 // Limit nested arrays to 5k items
  }
});

See ​