1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "oldSpec": """{
10 \"openapi\": \"3.0.3\",
11 \"info\": {
12 \"title\": \"Order API\",
13 \"version\": \"1.0\"
14 },
15 \"paths\": {
16 \"/orders/{id}\": {
17 \"parameters\": [
18 {
19 \"name\": \"id\",
20 \"in\": \"path\",
21 \"required\": true,
22 \"schema\": {
23 \"type\": \"string\"
24 }
25 }
26 ],
27 \"get\": {
28 \"responses\": {
29 \"200\": {
30 \"description\": \"OK\",
31 \"content\": {
32 \"application/json\": {
33 \"schema\": {
34 \"type\": \"object\",
35 \"required\": [
36 \"id\",
37 \"status\"
38 ],
39 \"properties\": {
40 \"id\": {
41 \"type\": \"string\"
42 },
43 \"status\": {
44 \"type\": \"string\",
45 \"enum\": [
46 \"open\",
47 \"paid\"
48 ]
49 }
50 }
51 }
52 }
53 }
54 }
55 }
56 },
57 \"post\": {
58 \"requestBody\": {
59 \"required\": true,
60 \"content\": {
61 \"application/json\": {
62 \"schema\": {
63 \"type\": \"object\",
64 \"required\": [
65 \"status\"
66 ],
67 \"properties\": {
68 \"status\": {
69 \"type\": \"string\",
70 \"enum\": [
71 \"open\",
72 \"paid\"
73 ]
74 }
75 }
76 }
77 }
78 }
79 },
80 \"responses\": {
81 \"204\": {
82 \"description\": \"Updated\"
83 }
84 }
85 }
86 }
87 }
88}""",
89 "newSpec": """{
90 \"openapi\": \"3.0.3\",
91 \"info\": {
92 \"title\": \"Order API\",
93 \"version\": \"2.0\"
94 },
95 \"paths\": {
96 \"/orders/{id}\": {
97 \"parameters\": [
98 {
99 \"name\": \"id\",
100 \"in\": \"path\",
101 \"required\": true,
102 \"schema\": {
103 \"type\": \"string\"
104 }
105 }
106 ],
107 \"get\": {
108 \"responses\": {
109 \"200\": {
110 \"description\": \"OK\",
111 \"content\": {
112 \"application/json\": {
113 \"schema\": {
114 \"type\": \"object\",
115 \"required\": [
116 \"id\",
117 \"status\"
118 ],
119 \"properties\": {
120 \"id\": {
121 \"type\": \"string\"
122 },
123 \"status\": {
124 \"type\": \"string\",
125 \"enum\": [
126 \"open\",
127 \"paid\",
128 \"refunded\"
129 ]
130 }
131 }
132 }
133 }
134 }
135 }
136 },
137 \"parameters\": [
138 {
139 \"name\": \"X-Tenant\",
140 \"in\": \"header\",
141 \"required\": true,
142 \"schema\": {
143 \"type\": \"string\"
144 }
145 }
146 ]
147 },
148 \"post\": {
149 \"requestBody\": {
150 \"required\": true,
151 \"content\": {
152 \"application/json\": {
153 \"schema\": {
154 \"type\": \"object\",
155 \"required\": [
156 \"status\"
157 ],
158 \"properties\": {
159 \"status\": {
160 \"type\": \"string\",
161 \"enum\": [
162 \"open\"
163 ]
164 }
165 }
166 }
167 }
168 }
169 },
170 \"responses\": {
171 \"202\": {
172 \"description\": \"Queued\"
173 }
174 }
175 }
176 },
177 \"/health\": {
178 \"get\": {
179 \"responses\": {
180 \"200\": {
181 \"description\": \"Healthy\"
182 }
183 }
184 }
185 }
186 }
187}""",
188 "severityFilter": [
189 "high",
190 "warning",
191 "info",
192 ],
193}
194
195
196run = client.actor("afkdigital/openapi-breaking-change-detector").call(run_input=run_input)
197
198
199print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
200for item in client.dataset(run.default_dataset_id).iterate_items():
201 print(item)
202
203