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

Method _check_services

compiler/fory_compiler/ir/validator.py:732–761  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

730 check_field(f, None)
731
732 def _check_services(self) -> None:
733 seen_service_names: dict = {}
734 for service in self.schema.services:
735 if service.name in seen_service_names:
736 self._error(
737 f"Duplicate service name: {service.name}",
738 service.location,
739 )
740 seen_service_names.setdefault(service.name, service.location)
741
742 seen_method_names: dict = {}
743 for method in service.methods:
744 if method.name in seen_method_names:
745 self._error(
746 f"Duplicate method name in service {service.name}: {method.name}",
747 method.location,
748 )
749 seen_method_names.setdefault(method.name, method.location)
750
751 for named_type in (method.request_type, method.response_type):
752 resolved = self.schema.get_type(named_type.name)
753 if resolved is None:
754 continue
755 if not isinstance(resolved, (Message, Union)):
756 kind = "an enum" if isinstance(resolved, Enum) else "unknown"
757 self._error(
758 f"RPC type '{named_type.name}' in service {service.name}"
759 f" must be a message or union, not {kind}",
760 named_type.location,
761 )
762
763
764def validate_schema(schema: Schema) -> List[str]:

Callers 1

validateMethod · 0.95

Calls 3

_errorMethod · 0.95
setdefaultMethod · 0.80
get_typeMethod · 0.45

Tested by

no test coverage detected