fix: Disable warnings for model_* properties (#17066)

For model classes with model_something fields, pydantic raises a warning by default:
`Field "model_something" has conflict with protected namespace "model_".`.

These warnings make no sense here, because most users of the generator have established APIs
that they cannot change to conform to pydantic's safety rules.

Pydantic will raise an error if we ever conflict with a current attribute like `model_dump`.
This commit is contained in:
Robert Schweizer
2023-11-14 14:50:35 +01:00
committed by GitHub
parent 6be4d2e082
commit 61fde48501
167 changed files with 334 additions and 167 deletions
@@ -36,7 +36,8 @@ class Bird(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -36,7 +36,8 @@ class Category(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -39,7 +39,8 @@ class DataQuery(Query):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -54,7 +54,8 @@ class DefaultValue(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -39,7 +39,8 @@ class NumberPropertiesOnly(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -53,7 +53,8 @@ class Pet(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -48,7 +48,8 @@ class Query(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -36,7 +36,8 @@ class Tag(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -38,7 +38,8 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}
@@ -35,7 +35,8 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel):
model_config = {
"populate_by_name": True,
"validate_assignment": True
"validate_assignment": True,
"protected_namespaces": (),
}