feat(build): add cleanup-markdown feature flag (#1086)

This commit is contained in:
Marek Kuskowski
2022-09-28 10:00:25 -04:00
committed by GitHub
parent 56ff45d9a3
commit c1b08dffac
4 changed files with 64 additions and 52 deletions
+1
View File
@@ -23,6 +23,7 @@ syn = "1.0"
[features] [features]
default = ["transport", "prost"] default = ["transport", "prost"]
cleanup-markdown = ["prost-build/cleanup-markdown"]
prost = ["prost-build"] prost = ["prost-build"]
transport = [] transport = []
+8
View File
@@ -1,6 +1,14 @@
//! `tonic-build` compiles `proto` files via `prost` and generates service stubs //! `tonic-build` compiles `proto` files via `prost` and generates service stubs
//! and proto definitiones for use with `tonic`. //! and proto definitiones for use with `tonic`.
//! //!
//! # Feature flags
//!
//! - `cleanup-markdown`: Enables cleaning up documentation from the generated code. Useful
//! when documentation of the generated code fails `cargo test --doc` for example.
//! - `prost`: Enables usage of prost generator (enabled by default).
//! - `transport`: Enables generation of `connect` method using `tonic::transport::Channel`
//! (enabled by default).
//!
//! # Required dependencies //! # Required dependencies
//! //!
//! ```toml //! ```toml
+10 -7
View File
@@ -7,12 +7,12 @@
/// [API Design Guide](<https://cloud.google.com/apis/design/errors>). /// [API Design Guide](<https://cloud.google.com/apis/design/errors>).
#[derive(Clone, PartialEq, ::prost::Message)] #[derive(Clone, PartialEq, ::prost::Message)]
pub struct Status { pub struct Status {
/// The status code, which should be an enum value of \[google.rpc.Code][google.rpc.Code\]. /// The status code, which should be an enum value of \\[google.rpc.Code\]\[google.rpc.Code\\].
#[prost(int32, tag="1")] #[prost(int32, tag="1")]
pub code: i32, pub code: i32,
/// A developer-facing error message, which should be in English. Any /// A developer-facing error message, which should be in English. Any
/// user-facing error message should be localized and sent in the /// user-facing error message should be localized and sent in the
/// \[google.rpc.Status.details][google.rpc.Status.details\] field, or localized by the client. /// \\[google.rpc.Status.details\]\[google.rpc.Status.details\\] field, or localized by the client.
#[prost(string, tag="2")] #[prost(string, tag="2")]
pub message: ::prost::alloc::string::String, pub message: ::prost::alloc::string::String,
/// A list of messages that carry the error details. There is a common set of /// A list of messages that carry the error details. There is a common set of
@@ -92,7 +92,8 @@ pub mod quota_failure {
/// ///
/// Example of an error when contacting the "pubsub.googleapis.com" API when it /// Example of an error when contacting the "pubsub.googleapis.com" API when it
/// is not enabled: /// is not enabled:
/// ```json ///
/// ```text,json
/// { "reason": "API_DISABLED" /// { "reason": "API_DISABLED"
/// "domain": "googleapis.com" /// "domain": "googleapis.com"
/// "metadata": { /// "metadata": {
@@ -101,11 +102,13 @@ pub mod quota_failure {
/// } /// }
/// } /// }
/// ``` /// ```
///
/// This response indicates that the pubsub.googleapis.com API is not enabled. /// This response indicates that the pubsub.googleapis.com API is not enabled.
/// ///
/// Example of an error that is returned when attempting to create a Spanner /// Example of an error that is returned when attempting to create a Spanner
/// instance in a region that is out of stock: /// instance in a region that is out of stock:
/// ```json ///
/// ```text,json
/// { "reason": "STOCKOUT" /// { "reason": "STOCKOUT"
/// "domain": "spanner.googleapis.com", /// "domain": "spanner.googleapis.com",
/// "metadata": { /// "metadata": {
@@ -118,7 +121,7 @@ pub struct ErrorInfo {
/// The reason of the error. This is a constant value that identifies the /// The reason of the error. This is a constant value that identifies the
/// proximate cause of the error. Error reasons are unique within a particular /// proximate cause of the error. Error reasons are unique within a particular
/// domain of errors. This should be at most 63 characters and match /// domain of errors. This should be at most 63 characters and match
/// /\[A-Z0-9_\]+/. /// /\\[A-Z0-9\_\\]+/.
#[prost(string, tag="1")] #[prost(string, tag="1")]
pub reason: ::prost::alloc::string::String, pub reason: ::prost::alloc::string::String,
/// The logical grouping to which the "reason" belongs. The error domain /// The logical grouping to which the "reason" belongs. The error domain
@@ -131,7 +134,7 @@ pub struct ErrorInfo {
pub domain: ::prost::alloc::string::String, pub domain: ::prost::alloc::string::String,
/// Additional structured details about this error. /// Additional structured details about this error.
/// ///
/// Keys should match /\[a-zA-Z0-9-_\]/ and be limited to 64 characters in /// Keys should match /\\[a-zA-Z0-9-\_\\]/ and be limited to 64 characters in
/// length. When identifying the current value of an exceeded limit, the units /// length. When identifying the current value of an exceeded limit, the units
/// should be contained in the key, not the value. For example, rather than /// should be contained in the key, not the value. For example, rather than
/// {"instanceLimit": "100/request"}, should be returned as, /// {"instanceLimit": "100/request"}, should be returned as,
@@ -220,7 +223,7 @@ pub struct ResourceInfo {
pub resource_type: ::prost::alloc::string::String, pub resource_type: ::prost::alloc::string::String,
/// The name of the resource being accessed. For example, a shared calendar /// The name of the resource being accessed. For example, a shared calendar
/// name: "[email protected]", if the current /// name: "[email protected]", if the current
/// error is \[google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED\]. /// error is \\[google.rpc.Code.PERMISSION_DENIED\]\[google.rpc.Code.PERMISSION_DENIED\\].
#[prost(string, tag="2")] #[prost(string, tag="2")]
pub resource_name: ::prost::alloc::string::String, pub resource_name: ::prost::alloc::string::String,
/// The owner of the resource (optional). /// The owner of the resource (optional).