Skip to content

Incompatible default value for populate_by_name #93

@nocnokneo

Description

@nocnokneo

mypy complains with:

schema.py:1079: error: Invalid value for "Config.populate_by_name"  [pydantic-config]
schema.py:1079: error: Incompatible types (expression has type "None", TypedDict item "populate_by_name" has type "bool")  [typeddict-item]

Example snippet of incorrect code:

class GetUser(BaseModel):
    """No documentation found for this operation."""

    user: Optional[UserFragment] = Field(default=None)

    class Arguments(BaseModel):
        """Arguments for GetUser"""

        id: str
        model_config = ConfigDict(populate_by_name=None)

Using turms 0.9.0 with the following config:

projects:
  default:
    schema: schema.graphql
    documents: graphql/**.graphql
    extensions:
      # GraphQL codegen configuration
      # See: https://jhnnsrs.github.io/turms/docs/config
      turms:
        out_dir: api_types
        stylers:
          - type: turms.stylers.capitalize.CapitalizeStyler
        plugins:
          - type: turms.plugins.enums.EnumsPlugin
          - type: turms.plugins.inputs.InputsPlugin
          - type: turms.plugins.fragments.FragmentsPlugin
          - type: turms.plugins.operations.OperationsPlugin
          - type: turms.plugins.funcs.FuncsPlugin
        processors:
          - type: turms.processors.isort.IsortProcessor
          - type: cyto.apiclient.headerprocessor.HeaderProcessor
        scalar_definitions:
          Json: dict
          Timestamp: datetime.datetime
          Long: int
          ResourcePath: str

Using mypy 1.8.0 with the following config:

[tool.mypy]
check_untyped_defs = true
no_implicit_optional = true
disallow_untyped_defs = true
warn_return_any = true
warn_unused_ignores = true
incremental = false
plugins = [
    'numpy.typing.mypy_plugin',
    'pydantic.mypy'
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions