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

Function validate_scala_output_paths

compiler/fory_compiler/cli.py:363–386  ·  view source on GitHub ↗

Check Scala output paths for the current generation run.

(
    graph: List[Tuple[Path, Schema]],
    grpc: bool = False,
)

Source from the content-addressed store, hash-verified

361
362
363def validate_scala_output_paths(
364 graph: List[Tuple[Path, Schema]],
365 grpc: bool = False,
366) -> bool:
367 """Check Scala output paths for the current generation run."""
368 outputs: Dict[str, List[str]] = {}
369 for path, schema in graph:
370 for output_path, owner in scala_output_paths(schema, include_services=grpc):
371 outputs.setdefault(output_path, []).append(f"{path} {owner}")
372 collisions = {
373 output_path: paths for output_path, paths in outputs.items() if len(paths) > 1
374 }
375 if not collisions:
376 return True
377 details = ", ".join(
378 f"{output_path}: {', '.join(paths)}"
379 for output_path, paths in sorted(collisions.items())
380 )
381 print(
382 "Error: Scala generated file path collision; rename schema files, "
383 f"schema types, or services, or use distinct Scala packages. Collisions: {details}",
384 file=sys.stderr,
385 )
386 return False
387
388
389def validate_scala_generation(

Callers 1

Calls 4

scala_output_pathsFunction · 0.90
setdefaultMethod · 0.80
itemsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected