diff --git a/ninja_schema/orm/model_schema.py b/ninja_schema/orm/model_schema.py index 0666506..d466857 100755 --- a/ninja_schema/orm/model_schema.py +++ b/ninja_schema/orm/model_schema.py @@ -234,7 +234,7 @@ def clone_field(cls, field: FieldInfo, **kwargs: Any) -> FieldInfo: def model_fields(self) -> Iterator[Field]: """returns iterator with all the fields that can be part of schema""" - for fld in self.model._meta.get_fields(): + for fld in self.model._meta.get_fields(): # type: ignore if isinstance(fld, (ManyToOneRel, ManyToManyRel)): # skipping relations continue @@ -281,16 +281,16 @@ def is_field_in_optional(self, field_name: str) -> bool: def process_build_schema_parameters(self) -> None: model_pk = getattr( - self.model._meta.pk, + self.model._meta.pk, # type: ignore "name", - getattr(self.model._meta.pk, "attname"), + getattr(self.model._meta.pk, "attname"), # type: ignore ) # no type:ignore if ( model_pk not in self.include and model_pk not in self.exclude and ALL_FIELDS not in self.optional ): - self.optional.add(model_pk) + self.optional.add(str(model_pk)) class ModelSchemaMetaclass(ModelMetaclass):