MCPcopy Create free account
hub / github.com/Effect-TS/effect / validateJsonFile

Function validateJsonFile

packages/tools/docgen/src/Configuration.ts:170–185  ·  view source on GitHub ↗
(
  schema: Schema.Codec<A, I>,
  path: string
)

Source from the content-addressed store, hash-verified

168 })
169
170const validateJsonFile = <A, I>(
171 schema: Schema.Codec<A, I>,
172 path: string
173): Effect.Effect<A, never, FileSystem.FileSystem> =>
174 Effect.gen(function*() {
175 const content = yield* readJsonFile(path)
176 return yield* pipe(
177 Schema.decodeUnknownEffect(schema)(content),
178 Effect.mapError((error) =>
179 new DocgenError({
180 message: `[Configuration.validateJsonFile]\n${String(error)}`
181 })
182 ),
183 Effect.orDie
184 )
185 })
186
187// TODO: this is invoked twice
188const readDocgenConfig = (

Callers 2

readDocgenConfigFunction · 0.85
loadFunction · 0.85

Calls 3

readJsonFileFunction · 0.85
pipeFunction · 0.50
StringInterface · 0.50

Tested by

no test coverage detected