MCPcopy Index your code
hub / github.com/Effect-TS/effect / jsonSchema

Function jsonSchema

packages/platform/src/internal/httpBody.ts:132–139  ·  view source on GitHub ↗
(schema: Schema.Schema<A, I, R>, options?: ParseOptions)

Source from the content-addressed store, hash-verified

130
131/** @internal */
132export const jsonSchema = <A, I, R>(schema: Schema.Schema<A, I, R>, options?: ParseOptions) => {
133 const encode = Schema.encode(schema, options)
134 return (body: A, contentType?: string): Effect.Effect<Body.Uint8Array, Body.HttpBodyError, R> =>
135 Effect.flatMap(
136 Effect.mapError(encode(body), (error) => HttpBodyError({ _tag: "SchemaError", error })),
137 (body) => json(body, contentType)
138 )
139}
140
141/** @internal */
142export const file = (

Callers

nothing calls this directly

Calls 4

encodeMethod · 0.80
encodeFunction · 0.70
HttpBodyErrorFunction · 0.70
jsonFunction · 0.70

Tested by

no test coverage detected