jabajke

Untitled

Feb 8th, 2023
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 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":{
  40. "type": "array",
  41. "items": {"type": "string"},
  42. "uniqueItems": true
  43. },
  44. "year_of_issue": {
  45. "type": "integer",
  46. "minimum": 1800,
  47. "action": {"enum": ["gt", "gte", "lt", "lte", "eq"]}
  48. },
  49. "transmission_type": {"enum": ["manual", "automatic", "cvt"]},
  50. "body_type": {"enum": [
  51. "sedan",
  52. "coupe",
  53. "hatchback",
  54. "minivan",
  55. "pickup"
  56. ]},
  57. },
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment