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

Function make

packages/effect/src/JSONSchema.ts:264–288  ·  view source on GitHub ↗
(schema: Schema.Schema<A, I, R>, options?: {
  readonly target?: Target | undefined
})

Source from the content-addressed store, hash-verified

262 * @since 3.10.0
263 */
264export const make = <A, I, R>(schema: Schema.Schema<A, I, R>, options?: {
265 readonly target?: Target | undefined
266}): JsonSchema7Root => {
267 const definitions: Record<string, any> = {}
268 const target = options?.target ?? "jsonSchema7"
269 const ast = AST.isTransformation(schema.ast) && isParseJsonTransformation(schema.ast.from)
270 // Special case top level `parseJson` transformations
271 ? schema.ast.to
272 : schema.ast
273 const jsonSchema = fromAST(ast, {
274 definitions,
275 target
276 })
277 const out: JsonSchema7Root = {
278 $schema: getMetaSchemaUri(target),
279 $defs: {},
280 ...jsonSchema
281 }
282 if (Record.isEmptyRecord(definitions)) {
283 delete out.$defs
284 } else {
285 out.$defs = definitions
286 }
287 return out
288}
289
290type Target = "jsonSchema7" | "jsonSchema2019-09" | "openApi3.1" | "jsonSchema2020-12"
291

Callers

nothing calls this directly

Calls 3

getMetaSchemaUriFunction · 0.85
fromASTFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…