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

Any parameter containing a JSON schema will be confused by Block loading #15763

Open
indigoviolet opened this issue Oct 20, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@indigoviolet
Copy link

Bug summary

from typing import Any

from prefect import flow
from pydantic import BaseModel


class Foo(BaseModel):
    a: int
    b: str


class Bar(BaseModel):
    c: Foo


class Baz(BaseModel):
    jsonschema: dict[str, Any]


@flow
def my_flow(b: Baz):
    pass


if __name__ == "__main__":
    b2 = Baz(jsonschema=Bar.model_json_schema())
    my_flow(b=b2)

This will fail because of

if isinstance(data, dict) and "$ref" in data:

It seems to me that this block loading code is casting too wide a net with $ref? or not encoding blocks in a specific-enough way?

Version info (prefect version output)

❯ prefect version                                      
Version:             3.0.10
API version:         0.8.4
Python version:      3.11.9
Git commit:          3aa2d893
Built:               Tue, Oct 15, 2024 1:31 PM
OS/Arch:             darwin/arm64
Profile:             ephemeral
Server type:         ephemeral
Pydantic version:    2.9.1
Server:
  Database:          sqlite
  SQLite version:    3.46.0
Integrations:
  prefect-gcp:       0.6.1

Additional context

No response

@indigoviolet indigoviolet added the bug Something isn't working label Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant