Skip to content

Commit

Permalink
feat: move to v0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp committed Sep 21, 2024
1 parent ed109a2 commit e5cbf86
Show file tree
Hide file tree
Showing 52 changed files with 546 additions and 872 deletions.
57 changes: 22 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type-system.path = "libs/@blockprotocol/type-system/rust"
validation.path = "libs/@local/hash-validation"

# Pinned workspace members
error-stack = { version = "=0.5.0", default-features = false }
error-stack = { path = "./libs/error-stack", default-features = false }

# Public dependencies
ahash = { version = "=0.8.11", default-features = false }
Expand Down
8 changes: 6 additions & 2 deletions apps/hash-graph/libs/api/src/rest/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ where
actor_id,
// Manually deserialize the query from a JSON value to allow borrowed deserialization
// and better error reporting.
GetDataTypesParams::deserialize(&request).map_err(report_to_response)?,
GetDataTypesParams::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?,
)
.await
.map_err(report_to_response)
Expand Down Expand Up @@ -508,7 +510,9 @@ where
actor_id,
// Manually deserialize the query from a JSON value to allow borrowed deserialization
// and better error reporting.
GetDataTypeSubgraphParams::deserialize(&request).map_err(report_to_response)?,
GetDataTypeSubgraphParams::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?,
)
.await
.map_err(report_to_response)
Expand Down
24 changes: 18 additions & 6 deletions apps/hash-graph/libs/api/src/rest/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ where
S: StorePool + Send + Sync,
A: AuthorizationApiPool + Send + Sync,
{
let params = CreateEntityRequest::deserialize(&body).map_err(report_to_response)?;
let params = CreateEntityRequest::deserialize(&body)
.map_err(Report::from)
.map_err(report_to_response)?;

let authorization_api = authorization_api_pool
.acquire()
Expand Down Expand Up @@ -309,7 +311,9 @@ where
S: StorePool + Send + Sync,
A: AuthorizationApiPool + Send + Sync,
{
let params = Vec::<CreateEntityRequest>::deserialize(&body).map_err(report_to_response)?;
let params = Vec::<CreateEntityRequest>::deserialize(&body)
.map_err(Report::from)
.map_err(report_to_response)?;

let authorization_api = authorization_api_pool
.acquire()
Expand Down Expand Up @@ -359,7 +363,9 @@ where
S: StorePool + Send + Sync,
A: AuthorizationApiPool + Send + Sync,
{
let params = ValidateEntityParams::deserialize(&body).map_err(report_to_response)?;
let params = ValidateEntityParams::deserialize(&body)
.map_err(Report::from)
.map_err(report_to_response)?;

let authorization_api = authorization_api_pool
.acquire()
Expand Down Expand Up @@ -587,7 +593,9 @@ where
.await
.map_err(report_to_response)?;

let request = GetEntitiesRequest::deserialize(&request).map_err(report_to_response)?;
let request = GetEntitiesRequest::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?;
store
.get_entities(
actor_id,
Expand Down Expand Up @@ -723,7 +731,9 @@ where
.await
.map_err(report_to_response)?;

let request = GetEntitySubgraphRequest::deserialize(&request).map_err(report_to_response)?;
let request = GetEntitySubgraphRequest::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?;
store
.get_entity_subgraph(
actor_id,
Expand Down Expand Up @@ -809,7 +819,9 @@ where
store
.count_entities(
actor_id,
CountEntitiesParams::deserialize(&request).map_err(report_to_response)?,
CountEntitiesParams::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?,
)
.await
.map(Json)
Expand Down
8 changes: 6 additions & 2 deletions apps/hash-graph/libs/api/src/rest/entity_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,9 @@ where
actor_id,
// Manually deserialize the query from a JSON value to allow borrowed deserialization
// and better error reporting.
GetEntityTypesParams::deserialize(&request).map_err(report_to_response)?,
GetEntityTypesParams::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?,
)
.await
.map_err(report_to_response)
Expand Down Expand Up @@ -804,7 +806,9 @@ where
store
.get_entity_type_subgraph(
actor_id,
GetEntityTypeSubgraphParams::deserialize(&request).map_err(report_to_response)?,
GetEntityTypeSubgraphParams::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?,
)
.await
.map_err(report_to_response)
Expand Down
8 changes: 6 additions & 2 deletions apps/hash-graph/libs/api/src/rest/property_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ where
actor_id,
// Manually deserialize the query from a JSON value to allow borrowed deserialization
// and better error reporting.
GetPropertyTypesParams::deserialize(&request).map_err(report_to_response)?,
GetPropertyTypesParams::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?,
)
.await
.map_err(report_to_response)
Expand Down Expand Up @@ -499,7 +501,9 @@ where
store
.get_property_type_subgraph(
actor_id,
GetPropertyTypeSubgraphParams::deserialize(&request).map_err(report_to_response)?,
GetPropertyTypeSubgraphParams::deserialize(&request)
.map_err(Report::from)
.map_err(report_to_response)?,
)
.await
.map_err(report_to_response)
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-graph/libs/api/src/rest/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ where
response
}

pub(crate) fn report_to_response<C>(report: impl Into<Report<C>>) -> Response
pub(crate) fn report_to_response<C>(report: impl Into<Report<[C]>>) -> Response
where
C: Context,
{
Expand Down
2 changes: 1 addition & 1 deletion apps/hash-graph/libs/graph/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tokio-postgres = { workspace = true, public = true }

# Private workspace dependencies
codec = { workspace = true }
error-stack = { workspace = true, features = ["std", "serde"] }
error-stack = { workspace = true, features = ["std", "serde", "unstable"] }
graph-types = { workspace = true, features = ["postgres"] }
hash-status = { workspace = true }
temporal-versioning = { workspace = true, features = ["postgres"] }
Expand Down
Loading

0 comments on commit e5cbf86

Please sign in to comment.