Skip to content

Commit

Permalink
test customezed_schema
Browse files Browse the repository at this point in the history
  • Loading branch information
bojiang committed Feb 25, 2021
1 parent 3d910e5 commit d1abb1b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/integration/projects/general/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ def predict_json(self, input_datas):
def customezed_route(self, input_datas):
return input_datas

@bentoml.api(
input=JsonInput(
request_schema={
"application/json": {
"schema": {
"type": "object",
"required": ["field1", "field2"],
"properties": {
"field1": {"type": "string"},
"field2": {"type": "uuid"},
},
},
}
}
),
batch=True,
)
def customezed_schema(self, input_datas):
return input_datas

@bentoml.api(input=JsonInput(), batch=True)
def predict_strict_json(self, input_datas, tasks: Sequence[InferenceTask] = None):
filtered_jsons = []
Expand Down
10 changes: 10 additions & 0 deletions tests/integration/projects/general_non_batch/tests/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ async def test_api_server_meta(host):
await pytest.assert_request("GET", f"http://{host}/")
await pytest.assert_request("GET", f"http://{host}/healthz")
await pytest.assert_request("GET", f"http://{host}/docs.json")


@pytest.mark.asyncio
async def test_customized_request_schema(host):
await pytest.assert_request(
"GET",
f"http://{host}/docs.json",
headers=(("Content-Type", "application/json"),),
assert_data="",
)

0 comments on commit d1abb1b

Please sign in to comment.