From 5f13c3b2c315b05a5f7f4683f42bf7b68581cd18 Mon Sep 17 00:00:00 2001 From: xxchan Date: Mon, 5 Aug 2024 16:35:12 +0800 Subject: [PATCH] [No Jira] [Rust] fix links to spec (#3052) * [No Jira] [Rust] fix links to spec Previous links cannot jump to the sections any more. e.g., old: /spec.html#single_object_encoding new: /specification/#single-object-encoding Signed-off-by: xxchan * Apply suggestions from code review Co-authored-by: Fokko Driesprong --------- Signed-off-by: xxchan Co-authored-by: Fokko Driesprong --- lang/rust/avro/README.md | 6 +++--- lang/rust/avro/src/lib.rs | 6 +++--- lang/rust/avro/src/rabin.rs | 6 +++--- lang/rust/avro/src/schema.rs | 18 +++++++++--------- lang/rust/avro/src/types.rs | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lang/rust/avro/README.md b/lang/rust/avro/README.md index e991292f043..986dd318c7e 100644 --- a/lang/rust/avro/README.md +++ b/lang/rust/avro/README.md @@ -168,7 +168,7 @@ reference in case you are interested. For more information about schemas and what kind of information you can encapsulate in them, please refer to the appropriate section of the -[Avro Specification](https://avro.apache.org/docs/current/spec.html#schemas). +[Avro Specification](https://avro.apache.org/docs/current/specification/#schema-declaration). ## Writing data @@ -321,7 +321,7 @@ let reader = Reader::with_schema(&reader_schema, &input[..]).unwrap(); The library will also automatically perform schema resolution while reading the data. For more information about schema compatibility and resolution, please refer to the -[Avro Specification](https://avro.apache.org/docs/current/spec.html#schemas). +[Avro Specification](https://avro.apache.org/docs/current/specification/#schema-declaration). As usual, there are two ways to handle Avro data in Rust, as you can see below. @@ -425,7 +425,7 @@ fn main() -> Result<(), Error> { } ``` -`apache-avro` also supports the logical types listed in the [Avro specification](https://avro.apache.org/docs/current/spec.html#Logical+Types): +`apache-avro` also supports the logical types listed in the [Avro specification](https://avro.apache.org/docs/current/specification/#logical-types): 1. `Decimal` using the [`num_bigint`](https://docs.rs/num-bigint/latest/num_bigint) crate 1. UUID using the [`uuid`](https://docs.rs/uuid/latest/uuid) crate diff --git a/lang/rust/avro/src/lib.rs b/lang/rust/avro/src/lib.rs index 34e1b4dbbce..e00b9d83081 100644 --- a/lang/rust/avro/src/lib.rs +++ b/lang/rust/avro/src/lib.rs @@ -157,7 +157,7 @@ //! //! For more information about schemas and what kind of information you can encapsulate in them, //! please refer to the appropriate section of the -//! [Avro Specification](https://avro.apache.org/docs/current/spec.html#schemas). +//! [Avro Specification](https://avro.apache.org/docs/current/specification/#schema-declaration). //! //! # Writing data //! @@ -390,7 +390,7 @@ //! The library will also automatically perform schema resolution while reading the data. //! //! For more information about schema compatibility and resolution, please refer to the -//! [Avro Specification](https://avro.apache.org/docs/current/spec.html#schemas). +//! [Avro Specification](https://avro.apache.org/docs/current/specification/#schema-declaration). //! //! As usual, there are two ways to handle Avro data in Rust, as you can see below. //! @@ -538,7 +538,7 @@ //! } //! ``` //! -//! `apache-avro` also supports the logical types listed in the [Avro specification](https://avro.apache.org/docs/current/spec.html#Logical+Types): +//! `apache-avro` also supports the logical types listed in the [Avro specification](https://avro.apache.org/docs/current/specification/#logical-types): //! //! 1. `Decimal` using the [`num_bigint`](https://docs.rs/num-bigint/latest/num_bigint) crate //! 1. UUID using the [`uuid`](https://docs.rs/uuid/latest/uuid) crate diff --git a/lang/rust/avro/src/rabin.rs b/lang/rust/avro/src/rabin.rs index f8f516477c4..eb34477539f 100644 --- a/lang/rust/avro/src/rabin.rs +++ b/lang/rust/avro/src/rabin.rs @@ -39,10 +39,10 @@ fn fp_table() -> &'static [i64; 256] { }) } -/// Implementation of the Rabin fingerprint algorithm using the Digest trait as described in [schema_fingerprints](https://avro.apache.org/docs/current/spec.html#schema_fingerprints). +/// Implementation of the Rabin fingerprint algorithm using the Digest trait as described in [schema_fingerprints](https://avro.apache.org/docs/current/specification/#schema-fingerprints). /// /// The digest is returned as the 8-byte little-endian encoding of the Rabin hash. -/// This is what is used for avro [single object encoding](https://avro.apache.org/docs/current/spec.html#single_object_encoding) +/// This is what is used for avro [single object encoding](https://avro.apache.org/docs/current/specification/#single-object-encoding) /// /// ```rust /// use apache_avro::rabin::Rabin; @@ -114,7 +114,7 @@ impl Reset for Rabin { impl OutputSizeUser for Rabin { // 8-byte little-endian form of the i64 - // See: https://avro.apache.org/docs/current/spec.html#single_object_encoding + // See: https://avro.apache.org/docs/current/specification/#single-object-encoding type OutputSize = U8; } diff --git a/lang/rust/avro/src/schema.rs b/lang/rust/avro/src/schema.rs index 1d2272a78a7..c6e1f7032d8 100644 --- a/lang/rust/avro/src/schema.rs +++ b/lang/rust/avro/src/schema.rs @@ -45,7 +45,7 @@ use strum_macros::{Display, EnumDiscriminants, EnumString}; /// Represents an Avro schema fingerprint /// More information about Avro schema fingerprints can be found in the -/// [Avro Schema Fingerprint documentation](https://avro.apache.org/docs/current/spec.html#schema_fingerprints) +/// [Avro Schema Fingerprint documentation](https://avro.apache.org/docs/current/specification/#schema-fingerprints) pub struct SchemaFingerprint { pub bytes: Vec, } @@ -66,7 +66,7 @@ impl fmt::Display for SchemaFingerprint { /// Represents any valid Avro schema /// More information about Avro schemas can be found in the -/// [Avro Specification](https://avro.apache.org/docs/current/spec.html#schemas) +/// [Avro Specification](https://avro.apache.org/docs/current/specification/#schema-declaration) #[derive(Clone, Debug, EnumDiscriminants, Display)] #[strum_discriminants(name(SchemaKind), derive(Hash, Ord, PartialOrd))] pub enum Schema { @@ -227,7 +227,7 @@ impl From<&types::Value> for SchemaKind { /// `aliases` can also be defined, to facilitate schema evolution. /// /// More information about schema names can be found in the -/// [Avro specification](https://avro.apache.org/docs/current/spec.html#names) +/// [Avro specification](https://avro.apache.org/docs/current/specification/#names) #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub struct Name { pub name: String, @@ -297,7 +297,7 @@ impl Name { /// Return the `fullname` of this `Name` /// /// More information about fullnames can be found in the - /// [Avro specification](https://avro.apache.org/docs/current/spec.html#names) + /// [Avro specification](https://avro.apache.org/docs/current/specification/#names) pub fn fullname(&self, default_namespace: Namespace) -> String { if self.name.contains('.') { self.name.clone() @@ -1022,7 +1022,7 @@ impl Schema { /// Converts `self` into its [Parsing Canonical Form]. /// /// [Parsing Canonical Form]: - /// https://avro.apache.org/docs/1.8.2/spec.html#Parsing+Canonical+Form+for+Schemas + /// https://avro.apache.org/docs/current/specification/#parsing-canonical-form-for-schemas pub fn canonical_form(&self) -> String { let json = serde_json::to_value(self) .unwrap_or_else(|e| panic!("Cannot parse Schema from JSON: {e}")); @@ -1032,9 +1032,9 @@ impl Schema { /// Generate [fingerprint] of Schema's [Parsing Canonical Form]. /// /// [Parsing Canonical Form]: - /// https://avro.apache.org/docs/1.8.2/spec.html#Parsing+Canonical+Form+for+Schemas + /// https://avro.apache.org/docs/current/specification/#parsing-canonical-form-for-schemas /// [fingerprint]: - /// https://avro.apache.org/docs/current/spec.html#schema_fingerprints + /// https://avro.apache.org/docs/current/specification/#schema-fingerprints pub fn fingerprint(&self) -> SchemaFingerprint { let mut d = D::new(); d.update(self.canonical_form()); @@ -1879,7 +1879,7 @@ impl Parser { // to the namespace of the name it is an alias for. For example, if a type named "a.b" // has aliases of "c" and "x.y", then the fully qualified names of its aliases are "a.c" // and "x.y". -// https://avro.apache.org/docs/current/spec.html#Aliases +// https://avro.apache.org/docs/current/specification/#aliases fn fix_aliases_namespace(aliases: Option>, namespace: &Namespace) -> Aliases { aliases.map(|aliases| { aliases @@ -2143,7 +2143,7 @@ impl Serialize for RecordField { } /// Parses a **valid** avro schema into the Parsing Canonical Form. -/// https://avro.apache.org/docs/1.8.2/spec.html#Parsing+Canonical+Form+for+Schemas +/// https://avro.apache.org/docs/current/specification/#parsing-canonical-form-for-schemas fn parsing_canonical_form(schema: &Value) -> String { match schema { Value::Object(map) => pcf_map(map), diff --git a/lang/rust/avro/src/types.rs b/lang/rust/avro/src/types.rs index a760542778a..33755a17ad8 100644 --- a/lang/rust/avro/src/types.rs +++ b/lang/rust/avro/src/types.rs @@ -46,7 +46,7 @@ fn max_prec_for_len(len: usize) -> Result { /// A valid Avro value. /// /// More information about Avro values can be found in the [Avro -/// Specification](https://avro.apache.org/docs/current/spec.html#schemas) +/// Specification](https://avro.apache.org/docs/current/specification/#schema-declaration) #[derive(Clone, Debug, PartialEq, strum_macros::EnumDiscriminants)] #[strum_discriminants(name(ValueKind))] pub enum Value { @@ -366,7 +366,7 @@ impl TryFrom for JsonValue { impl Value { /// Validate the value against the given [Schema](../schema/enum.Schema.html). /// - /// See the [Avro specification](https://avro.apache.org/docs/current/spec.html) + /// See the [Avro specification](https://avro.apache.org/docs/current/specification) /// for the full set of rules of schema validation. pub fn validate(&self, schema: &Schema) -> bool { self.validate_schemata(vec![schema]) @@ -623,7 +623,7 @@ impl Value { /// Attempt to perform schema resolution on the value, with the given /// [Schema](../schema/enum.Schema.html). /// - /// See [Schema Resolution](https://avro.apache.org/docs/current/spec.html#Schema+Resolution) + /// See [Schema Resolution](https://avro.apache.org/docs/current/specification/#schema-resolution) /// in the Avro specification for the full set of rules of schema /// resolution. pub fn resolve(self, schema: &Schema) -> AvroResult { @@ -635,7 +635,7 @@ impl Value { /// Attempt to perform schema resolution on the value, with the given /// [Schema](../schema/enum.Schema.html) and set of schemas to use for Refs resolution. /// - /// See [Schema Resolution](https://avro.apache.org/docs/current/spec.html#Schema+Resolution) + /// See [Schema Resolution](https://avro.apache.org/docs/current/specification/#schema-resolution) /// in the Avro specification for the full set of rules of schema /// resolution. pub fn resolve_schemata(self, schema: &Schema, schemata: Vec<&Schema>) -> AvroResult {