• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valkyrjaio / sindri-java / 30189084201

26 Jul 2026 05:15AM UTC coverage: 98.626% (-1.4%) from 100.0%
30189084201

push

github

web-flow
[Grpc] Add gRPC data-class generation (#38)

# Description

Adds **gRPC data-class generation** to Sindri, mirroring the existing
CLI and HTTP verticals so that a `@GrpcService` app can pre-generate its
cached service map (`AppGrpcRoutingData`) exactly as it does for
HTTP/CLI routes.

Sindri reflects (via JavaParser) over `@GrpcService` controllers
reachable from a component provider's `getGrpcProviders()`, reads each
`@GrpcMethod`, and emits an `AppGrpcRoutingData implements
GrpcRoutingDataContract` whose `routes()` maps `/package.Service/Method`
to a `Supplier<RouteContract>`. The generated supplier wires the
annotated method as the reflective handler and carries the client/server
streaming flags.

Like the CLI/HTTP readers, Sindri only emits *strings* referencing
`io.valkyrja.grpc.*`, so this compiles against the current published
framework — no new dependency. (The generated output is compiled by the
app, which needs the gRPC-enabled framework release.)

## Types of changes

- [ ] Improvement _(non-breaking change which improves code)_
- [ ] Bug fix _(non-breaking change which fixes an issue)_
- [x] New feature _(non-breaking change which adds functionality)_
- [ ] Deprecation _(breaking change which removes functionality)_
- [ ] Breaking change _(fix or feature that would cause existing
functionality to change)_
- [ ] Documentation improvement

## Changes

- **`ast/data/GrpcRouteData`** (+ contract) — the parsed gRPC route data
record, paralleling `CliRouteData`/`HttpRouteData`.
- **`ast/GrpcRouteAttributeReader`** (+ contract) +
**`ast/data/result/GrpcRouteAttributeResult`** — reads
`@GrpcService`/`@GrpcMethod`, keying routes by `/service/method` with a
reflective handler supplier and streaming flags.
- **`generator/ast/grpc/AstGrpcDataFileGenerator`** (+ contract) — emits
`AppGrpcRoutingData implements GrpcRoutingDataContract`.
- **`ast/data/result/ComponentProviderResult`** +
**`ast/ComponentProviderReader`** — collect `getGrpcProviders()`
alo... (continued)

512 of 525 branches covered (97.52%)

Branch coverage included in aggregate %.

381 of 396 new or added lines in 17 files covered. (96.21%)

1498 of 1513 relevant lines covered (99.01%)

4.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/io/sindri/generator/throwable/exception/DataFileWriteException.java
1
/*
2
 * This file is part of the Sindri package.
3
 *
4
 * (c) Melech Mizrachi <melechmizrachi@gmail.com>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9

10
package io.sindri.generator.throwable.exception;
11

12
import io.sindri.generator.throwable.exception.abstract_.GeneratorRuntimeException;
13

14
/**
15
 * Thrown when a generated data file could not be written, so generation does not silently report
16
 * success while leaving a stale (or missing) data class on disk.
17
 */
18
public class DataFileWriteException extends GeneratorRuntimeException {
19

20
    public DataFileWriteException(String message) {
NEW
21
        super(message);
×
NEW
22
    }
×
23
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc