Is there a way to use a constant as a field of django ninja schema?

74 Views Asked by At

I have a class that has a constant:

class ClassA:
  CONSTANT = 'const_value'

I would like to have a django ninja schema that has the value of const as a field like:

class MySchema1(ninja.schema):
  const_value: str

but without repeating the value This doesn't work:

class MySchema2(ninja.schema):
  ClassA.CONSTANT: str
0

There are 0 best solutions below