# strictObjectAsync

> This document is the Markdown version of [valibot.dev/api/strictObjectAsync/](https://valibot.dev/api/strictObjectAsync/). For the complete documentation index, see [llms.txt](https://valibot.dev/llms.txt).

Creates a strict object schema.

```ts
const Schema = v.strictObjectAsync<TEntries, TMessage>(entries, message);
```

## Generics

- `TEntries` `extends ObjectEntriesAsync`
- `TMessage` `extends ErrorMessage<StrictObjectIssue> | undefined`

## Parameters

- `entries` `TEntries`
- `message` `TMessage`

### Explanation

With `strictObjectAsync` you can validate the data type of the input and whether the content matches `entries`. If the input is not an object or does include unknown entries, you can use `message` to customize the error message.

> The difference to [`objectAsync`](/api/objectAsync.md) is that this schema returns an issue for unknown entries. It intentionally returns only one issue. Otherwise, attackers could send large objects to exhaust device resources. If you want an issue for every unknown key, use the [`objectWithRestAsync`](/api/objectWithRestAsync.md) schema with [`never`](/api/never.md) for the `rest` argument.

## Returns

- `Schema` `StrictObjectSchemaAsync<TEntries, TMessage>`

## Examples

The following examples show how `strictObjectAsync` can be used. Please see the [object guide](/guides/objects.md) for more examples and explanations.

### New user schema

Schema to validate a strict object containing only specific new user details.

```ts
import { isEmailPresent } from '~/api';

const NewUserSchema = v.strictObjectAsync({
  firstName: v.pipe(v.string(), v.minLength(2), v.maxLength(45)),
  lastName: v.pipe(v.string(), v.minLength(2), v.maxLength(45)),
  email: v.pipeAsync(
    v.string(),
    v.email(),
    v.checkAsync(isEmailPresent, 'The email is already in use by another user.')
  ),
  password: v.pipe(v.string(), v.minLength(8)),
  avatar: v.optional(v.pipe(v.string(), v.url())),
});
```

## Related

The following APIs can be combined with `strictObjectAsync`.

### Schemas

[`any`](/api/any.md), [`array`](/api/array.md), [`bigint`](/api/bigint.md), [`blob`](/api/blob.md), [`boolean`](/api/boolean.md), [`custom`](/api/custom.md), [`date`](/api/date.md), [`enum`](/api/enum.md), [`exactOptional`](/api/exactOptional.md), [`file`](/api/file.md), [`function`](/api/function.md), [`instance`](/api/instance.md), [`intersect`](/api/intersect.md), [`lazy`](/api/lazy.md), [`literal`](/api/literal.md), [`looseObject`](/api/looseObject.md), [`looseTuple`](/api/looseTuple.md), [`map`](/api/map.md), [`nan`](/api/nan.md), [`never`](/api/never.md), [`nonNullable`](/api/nonNullable.md), [`nonNullish`](/api/nonNullish.md), [`nonOptional`](/api/nonOptional.md), [`null`](/api/null.md), [`nullable`](/api/nullable.md), [`nullish`](/api/nullish.md), [`number`](/api/number.md), [`object`](/api/object.md), [`objectWithRest`](/api/objectWithRest.md), [`optional`](/api/optional.md), [`picklist`](/api/picklist.md), [`promise`](/api/promise.md), [`record`](/api/record.md), [`set`](/api/set.md), [`strictObject`](/api/strictObject.md), [`strictTuple`](/api/strictTuple.md), [`string`](/api/string.md), [`symbol`](/api/symbol.md), [`tuple`](/api/tuple.md), [`tupleWithRest`](/api/tupleWithRest.md), [`undefined`](/api/undefined.md), [`undefinedable`](/api/undefinedable.md), [`union`](/api/union.md), [`unknown`](/api/unknown.md), [`variant`](/api/variant.md), [`void`](/api/void.md)

### Methods

[`config`](/api/config.md), [`getDefault`](/api/getDefault.md), [`getFallback`](/api/getFallback.md), [`keyof`](/api/keyof.md), [`omit`](/api/omit.md), [`pick`](/api/pick.md)

### Actions

[`brand`](/api/brand.md), [`check`](/api/check.md), [`description`](/api/description.md), [`entries`](/api/entries.md), [`flavor`](/api/flavor.md), [`guard`](/api/guard.md), [`maxEntries`](/api/maxEntries.md), [`metadata`](/api/metadata.md), [`minEntries`](/api/minEntries.md), [`notEntries`](/api/notEntries.md), [`partialCheck`](/api/partialCheck.md), [`rawCheck`](/api/rawCheck.md), [`rawTransform`](/api/rawTransform.md), [`readonly`](/api/readonly.md), [`title`](/api/title.md), [`transform`](/api/transform.md)

### Utils

[`entriesFromList`](/api/entriesFromList.md), [`isOfKind`](/api/isOfKind.md), [`isOfType`](/api/isOfType.md)

### Async

[`arrayAsync`](/api/arrayAsync.md), [`checkAsync`](/api/checkAsync.md), [`customAsync`](/api/customAsync.md), [`exactOptionalAsync`](/api/exactOptionalAsync.md), [`fallbackAsync`](/api/fallbackAsync.md), [`forwardAsync`](/api/forwardAsync.md), [`getDefaultsAsync`](/api/getDefaultsAsync.md), [`getFallbacksAsync`](/api/getFallbacksAsync.md), [`intersectAsync`](/api/intersectAsync.md), [`lazyAsync`](/api/lazyAsync.md), [`looseObjectAsync`](/api/looseObjectAsync.md), [`looseTupleAsync`](/api/looseTupleAsync.md), [`mapAsync`](/api/mapAsync.md), [`nonNullableAsync`](/api/nonNullableAsync.md), [`nonNullishAsync`](/api/nonNullishAsync.md), [`nonOptionalAsync`](/api/nonOptionalAsync.md), [`nullableAsync`](/api/nullableAsync.md), [`nullishAsync`](/api/nullishAsync.md), [`objectAsync`](/api/objectAsync.md), [`objectWithRestAsync`](/api/objectWithRestAsync.md), [`optionalAsync`](/api/optionalAsync.md), [`parseAsync`](/api/parseAsync.md), [`parserAsync`](/api/parserAsync.md), [`partialAsync`](/api/partialAsync.md), [`partialCheckAsync`](/api/partialCheckAsync.md), [`pipeAsync`](/api/pipeAsync.md), [`rawCheckAsync`](/api/rawCheckAsync.md), [`rawTransformAsync`](/api/rawTransformAsync.md), [`recordAsync`](/api/recordAsync.md), [`requiredAsync`](/api/requiredAsync.md), [`safeParseAsync`](/api/safeParseAsync.md), [`safeParserAsync`](/api/safeParserAsync.md), [`setAsync`](/api/setAsync.md), [`strictTupleAsync`](/api/strictTupleAsync.md), [`transformAsync`](/api/transformAsync.md), [`tupleAsync`](/api/tupleAsync.md), [`tupleWithRestAsync`](/api/tupleWithRestAsync.md), [`unionAsync`](/api/unionAsync.md), [`variantAsync`](/api/variantAsync.md)
