Skip to content

Commit

Permalink
DAS-API: Reject requests if the fields are unknown (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikhil Acharya authored May 12, 2023
1 parent 71d9ed4 commit a7f88e0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions das_api/src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{DasApiError, RpcModule};
use crate::DasApiError;
use async_trait::async_trait;
use digital_asset_types::rpc::filter::SearchConditionType;
use digital_asset_types::rpc::response::AssetList;
Expand All @@ -12,7 +12,7 @@ mod api_impl;
pub use api_impl::*;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct GetAssetsByGroup {
pub group_key: String,
pub group_value: String,
Expand All @@ -24,7 +24,7 @@ pub struct GetAssetsByGroup {
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct GetAssetsByOwner {
pub owner_address: String,
pub sort_by: Option<AssetSorting>,
Expand All @@ -35,12 +35,12 @@ pub struct GetAssetsByOwner {
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct GetAsset {
pub id: String,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields, rename_all = "camelCase")]

pub struct GetAssetsByCreator {
pub creator_address: String,
Expand All @@ -53,7 +53,7 @@ pub struct GetAssetsByCreator {
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct SearchAssets {
pub negate: Option<bool>,
pub condition_type: Option<SearchConditionType>,
Expand Down Expand Up @@ -82,7 +82,7 @@ pub struct SearchAssets {
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields, rename_all = "camelCase")]

pub struct GetAssetsByAuthority {
pub authority_address: String,
Expand All @@ -94,7 +94,7 @@ pub struct GetAssetsByAuthority {
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct GetGrouping {
pub group_key: String,
pub group_value: String,
Expand Down

0 comments on commit a7f88e0

Please sign in to comment.