Skip to content

Conversation

@gcanti
Copy link
Contributor

@gcanti gcanti commented Jan 28, 2025

Returns a "Standard Schema" object conforming to the Standard Schema v1 specification.

This function creates a schema whose validate method attempts to decode and validate the provided input synchronously. If the underlying Schema includes any asynchronous components (e.g., asynchronous message resolutions
or checks), then validation will necessarily return a Promise instead.

Any detected defects will be reported via a single issue containing no path.

Example

import { Schema } from "effect"

const schema = Schema.Struct({
  name: Schema.String
})

//      ┌─── StandardSchemaV1<{ readonly name: string; }>
//      ▼
const standardSchema = Schema.standardSchemaV1(schema)

@gcanti gcanti added the schema label Jan 28, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jan 28, 2025

🦋 Changeset detected

Latest commit: e69b12d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 35 packages
Name Type
effect Minor
@effect/cli Major
@effect/cluster-browser Major
@effect/cluster-node Major
@effect/cluster-workflow Major
@effect/cluster Major
@effect/experimental Major
@effect/opentelemetry Major
@effect/platform-browser Major
@effect/platform-bun Major
@effect/platform-node-shared Major
@effect/platform-node Major
@effect/platform Major
@effect/printer-ansi Major
@effect/printer Major
@effect/rpc-http Major
@effect/rpc Major
@effect/sql-clickhouse Major
@effect/sql-d1 Major
@effect/sql-drizzle Major
@effect/sql-kysely Major
@effect/sql-libsql Major
@effect/sql-mssql Major
@effect/sql-mysql2 Major
@effect/sql-pg Major
@effect/sql-sqlite-bun Major
@effect/sql-sqlite-do Major
@effect/sql-sqlite-node Major
@effect/sql-sqlite-react-native Major
@effect/sql-sqlite-wasm Major
@effect/sql Major
@effect/typeclass Major
@effect/vitest Major
@effect/ai Major
@effect/ai-openai Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@gcanti gcanti changed the title Schema: Add standard API to Generate a Standard Schema Schema: Add standardSchemaV1 API to Generate a Standard Schema Jan 29, 2025
@effect-bot effect-bot force-pushed the next-minor branch 3 times, most recently from c7af09f to fb6f9d8 Compare February 1, 2025 05:11
@tim-smart tim-smart force-pushed the fix-4355-standard-schema branch 2 times, most recently from 84dea62 to 52160a6 Compare February 1, 2025 06:53
@effect-bot effect-bot force-pushed the next-minor branch 19 times, most recently from 8657cfb to b563ce3 Compare February 5, 2025 14:55
@tim-smart tim-smart mentioned this pull request Feb 12, 2025
tim-smart added a commit that referenced this pull request Feb 14, 2025
tim-smart added a commit that referenced this pull request Feb 14, 2025
WestBearMethod added a commit to WestBearMethod/project-kaguya that referenced this pull request Dec 10, 2025
Elysia では Effect.schema を用いて HTTP リクエスト、HTTP レスポンスを型安全にすることができる。
これによってテストで受け取る値も型安全に処理することができるようになる。

以下の URL でどのようにして Effect と Elysia を組み合わせるかを学んだ。
Effect-TS/effect#4359

また、Effect.runPromiseExit を用いることで Effect の成功型、失敗型をパターンマッチさせていることに注目したい。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants