jabajke

Untitled

Feb 8th, 2023
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. import enum
  2.  
  3.  
  4. class EnumSchemas(enum.Enum):
  5. CHARACTERISTIC_SCHEMA = {
  6. "$schema": "http://json-schema.org/draft-04/schema#",
  7. "type": "object",
  8. "properties": {
  9. "brand": {
  10. "type": "array",
  11. "items": {"type": "string"},
  12. "uniqueItems": true
  13. },
  14. "model": {
  15. "type": "array",
  16. "items": {"type": "string"}
  17. },
  18. "horse_power": {
  19. "type": "integer",
  20. "minimum": 1,
  21. "action": {
  22. "type": "array",
  23. "items": {"enum": ["gt", "gte", "lt", "lte", "eq", "in"]}
  24. },
  25. },
  26. "if": {
  27. "properties": {"horse_power": {"action": {"const": "in"}}},
  28. },
  29. "then": {
  30. "properties": {
  31. "interval": {
  32. "type": "array",
  33. "items": {"type": "integer"},
  34. "minItems": 2,
  35. "maxItems": 2
  36. }
  37. }
  38. },
  39. "color": {"type": "string"},
  40. "year_of_issue": {
  41. "type": "integer",
  42. "minimum": 1800,
  43. "action": {"enum": ["gt", "gte", "lt", "lte", "eq"]}
  44. },
  45. "transmission_type": {"enum": ["manual", "automatic", "cvt"]},
  46. "body_type": {"type": "string"},
  47. },
  48. }
  49.  
Advertisement
Add Comment
Please, Sign In to add comment