Skip to content

Commit

Permalink
[No Jira] [Rust] fix links to spec (#3052)
Browse files Browse the repository at this point in the history
* [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 <xxchan22f@gmail.com>

* Apply suggestions from code review

Co-authored-by: Fokko Driesprong <fokko@apache.org>

---------

Signed-off-by: xxchan <xxchan22f@gmail.com>
Co-authored-by: Fokko Driesprong <fokko@apache.org>
  • Loading branch information
xxchan and Fokko authored Aug 5, 2024
1 parent b0390ce commit 1fe7fb8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions avro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions avro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
//!
Expand Down Expand Up @@ -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.
//!
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions avro/src/rabin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
18 changes: 9 additions & 9 deletions avro/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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}"));
Expand All @@ -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<D: Digest>(&self) -> SchemaFingerprint {
let mut d = D::new();
d.update(self.canonical_form());
Expand Down Expand Up @@ -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<Vec<String>>, namespace: &Namespace) -> Aliases {
aliases.map(|aliases| {
aliases
Expand Down Expand Up @@ -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),
Expand Down
8 changes: 4 additions & 4 deletions avro/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn max_prec_for_len(len: usize) -> Result<usize, Error> {
/// 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 {
Expand Down Expand Up @@ -366,7 +366,7 @@ impl TryFrom<Value> 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])
Expand Down Expand Up @@ -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<Self> {
Expand All @@ -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<Self> {
Expand Down

0 comments on commit 1fe7fb8

Please sign in to comment.