retryoos opened a new pull request, #3485:
URL: https://github.com/apache/fory/pull/3485
## Summary
- Add schema validation for service RPC request/response types in the
compiler IR validator.
- Extend FDL/Proto/FBS service tests so RPCs with unknown request/response
types now fail validation.
- Document service RPC type validation in the compiler guide and add a small
`service.fdl` example plus a `foryc` usage snippet.
## Technical details
- `SchemaValidator._check_type_references` now also walks `schema.services`
and verifies that each `RpcMethod.request_type` and `RpcMethod.response_type`
resolves via `schema.get_type(...)`. If a type is missing, it reports `Unknown
type 'X'` at the RPC location.
- New tests:
- `test_service_unknown_request_type_fails_validation`,
`test_service_unknown_response_type_fails_validation`,
`test_service_known_types_pass_validation` in `test_fdl_service.py` (one
test also asserts that the error carries a non-null `location`).
- Matching unknown-type validation tests in `test_proto_service.py` and
`test_fbs_service.py` to cover the Proto and FlatBuffers frontends feeding into
the shared IR.
- Docs:
- `docs/compiler/compiler-guide.md` now mentions that RPC request/response
types are validated like other type references, and includes a `foryc
compiler/examples/service.fdl --java_out=... --python_out=...` example.
- Example:
- `compiler/examples/service.fdl` defines `HelloRequest`, `HelloReply`,
and a `Greeter` service with a unary `SayHello` RPC.
## Testing
Locally on macOS:
```bash
cd compiler
python -m pytest fory_compiler/tests/test_fdl_service.py -v
python -m pytest fory_compiler/tests/test_proto_service.py -v
python -m pytest fory_compiler/tests/test_fbs_service.py -v
python -m pytest fory_compiler/tests/ -v
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]