MCPcopy Create free account
hub / github.com/apache/fory / validate_scala_import_packages

Function validate_scala_import_packages

compiler/fory_compiler/cli.py:345–360  ·  view source on GitHub ↗

Check package combinations that Scala source cannot compile.

(graph: List[Tuple[Path, Schema]])

Source from the content-addressed store, hash-verified

343
344
345def validate_scala_import_packages(graph: List[Tuple[Path, Schema]]) -> bool:
346 """Check package combinations that Scala source cannot compile."""
347 packages = {scala_package_for_schema(schema) for _, schema in graph}
348 if None not in packages or len(packages) <= 1:
349 return True
350 details = ", ".join(
351 f"{package or '<default>'}: {path}"
352 for path, schema in sorted(graph, key=lambda item: str(item[0]))
353 for package in [scala_package_for_schema(schema)]
354 )
355 print(
356 "Error: Scala imports cannot mix default-package schemas with named "
357 f"Scala packages; found {details}",
358 file=sys.stderr,
359 )
360 return False
361
362
363def validate_scala_output_paths(

Callers 1

Calls 1

scala_package_for_schemaFunction · 0.90

Tested by

no test coverage detected