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

example should be examples in Field()? #231

Closed
lcasassa opened this issue Dec 22, 2023 · 2 comments
Closed

example should be examples in Field()? #231

lcasassa opened this issue Dec 22, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@lcasassa
Copy link

lcasassa commented Dec 22, 2023

I get this warning message: /Users/...-ZX1ANZWw-py3.11/lib/python3.11/site-packages/pydantic/fields.py:799: PydanticDeprecatedSince20: Using extra keyword arguments on Field is deprecated and will be removed. Use json_schema_extra instead. (Extra keys: 'example'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.5/migration/

Should this line be examples instead of example? https://github.com/cloudevents/sdk-python/blob/main/cloudevents/pydantic/v2/event.py#L54C7-L54C12

Or maybe change the example argument to:

    data: typing.Optional[typing.Any] = Field(
        title=FIELD_DESCRIPTIONS["data"].get("title"),
        description=FIELD_DESCRIPTIONS["data"].get("description"),
        json_schema_extra={"example": FIELD_DESCRIPTIONS["data"].get("example")},
        default=None,
    )

?

Steps to Reproduce the Problem

python -Wa -c "from cloudevents.pydantic import CloudEvent"

Specifications

  • Platform: Mac M1
  • Python Version: 3.11

% poetry show cloudevents
name : cloudevents
version : 1.10.1
description : CloudEvents Python SDK

@xSAVIKx xSAVIKx added the good first issue Good for newcomers label Dec 27, 2023
@jason-tang5
Copy link

I'd be happy to work on this issue!

@xSAVIKx
Copy link
Member

xSAVIKx commented May 26, 2024

I believe it's now fixed with #235

@xSAVIKx xSAVIKx closed this as completed May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants