schema.py 533 B

123456789101112131415161718192021222324
  1. from ninja import Field, ModelSchema
  2. from glitchtip.schema import CamelSchema
  3. from .models import Environment, EnvironmentProject
  4. class EnvironmentSchema(ModelSchema):
  5. class Meta:
  6. model = Environment
  7. fields = ["id", "name"]
  8. class EnvironmentProjectIn(CamelSchema):
  9. name: str
  10. is_hidden: bool
  11. class EnvironmentProjectSchema(CamelSchema, ModelSchema):
  12. name: str = Field(validation_alias="environment.name")
  13. class Meta:
  14. model = EnvironmentProject
  15. fields = ["id", "is_hidden"]