MCPcopy Create free account
hub / github.com/LaunchPlatform/beanhub-cli / _validate_form

Function _validate_form

beanhub_cli/forms/main.py:46–61  ·  view source on GitHub ↗
(env: Environment)

Source from the content-addressed store, hash-verified

44
45
46def _validate_form(env: Environment) -> FormDoc:
47 ctx = get_current_context()
48 try:
49 return validate_doc(pathlib.Path.cwd() / ".beanhub" / "forms.yaml")
50 except (yaml.parser.ParserError, yaml.scanner.ScannerError) as exc:
51 env.logger.error("Invalid form document with YAML errors:")
52 rich.print(str(exc))
53 ctx.exit(-1)
54 except ValidationError as exc:
55 env.logger.error("Invalid form document with errors:")
56 tree = errors_to_tree(exc.errors())
57 rich.print(enrich_tree(tree))
58 ctx.exit(-1)
59 except ValueError as exc:
60 env.logger.error(f"Failed to validate with error: {exc.args[0]}")
61 ctx.exit(-1)
62
63
64@cli.command(help="Validate form schema file")

Callers 2

validateFunction · 0.85
list_formsFunction · 0.85

Calls 3

validate_docFunction · 0.85
errors_to_treeFunction · 0.85
enrich_treeFunction · 0.85

Tested by

no test coverage detected