@bedrock-oss/bedrock-boost
    Preparing search index...

    Class ObjectBuilder<P>

    Fluent object schema builder that produces Schema instances.

    Type Parameters

    • P extends PropsRecord
    Index

    Constructors

    • Type Parameters

      • P extends PropsRecord

      Parameters

      • name: undefined | string
      • props: P

      Returns ObjectBuilder<P>

    Methods

    • Permits keys not explicitly defined in the builder.

      Returns this

      The current builder with unknown-key support enabled.

    • Convenience wrapper that returns the built schema directly.

      Returns Schema<InferProps<P>>

      A schema equivalent to the result of build.

    • Finalises and freezes the builder into an object schema.

      Returns ObjectSchema<P, InferProps<P>>

      An immutable schema that validates the configured shape.

    • Adds a property schema to the current builder.

      Type Parameters

      • K extends string

        Property name being added.

      • S extends Schema<any>

        Schema that validates the property.

      Parameters

      • key: K

        Object key to associate with the schema.

      • schema: S

        Schema that validates the property value.

      Returns ObjectBuilder<P & { [Q in string]: { schema: S } }>

      The builder with an updated type signature.