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

field "model_flags" conflicts with Pydantic 2 protected namespaces #267

Open
dnewood opened this issue Feb 12, 2024 · 0 comments
Open

field "model_flags" conflicts with Pydantic 2 protected namespaces #267

dnewood opened this issue Feb 12, 2024 · 0 comments

Comments

@dnewood
Copy link

dnewood commented Feb 12, 2024

Environment

  • DiffSync version: 2.0.0
  • Python version Python 3.10.12

Observed Behavior

Getting warning logs from Pydantic about protected namespace violations within the DiffSync library

Expected Behavior

No logging output at the warning level

Steps to Reproduce

  1. python3 -i
  2. from diffsync import DiffSyncModel

Extra Information

Pydantic introduces protected namespaces in their new documentation that places warning logs for things like model_ fields documentation here

potential workaround is to use the ConfigDict to set protected_namespaces to an empty value.

class Device(DiffSyncModel):
    """common model used for Diffsync"""
    
    # Disables new Pydantic v2 protections since diffsync uses model_ fields
    model_config = ConfigDict(
        protected_namespaces=()
    )

However, this does not prevent the log entries from the diffsync BaseModel here:

model_flags: DiffSyncModelFlags = DiffSyncModelFlags.NONE

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

No branches or pull requests

1 participant