From 7ab4e7486bae568ffb8b72cef0465a978aeaef0c Mon Sep 17 00:00:00 2001 From: Rohan Juneja Date: Thu, 28 Sep 2023 18:02:13 -0700 Subject: [PATCH] fix most tests --- __test__/data/biothings/drug_response_example_edge.json | 2 +- __test__/data/biothings/mychem_example_edge.json | 2 +- __test__/data/biothings/mygene_example_edge.json | 2 +- data/jq/pair/biothings.jq | 4 ++-- src/transformers/jq_transformer.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/__test__/data/biothings/drug_response_example_edge.json b/__test__/data/biothings/drug_response_example_edge.json index 16456cb..4b6da4f 100644 --- a/__test__/data/biothings/drug_response_example_edge.json +++ b/__test__/data/biothings/drug_response_example_edge.json @@ -8,7 +8,7 @@ "size": "1000" }, "_supportBatch": false, - "method": "get", + "_method": "get", "_pathParams": [], "_server": "https://biothings.ncats.io/drug_response_kp", "_path": "/query", diff --git a/__test__/data/biothings/mychem_example_edge.json b/__test__/data/biothings/mychem_example_edge.json index 2dce07d..47d58b9 100644 --- a/__test__/data/biothings/mychem_example_edge.json +++ b/__test__/data/biothings/mychem_example_edge.json @@ -17,7 +17,7 @@ }, "_supportBatch": true, "_inputSeparator": ",", - "method": "post", + "_method": "post", "_pathParams": [], "_server": "https://mychem.info/v1", "_path": "/query", diff --git a/__test__/data/biothings/mygene_example_edge.json b/__test__/data/biothings/mygene_example_edge.json index 36d44e2..b01b575 100644 --- a/__test__/data/biothings/mygene_example_edge.json +++ b/__test__/data/biothings/mygene_example_edge.json @@ -12,7 +12,7 @@ }, "_supportBatch": true, "_inputSeparator": ",", - "method": "post", + "_method": "post", "_pathParams": [], "_server": "https://mygene.info/v3", "_path": "/query", diff --git a/data/jq/pair/biothings.jq b/data/jq/pair/biothings.jq index eec14bc..cf57f40 100644 --- a/data/jq/pair/biothings.jq +++ b/data/jq/pair/biothings.jq @@ -9,7 +9,7 @@ if $edge.query_operation._method == "post" then if $edge.input | type == "object" then generateCurieWithInputs($edge.association.input_id; $item.query; $edge.input.queryInputs) as $curie | .[$curie] = .[$curie] + [$item] else - generateCurie($edge.association.input_id; $item.query) as $curie | .[$curie] = .[$curie] + [$item] + generateCurieWithInputs($edge.association.input_id; $item.query; $edge.input | toArray) as $curie | .[$curie] = .[$curie] + [$item] end end ) @@ -17,6 +17,6 @@ else if ($edge.input | type) == "object" then .response as $res | generateCurie($edge.association.input_id; $edge.input.queryInputs) as $curie | {} | .[$curie] = [$res] else - .response as $res | generateCurie($edge.association.input_id; $edge.input) as $curie | {} | .[$curie] = [$res] + .response as $res | generateCurie($edge.association.input_id; ($edge.input | toArray)[0]) as $curie | {} | .[$curie] = [$res] end end diff --git a/src/transformers/jq_transformer.ts b/src/transformers/jq_transformer.ts index 320811d..1489fde 100644 --- a/src/transformers/jq_transformer.ts +++ b/src/transformers/jq_transformer.ts @@ -23,7 +23,7 @@ const filterStringsPair = Object.fromEntries( export default class JQTransformer extends BaseTransformer { // TODO more specific typing? - async wrap(res: JSONDoc | JSONDoc[]): Promise { + async wrap(res: JSONDoc | JSONDoc[]): Promise { if (this.config.wrap) res = JSON.parse( (await jq.run(generateFilterString(this.config.wrap, this.edge), res, { input: "json" })) as string,