( schema: Schema.Codec<A, I>, path: string )
| 168 | }) |
| 169 | |
| 170 | const 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 |
| 188 | const readDocgenConfig = ( |
no test coverage detected