fix input transforms for resource and variable

This commit is contained in:
Ruben Fiszel
2022-10-30 17:28:59 +01:00
parent 9a06c06cbd
commit e8bbda8a5b
2 changed files with 22 additions and 10 deletions
+17 -1
View File
@@ -1321,12 +1321,28 @@ paths:
- $ref: "#/components/parameters/Path"
responses:
"200":
description: resource deleted
description: resource
content:
application/json:
schema:
$ref: "#/components/schemas/Resource"
/w/{workspace}/resources/get_value/{path}:
get:
summary: get resource value
operationId: getResourceValue
tags:
- resource
parameters:
- $ref: "#/components/parameters/WorkspaceId"
- $ref: "#/components/parameters/Path"
responses:
"200":
description: resource value
content:
application/json:
schema: {}
/w/{workspace}/resources/exists/{path}:
get:
summary: does resource exists
+5 -9
View File
@@ -734,7 +734,7 @@ async fn transform_json_value(
Value::String(y) if y.starts_with("$var:") => {
let path = y.strip_prefix("$var:").unwrap();
let v = client
.get_variable(workspace, path, None)
.get_variable(workspace, path, Some(true))
.await
.map_err(to_anyhow)
.map(|v| v.into_inner())?
@@ -753,15 +753,11 @@ async fn transform_json_value(
));
}
let v = client
.get_resource(workspace, path)
.get_resource_value(workspace, path)
.await
.map_err(to_anyhow)?;
transform_json_value(
client,
workspace,
serde_json::to_value(v.into_inner()).map_err(to_anyhow)?,
)
.await
.map_err(to_anyhow)?
.into_inner();
transform_json_value(client, workspace, v).await
}
Value::Object(mut m) => {
for (a, b) in m.clone().into_iter() {