jabajke

Untitled

Feb 8th, 2023
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 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": {"type": "string"},
  10. "model": {"type": "string"},
  11. "horse_power": {
  12. "type": "object",
  13. "properties": {
  14. "value": {
  15. "type": "integer",
  16. "minimum": 1
  17. },
  18. "actions": {
  19. "default": "in",
  20. "enum": ["gt", "gte", "lt", "lte", "eq", "in"]
  21. },
  22. },
  23. "if": {
  24. "properties": {"actions": {"const": "in"}},
  25. },
  26. "then": {
  27. "properties": {
  28. "interval": {
  29. "type": "array",
  30. "items": {"type": "integer"},
  31. "minItems": 2,
  32. "maxItems": 2
  33. }
  34. }
  35. },
  36. "required": ["value", "actions"]
  37. },
  38. "color": {
  39. "type": "array",
  40. "items": {"type": "string"},
  41. "uniqueItems": true
  42. },
  43. "year_of_issue": {
  44. "type": "integer",
  45. "minimum": 1800,
  46. "action": {"enum": ["gt", "gte", "lt", "lte", "eq"]}
  47. },
  48. "transmission_type": {"enum": ["manual", "automatic", "cvt"]},
  49. "body_type": {"enum": [
  50. "sedan",
  51. "coupe",
  52. "hatchback",
  53. "minivan",
  54. "pickup"
  55. ]},
  56. },
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment