Skip to content

Commit

Permalink
Merge pull request #3 from duckontheweb/raw-identifiers
Browse files Browse the repository at this point in the history
Use raw identifiers for type attribute
  • Loading branch information
duckontheweb authored Jun 26, 2021
2 parents 78af3e1 + 7889fa5 commit 1688b4a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rustac-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
//! let item: Item = serde_json::from_value(example)?;
//!
//! assert_eq!(item.stac_version, Version::parse("1.0.0-rc.2")?);
//! assert_eq!(item.type_, String::from("Feature"));
//! assert_eq!(item.r#type, String::from("Feature"));
//!
//! Ok(())
//! }
Expand Down
3 changes: 1 addition & 2 deletions rustac-core/src/types/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub struct Catalog {

/// Set to Catalog if this Catalog only implements the Catalog spec.
/// **This maps to the STAC `"type"` attribute, which is a reserved keyword.**
#[serde(rename = "type")]
pub type_: String,
pub r#type: String,

/// A list of extension identifiers the Catalog implements.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
3 changes: 1 addition & 2 deletions rustac-core/src/types/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ pub struct Collection {

/// Must be set to `"Collection"` to be a valid Collection.
/// **This maps to the STAC `"type"` attribute, which is a reserved keyword.**
#[serde(rename = "type")]
pub type_: String,
pub r#type: String,

/// A list of extension identifiers the Collection implements.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
6 changes: 2 additions & 4 deletions rustac-core/src/types/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ pub struct Asset {
/// [Media type](https://github.com/radiantearth/stac-spec/blob/v1.0.0-rc.1/item-spec/item-spec.md#asset-media-type) of the asset.
/// See the [common media types](https://github.com/radiantearth/stac-spec/blob/v1.0.0-rc.1/best-practices.md#common-media-types-in-stac)
/// in the best practice doc for commonly used asset types.
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
pub r#type: Option<String>,

/// The [semantic roles](https://github.com/radiantearth/stac-spec/blob/v1.0.0-rc.1/item-spec/item-spec.md#asset-role-types) of the asset,
/// similar to the use of rel in links.
Expand Down Expand Up @@ -122,9 +121,8 @@ pub struct Link {
pub rel: String,

/// [Media type](https://github.com/radiantearth/stac-spec/blob/v1.0.0-rc.1/catalog-spec/catalog-spec.md#media-types) of the referenced entity.
#[serde(rename = "type")]
#[serde(skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
pub r#type: Option<String>,

/// A human readable title to be used in rendered displays of the link.
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
3 changes: 1 addition & 2 deletions rustac-core/src/types/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ pub struct Item {
pub id: String,

/// Type of the GeoJSON Object. MUST be set to `"Feature"`.
#[serde(rename = "type")]
pub type_: String,
pub r#type: String,

/// Defines the full footprint of the asset represented by this item. Coordinates are specified in Longitude/Latitude or Longitude/Latitude/Elevation based on WGS 84.
pub geometry: Geometry,
Expand Down

0 comments on commit 1688b4a

Please sign in to comment.