Libraries
    Preparing search index...

    Collects schemas that carry an explicit component name (set via .schemaName()) and provides a reference-based lookup used during OpenAPI spec generation to replace inline schema objects with $ref: '#/components/schemas/<name>' pointers.

    Conflict rule: registering two different schema instances (different object references) under the same name throws immediately. Re-registering the same instance is a no-op.

    const registry = new SchemaRegistry();
    registry.register(UserSchema); // UserSchema.schemaName('User')
    registry.getName(UserSchema); // 'User'
    registry.getName(someOtherSchema); // null
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get isEmpty(): boolean

      Returns true when at least one schema has been registered.

      Returns boolean

    Methods

    • Iterates over all registered [name, schema] pairs in insertion order.

      Used to emit the components.schemas section of an OpenAPI document.

      Returns IterableIterator<[string, SchemaBuilder<any, any, any, false, {}>]>

    • Returns the component name for a given schema instance, or null if it was not registered.

      Parameters

      • schema: SchemaBuilder<any, any, any>

        The schema builder to look up.

      Returns string | null

      The registered name, or null.

    • Attempts to register schema in the registry.

      • If the schema has no schemaName in its introspect output, it is silently skipped.
      • If the same instance is already registered, this is a no-op.
      • If a different instance is already registered under the same name, an error is thrown.

      Parameters

      • schema: SchemaBuilder<any, any, any>

        The schema builder to register.

      Returns void

      When two distinct schema instances share the same name.