Skip to content

Commit 93247b7

Browse files
committed
NPA-3899 Return Correct Yaml Value
1 parent aaf4219 commit 93247b7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sandbox/api/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from typing import Any, Optional
33

44
from flask import Response, Request
5+
from yaml import CLoader as Loader
56
from yaml import load as yaml_load
67
from .constants import (
78
EMPTY_RESPONSE,
@@ -176,5 +177,7 @@ def generate_response_from_example(example_path: str, status_code: int) -> dict:
176177
Response: Resultant Response object based on input.
177178
"""
178179
with open(example_path, "r") as file:
179-
content = yaml_load(file)
180+
content = yaml_load(file, Loader)
181+
# Value of response is always in the first key, then within value
182+
content = content[list(content.keys())[0]]["value"]
180183
return Response(dumps(content), status=status_code, mimetype=FHIR_MIMETYPE)

0 commit comments

Comments
 (0)