( ast: AST.AST )
| 1311 | * @category Utilities |
| 1312 | */ |
| 1313 | export const getJsonSchemaFromSchemaAst = ( |
| 1314 | ast: AST.AST |
| 1315 | ): JsonSchema.JsonSchema7 => { |
| 1316 | const $defs = {} |
| 1317 | const schema = JsonSchema.fromAST(ast, { |
| 1318 | definitions: $defs, |
| 1319 | topLevelReferenceStrategy: "skip" |
| 1320 | }) |
| 1321 | if (Object.keys($defs).length === 0) return schema |
| 1322 | ;(schema as any).$defs = $defs |
| 1323 | return schema |
| 1324 | } |
| 1325 | |
| 1326 | // ============================================================================= |
| 1327 | // Annotations |