Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(io): Pandas OpenAPI schema #3032

Merged
merged 5 commits into from
Sep 23, 2022

Conversation

jeffthebear
Copy link
Contributor

Bug Fix: PandasDataFrame orient does not change open api schema generation to expected format.
Bug Fix: PandasSeries orient does not change open api schema generation to expected format.
Separated openapi schema generation for each.
PandasSeries from_http_request() seem to be missing io.BytesIO. Added it.

What does this PR address?

When specifying the pandas PandasDataFrame and PandasSeries input spec the generated open api schemas do not match the expected schema with the provided orient parameter. This shows in the bento serve index webpage in the request body and successful response output sections. This PR seeks to address this by adding orient to the schema generation in addition to the existing the dtype dict parameter (Dataframe) or dtype str parameter (Series) to return the correct Schema.

Fixes #(issue)

Before submitting:

Bug Fix: PandasDataFrame orient does not change open api schema generation to expected format.
Bug Fix: PandasSeries orient does not change open api schema generation to expected format.
Separated openapi schema generation for each.
PandasSeries from_http_request() seem to be missing io.BytesIO.  Added
it.
@jeffthebear jeffthebear requested a review from a team as a code owner September 21, 2022 22:11
@jeffthebear jeffthebear requested review from bojiang and removed request for a team September 21, 2022 22:11
sauyon
sauyon previously approved these changes Sep 21, 2022
Copy link
Contributor

@sauyon sauyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great other than one minor nit, thank you!

bentoml/_internal/io_descriptors/pandas.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Merging #3032 (be1a289) into main (22c94b0) will decrease coverage by 9.27%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3032      +/-   ##
==========================================
- Coverage   62.82%   53.55%   -9.28%     
==========================================
  Files         145      109      -36     
  Lines       11831    10655    -1176     
==========================================
- Hits         7433     5706    -1727     
- Misses       4398     4949     +551     
Impacted Files Coverage Δ
bentoml/_internal/io_descriptors/pandas.py 34.12% <0.00%> (-23.70%) ⬇️
bentoml/_internal/server/runner_app.py 0.00% <0.00%> (-91.37%) ⬇️
bentoml/_internal/marshal/dispatcher.py 0.00% <0.00%> (-83.55%) ⬇️
bentoml/_internal/runner/runner_handle/remote.py 0.00% <0.00%> (-83.02%) ⬇️
bentoml/_internal/server/http/instruments.py 25.23% <0.00%> (-68.23%) ⬇️
bentoml/_internal/server/http/access.py 28.16% <0.00%> (-67.61%) ⬇️
bentoml/_internal/runner/runner_handle/local.py 0.00% <0.00%> (-66.67%) ⬇️
bentoml/_internal/log.py 32.81% <0.00%> (-54.69%) ⬇️
bentoml/_internal/utils/alg.py 0.00% <0.00%> (-53.66%) ⬇️
bentoml/_internal/utils/buildx.py 0.00% <0.00%> (-48.33%) ⬇️
... and 63 more

jeffthebear and others added 2 commits September 21, 2022 21:07
Co-authored-by: Sauyon Lee <2347889+sauyon@users.noreply.github.com>
aarnphm
aarnphm previously approved these changes Sep 22, 2022
Copy link
Member

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for spotting this out.

@aarnphm
Copy link
Member

aarnphm commented Sep 22, 2022

Can you run ./scripts/tools/formatter.sh?

@jeffthebear
Copy link
Contributor Author

Yes! Ran ./scripts/tools/formatter.sh.

Copy link
Member

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes LGTM. The CI seems to fail out of nowhere. I will investigate this later. Thanks for the contribution.

@aarnphm aarnphm changed the title fix(io_descriptor): Pandas open api orient schema fix(io): Pandas OpenAPI schema Sep 23, 2022
@aarnphm aarnphm merged commit 1714e5b into bentoml:main Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants