Skip to content

Commit

Permalink
Add checks for missing fields when constructing response.
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav committed Jun 2, 2023
1 parent 3f791e9 commit 6f46b71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ async def lookup_curies(
LOGGER.error("Solr REST error: %s", response.text)
response.raise_for_status()
response = response.json()
output = [ {"curie": doc["curie"], "label":doc["preferred_name"], "synonyms": doc["names"],
"types": [f"biolink:{d}" for d in doc["types"]]}
output = [ {"curie": doc.get("curie", ""), "label":doc.get("preferred_name", ""), "synonyms": doc.get("names", []),
"types": [f"biolink:{d}" for d in doc.get("types", [])]}
for doc in response["response"]["docs"]]
return output

Expand Down

0 comments on commit 6f46b71

Please sign in to comment.