File size: 5,492 Bytes
614eceb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.invalid/calcchinesecalendar/web/v1/schema.json",
  "title": "CalcChineseCalendar static Web data v1",
  "type": "object",
  "oneOf": [
    {"$ref": "#/$defs/calendarMonth"},
    {"$ref": "#/$defs/eclipseYear"},
    {"$ref": "#/$defs/astroMonth"}
  ],
  "$defs": {
    "civil": {
      "type": "array",
      "prefixItems": [
        {"type": "integer"},
        {"type": "integer", "minimum": 1, "maximum": 12},
        {"type": "integer", "minimum": 1, "maximum": 31}
      ],
      "minItems": 3,
      "maxItems": 3
    },
    "lunarDate": {
      "description": "[lunar year, month number, day number, leap flag]",
      "type": "array",
      "prefixItems": [
        {"type": "integer"},
        {"type": "integer", "minimum": 1, "maximum": 12},
        {"type": "integer", "minimum": 1, "maximum": 30},
        {"type": "integer", "enum": [0, 1]}
      ],
      "minItems": 4,
      "maxItems": 4
    },
    "preciseEvent": {
      "type": "object",
      "required": ["kind", "code", "day", "sec", "civil", "jd_tdb", "jd_utc"],
      "properties": {
        "kind": {"enum": ["solar_term", "lunar_phase"]},
        "code": {"type": "string"},
        "day": {"type": "integer", "minimum": 1, "maximum": 31},
        "sec": {"type": "integer", "minimum": 0, "maximum": 86399},
        "civil": {"$ref": "#/$defs/civil"},
        "jd_tdb": {"type": "number"},
        "jd_utc": {"type": "number"},
        "utc_iso": {"type": "string"},
        "local_iso": {"type": "string"}
      },
      "additionalProperties": false
    },
    "daySummary": {
      "type": "object",
      "required": ["d", "w", "l", "fest", "terms", "phases", "solar_eclipses", "lunar_eclipses"],
      "properties": {
        "d": {"type": "integer", "minimum": 1, "maximum": 31},
        "w": {"type": "integer", "minimum": 0, "maximum": 6},
        "l": {"$ref": "#/$defs/lunarDate"},
        "fest": {"type": "array", "items": {"type": "string"}},
        "terms": {"type": "array", "items": {"type": "string"}},
        "phases": {"type": "array", "items": {"enum": ["new_moon", "fst_qtr", "full_moon", "lst_qtr"]}},
        "solar_eclipses": {"type": "array", "items": {"$ref": "#/$defs/eventRef"}},
        "lunar_eclipses": {"type": "array", "items": {"$ref": "#/$defs/eventRef"}}
      },
      "additionalProperties": false
    },
    "eventRef": {
      "type": "array",
      "prefixItems": [{"type": "string"}, {"type": "string"}],
      "minItems": 2,
      "maxItems": 2
    },
    "dayDetail": {
      "type": "object",
      "required": ["d", "sample", "lunar", "ganzhi", "moon", "festivals", "event_indexes", "eclipse_ids", "astro_ids", "huangli"],
      "properties": {
        "d": {"type": "integer"},
        "sample": {"type": "object"},
        "lunar": {"$ref": "#/$defs/lunarDate"},
        "ganzhi": {"type": "array", "minItems": 3, "maxItems": 3, "items": {"type": "integer", "minimum": 0, "maximum": 59}},
        "moon": {"type": "object"},
        "festivals": {"type": "array", "items": {"type": "string"}},
        "event_indexes": {"type": "array", "items": {"type": "integer", "minimum": 0}},
        "eclipse_ids": {"type": "array", "items": {"type": "string"}},
        "astro_ids": {"type": "array", "items": {"type": "string"}},
        "huangli": {
          "type": "object",
          "required": ["common", "profiles"],
          "properties": {
            "common": {"type": "object"},
            "profiles": {
              "type": "object",
              "required": ["folk", "ziping", "purple", "xieji"],
              "properties": {
                "folk": {"type": "object"},
                "ziping": {"type": "object"},
                "purple": {"type": "object"},
                "xieji": {"type": "object"}
              },
              "additionalProperties": false
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "calendarMonth": {
      "type": "object",
      "required": ["v", "y", "m", "meta", "days", "events", "detail"],
      "properties": {
        "v": {"const": 1},
        "y": {"type": "integer", "minimum": 1950, "maximum": 17000},
        "m": {"type": "integer", "minimum": 1, "maximum": 12},
        "meta": {"type": "object"},
        "days": {"type": "array", "items": {"$ref": "#/$defs/daySummary"}},
        "events": {"type": "array", "items": {"$ref": "#/$defs/preciseEvent"}},
        "detail": {"type": "array", "items": {"$ref": "#/$defs/dayDetail"}}
      },
      "additionalProperties": false
    },
    "eclipseYear": {
      "type": "object",
      "required": ["v", "y", "timezone", "date_assignment", "events"],
      "properties": {
        "v": {"const": 1},
        "y": {"type": "integer"},
        "timezone": {"const": "+08:00"},
        "date_assignment": {"const": "maximum_eclipse_local_civil_date"},
        "events": {"type": "array", "items": {"type": "object"}}
      },
      "additionalProperties": false
    },
    "astroMonth": {
      "type": "object",
      "required": ["v", "y", "m", "observer", "events"],
      "properties": {
        "v": {"const": 1},
        "y": {"type": "integer"},
        "m": {"type": "integer", "minimum": 1, "maximum": 12},
        "observer": {"type": ["object", "null"]},
        "events": {"type": "array", "items": {"type": "object"}}
      },
      "additionalProperties": false
    }
  }
}