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

Function validate_kotlin_import_packages

compiler/fory_compiler/cli.py:263–278  ·  view source on GitHub ↗

Check package combinations that Kotlin source cannot compile.

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

Source from the content-addressed store, hash-verified

261
262
263def validate_kotlin_import_packages(graph: List[Tuple[Path, Schema]]) -> bool:
264 """Check package combinations that Kotlin source cannot compile."""
265 packages = {kotlin_package_for_schema(schema) for _, schema in graph}
266 if None not in packages or len(packages) <= 1:
267 return True
268 details = ", ".join(
269 f"{package or '<default>'}: {path}"
270 for path, schema in sorted(graph, key=lambda item: str(item[0]))
271 for package in [kotlin_package_for_schema(schema)]
272 )
273 print(
274 "Error: Kotlin imports cannot mix default-package schemas with named "
275 f"Kotlin packages; found {details}",
276 file=sys.stderr,
277 )
278 return False
279
280
281def validate_kotlin_output_paths(

Callers 1

Calls 1

Tested by

no test coverage detected