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

Function fromAST

packages/effect/src/JSONSchema.ts:337–363  ·  view source on GitHub ↗
(ast: AST.AST, options: {
  readonly definitions: Record<string, JsonSchema7>
  readonly definitionPath?: string | undefined
  readonly target?: Target | undefined
  readonly topLevelReferenceStrategy?: TopLevelReferenceStrategy | undefined
  readonly additionalPropertiesStrategy?: AdditionalPropertiesStrategy | undefined
})

Source from the content-addressed store, hash-verified

335 * @experimental
336 */
337export const fromAST = (ast: AST.AST, options: {
338 readonly definitions: Record<string, JsonSchema7>
339 readonly definitionPath?: string | undefined
340 readonly target?: Target | undefined
341 readonly topLevelReferenceStrategy?: TopLevelReferenceStrategy | undefined
342 readonly additionalPropertiesStrategy?: AdditionalPropertiesStrategy | undefined
343}): JsonSchema7 => {
344 const definitionPath = options.definitionPath ?? "#/$defs/"
345 const getRef = (id: string) => definitionPath + id
346 const target = options.target ?? "jsonSchema7"
347 const topLevelReferenceStrategy = options.topLevelReferenceStrategy ?? "keep"
348 const additionalPropertiesStrategy = options.additionalPropertiesStrategy ?? "strict"
349 return go(
350 ast,
351 options.definitions,
352 "handle-identifier",
353 [],
354 {
355 getRef,
356 target,
357 topLevelReferenceStrategy,
358 additionalPropertiesStrategy
359 },
360 "handle-annotation",
361 "handle-errors"
362 )
363}
364
365const constNever: JsonSchema7Never = {
366 $id: "/schemas/never",

Callers 1

makeFunction · 0.70

Calls 1

goFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…