Skip to content

Commit c1b08df

Browse files
authored
feat(build): add cleanup-markdown feature flag (#1086)
1 parent 56ff45d commit c1b08df

File tree

4 files changed

+64
-52
lines changed

4 files changed

+64
-52
lines changed

tonic-build/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ repository = "https://github.com/hyperium/tonic"
1515
version = "0.8.0"
1616

1717
[dependencies]
18-
prettyplease = {version = "0.1"}
18+
prettyplease = { version = "0.1" }
1919
proc-macro2 = "1.0"
20-
prost-build = {version = "0.11", optional = true}
20+
prost-build = { version = "0.11", optional = true }
2121
quote = "1.0"
2222
syn = "1.0"
2323

2424
[features]
2525
default = ["transport", "prost"]
26+
cleanup-markdown = ["prost-build/cleanup-markdown"]
2627
prost = ["prost-build"]
2728
transport = []
2829

tonic-build/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
//! `tonic-build` compiles `proto` files via `prost` and generates service stubs
22
//! and proto definitiones for use with `tonic`.
33
//!
4+
//! # Feature flags
5+
//!
6+
//! - `cleanup-markdown`: Enables cleaning up documentation from the generated code. Useful
7+
//! when documentation of the generated code fails `cargo test --doc` for example.
8+
//! - `prost`: Enables usage of prost generator (enabled by default).
9+
//! - `transport`: Enables generation of `connect` method using `tonic::transport::Channel`
10+
//! (enabled by default).
11+
//!
412
//! # Required dependencies
513
//!
614
//! ```toml

tonic-health/src/generated/grpc.health.v1.rs

+30-30
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ pub mod health_client {
103103
self.inner = self.inner.accept_compressed(encoding);
104104
self
105105
}
106-
/// If the requested service is unknown, the call will fail with status
107-
/// NOT_FOUND.
106+
///If the requested service is unknown, the call will fail with status
107+
///NOT_FOUND.
108108
pub async fn check(
109109
&mut self,
110110
request: impl tonic::IntoRequest<super::HealthCheckRequest>,
@@ -124,21 +124,21 @@ pub mod health_client {
124124
);
125125
self.inner.unary(request.into_request(), path, codec).await
126126
}
127-
/// Performs a watch for the serving status of the requested service.
128-
/// The server will immediately send back a message indicating the current
129-
/// serving status. It will then subsequently send a new message whenever
130-
/// the service's serving status changes.
127+
///Performs a watch for the serving status of the requested service.
128+
///The server will immediately send back a message indicating the current
129+
///serving status. It will then subsequently send a new message whenever
130+
///the service's serving status changes.
131131
///
132-
/// If the requested service is unknown when the call is received, the
133-
/// server will send a message setting the serving status to
134-
/// SERVICE_UNKNOWN but will *not* terminate the call. If at some
135-
/// future point, the serving status of the service becomes known, the
136-
/// server will send a new message with the service's serving status.
132+
///If the requested service is unknown when the call is received, the
133+
///server will send a message setting the serving status to
134+
///SERVICE_UNKNOWN but will *not* terminate the call. If at some
135+
///future point, the serving status of the service becomes known, the
136+
///server will send a new message with the service's serving status.
137137
///
138-
/// If the call terminates with status UNIMPLEMENTED, then clients
139-
/// should assume this method is not supported and should not retry the
140-
/// call. If the call terminates with any other status (including OK),
141-
/// clients should retry the call with appropriate exponential backoff.
138+
///If the call terminates with status UNIMPLEMENTED, then clients
139+
///should assume this method is not supported and should not retry the
140+
///call. If the call terminates with any other status (including OK),
141+
///clients should retry the call with appropriate exponential backoff.
142142
pub async fn watch(
143143
&mut self,
144144
request: impl tonic::IntoRequest<super::HealthCheckRequest>,
@@ -170,8 +170,8 @@ pub mod health_server {
170170
///Generated trait containing gRPC methods that should be implemented for use with HealthServer.
171171
#[async_trait]
172172
pub trait Health: Send + Sync + 'static {
173-
/// If the requested service is unknown, the call will fail with status
174-
/// NOT_FOUND.
173+
///If the requested service is unknown, the call will fail with status
174+
///NOT_FOUND.
175175
async fn check(
176176
&self,
177177
request: tonic::Request<super::HealthCheckRequest>,
@@ -182,21 +182,21 @@ pub mod health_server {
182182
>
183183
+ Send
184184
+ 'static;
185-
/// Performs a watch for the serving status of the requested service.
186-
/// The server will immediately send back a message indicating the current
187-
/// serving status. It will then subsequently send a new message whenever
188-
/// the service's serving status changes.
185+
///Performs a watch for the serving status of the requested service.
186+
///The server will immediately send back a message indicating the current
187+
///serving status. It will then subsequently send a new message whenever
188+
///the service's serving status changes.
189189
///
190-
/// If the requested service is unknown when the call is received, the
191-
/// server will send a message setting the serving status to
192-
/// SERVICE_UNKNOWN but will *not* terminate the call. If at some
193-
/// future point, the serving status of the service becomes known, the
194-
/// server will send a new message with the service's serving status.
190+
///If the requested service is unknown when the call is received, the
191+
///server will send a message setting the serving status to
192+
///SERVICE_UNKNOWN but will *not* terminate the call. If at some
193+
///future point, the serving status of the service becomes known, the
194+
///server will send a new message with the service's serving status.
195195
///
196-
/// If the call terminates with status UNIMPLEMENTED, then clients
197-
/// should assume this method is not supported and should not retry the
198-
/// call. If the call terminates with any other status (including OK),
199-
/// clients should retry the call with appropriate exponential backoff.
196+
///If the call terminates with status UNIMPLEMENTED, then clients
197+
///should assume this method is not supported and should not retry the
198+
///call. If the call terminates with any other status (including OK),
199+
///clients should retry the call with appropriate exponential backoff.
200200
async fn watch(
201201
&self,
202202
request: tonic::Request<super::HealthCheckRequest>,

tonic-types/src/generated/google.rpc.rs

+23-20
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
/// [API Design Guide](<https://cloud.google.com/apis/design/errors>).
88
#[derive(Clone, PartialEq, ::prost::Message)]
99
pub struct Status {
10-
/// The status code, which should be an enum value of \[google.rpc.Code][google.rpc.Code\].
10+
/// The status code, which should be an enum value of \\[google.rpc.Code\]\[google.rpc.Code\\].
1111
#[prost(int32, tag="1")]
1212
pub code: i32,
1313
/// A developer-facing error message, which should be in English. Any
1414
/// user-facing error message should be localized and sent in the
15-
/// \[google.rpc.Status.details][google.rpc.Status.details\] field, or localized by the client.
15+
/// \\[google.rpc.Status.details\]\[google.rpc.Status.details\\] field, or localized by the client.
1616
#[prost(string, tag="2")]
1717
pub message: ::prost::alloc::string::String,
1818
/// A list of messages that carry the error details. There is a common set of
@@ -92,33 +92,36 @@ pub mod quota_failure {
9292
///
9393
/// Example of an error when contacting the "pubsub.googleapis.com" API when it
9494
/// is not enabled:
95-
/// ```json
96-
/// { "reason": "API_DISABLED"
97-
/// "domain": "googleapis.com"
98-
/// "metadata": {
99-
/// "resource": "projects/123",
100-
/// "service": "pubsub.googleapis.com"
101-
/// }
102-
/// }
95+
///
96+
/// ```text,json
97+
/// { "reason": "API_DISABLED"
98+
/// "domain": "googleapis.com"
99+
/// "metadata": {
100+
/// "resource": "projects/123",
101+
/// "service": "pubsub.googleapis.com"
102+
/// }
103+
/// }
103104
/// ```
105+
///
104106
/// This response indicates that the pubsub.googleapis.com API is not enabled.
105107
///
106108
/// Example of an error that is returned when attempting to create a Spanner
107109
/// instance in a region that is out of stock:
108-
/// ```json
109-
/// { "reason": "STOCKOUT"
110-
/// "domain": "spanner.googleapis.com",
111-
/// "metadata": {
112-
/// "availableRegions": "us-central1,us-east2"
113-
/// }
114-
/// }
110+
///
111+
/// ```text,json
112+
/// { "reason": "STOCKOUT"
113+
/// "domain": "spanner.googleapis.com",
114+
/// "metadata": {
115+
/// "availableRegions": "us-central1,us-east2"
116+
/// }
117+
/// }
115118
/// ```
116119
#[derive(Clone, PartialEq, ::prost::Message)]
117120
pub struct ErrorInfo {
118121
/// The reason of the error. This is a constant value that identifies the
119122
/// proximate cause of the error. Error reasons are unique within a particular
120123
/// domain of errors. This should be at most 63 characters and match
121-
/// /\[A-Z0-9_\]+/.
124+
/// /\\[A-Z0-9\_\\]+/.
122125
#[prost(string, tag="1")]
123126
pub reason: ::prost::alloc::string::String,
124127
/// The logical grouping to which the "reason" belongs. The error domain
@@ -131,7 +134,7 @@ pub struct ErrorInfo {
131134
pub domain: ::prost::alloc::string::String,
132135
/// Additional structured details about this error.
133136
///
134-
/// Keys should match /\[a-zA-Z0-9-_\]/ and be limited to 64 characters in
137+
/// Keys should match /\\[a-zA-Z0-9-\_\\]/ and be limited to 64 characters in
135138
/// length. When identifying the current value of an exceeded limit, the units
136139
/// should be contained in the key, not the value. For example, rather than
137140
/// {"instanceLimit": "100/request"}, should be returned as,
@@ -220,7 +223,7 @@ pub struct ResourceInfo {
220223
pub resource_type: ::prost::alloc::string::String,
221224
/// The name of the resource being accessed. For example, a shared calendar
222225
/// name: "[email protected]", if the current
223-
/// error is \[google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED\].
226+
/// error is \\[google.rpc.Code.PERMISSION_DENIED\]\[google.rpc.Code.PERMISSION_DENIED\\].
224227
#[prost(string, tag="2")]
225228
pub resource_name: ::prost::alloc::string::String,
226229
/// The owner of the resource (optional).

0 commit comments

Comments
 (0)