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

[Serve] Copy FastAPI ResponseModel field #16760

Merged

Conversation

simon-mo
Copy link
Contributor

@simon-mo simon-mo commented Jun 29, 2021

Why are these changes needed?

It turns out when you specify a response model for FastAPI, FastAPI makes a copy of that pydantic model. But when it's copying it, it missed the outer_type_ parameter. The missed parameter has no effect when you are using it in process but it is not compatible with how we serialize and copy pydantic fields in the serialization addons.

Related issue number

Closes #16757

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Comment on lines +176 to +177
# If there is a response model, FastAPI creates a copy of the fields.
# But FastAPI creates the field incorrectly by missing the outer_type_.
Copy link
Contributor

Choose a reason for hiding this comment

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

link issue?

@simon-mo simon-mo merged commit 2ac8a19 into ray-project:master Jun 29, 2021
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.

[Serve] Pydantic validation error for serve deployment
2 participants