Repository navigation
fix(py)!: a flow's input and output are checked - #6575
Merged
huangjeff5 merged 12 commits intoOct 7, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the Genkit framework across Django, FastAPI, Flask, and core packages to correctly handle omitted inputs and explicit null values, ensuring that Python default arguments are applied when no input is provided. It introduces a NO_INPUT sentinel to distinguish between omitted inputs and explicit None values. Additionally, it adds validation for flow return values against their return annotations, raising an internal error with an INVALID_OUTPUT reason on mismatch. Comprehensive tests are added to verify these behaviors across all supported web frameworks. There are no review comments to address, and I have no additional feedback to provide.
`await flow(x, context=...)` passes context on the plain call. An explicit `await flow(None)` is validated against the input annotation instead of being swapped for the Python default; `await flow()` still uses the default. Over HTTP and from the Dev UI, a missing input and a null input both still mean "no input". A flow's return value is validated against its return annotation: a matching dict comes back as the model, and a mismatch fails the run with GenkitError(INTERNAL, reason INVALID_OUTPUT). Served flows answer that with a plain 500.
huangjeff5
force-pushed
the
fix/py-flow-io-validated
branch
from
October 6, 2026 06:37
c906165 to
6b7b1ca
Compare
huangjeff5
changed the base branch from
fix/py-served-flow-errors
to
feat/py-request-data-fields
October 6, 2026 06:38
huangjeff5
marked this pull request as ready for review
October 6, 2026 08:15
# Conflicts: # py/packages/genkit/src/genkit/_core/_action.py
apascal07
approved these changes
Oct 6, 2026
…o fix/py-flow-io-validated # Conflicts: # py/packages/genkit-django/src/genkit_django/handler.py # py/packages/genkit-django/tests/django_test.py # py/packages/genkit-fastapi/tests/fastapi_test.py # py/packages/genkit-flask/src/genkit_flask/handler.py
# Conflicts: # py/packages/genkit-django/tests/django_test.py # py/packages/genkit/src/genkit/_core/_action.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A flow's input and return are checked. Extra return keys follow the model's own
extra=(default ignore). Receipt ignorestip_centsunlessextra='forbid'.Decisions
extra='forbid'(run fails) orextra='allow'(kept).null(model_dump()).nulls are dropped and alias models use their alias (model_dump(by_alias=True, exclude_none=True)).hide_input_in_errors=True) are omitted from the short error text.details.errorslists every ValidationError problem (loc/message/type, noinput).