django-ninja icon indicating copy to clipboard operation
django-ninja copied to clipboard

Schema class | value is not a valid enumeration member; permitted: ...

Open maifeeulasad opened this issue 3 years ago • 1 comments

If I try something like this:

class NoteSchema(Schema):
    ...
    visibility: Optional[Note.NoteVisibilityTypes]
...
class Note(BaseModel):
    class NoteVisibilityTypes(models.IntegerChoices):
        PUBLIC= 1
        PRIVATE= 2

Then it gives me an error saying: ninja_error

maifeeulasad avatar Jan 21 '22 03:01 maifeeulasad

Hi @maifeeulasad

Could you share more of your code ?

  • what is BaseModel ?
  • how you defined your view function ?

vitalik avatar Jan 21 '22 07:01 vitalik