1
- from copy import deepcopy
2
1
from typing import Any , ClassVar , TypeAlias
3
2
4
3
from pydantic import Extra , Field
@@ -100,18 +99,137 @@ class Config(_BaseCommonApiExtension.Config):
100
99
ServiceOutputsGetDict : TypeAlias = dict [ServicePortKey , ServiceOutputGet ]
101
100
102
101
103
- _EXAMPLE : dict [str , Any ] = deepcopy (
104
- api_schemas_catalog_services .ServiceGet .Config .schema_extra ["example" ]
105
- )
106
- _EXAMPLE .update (
107
- {
102
+ _EXAMPLE_FILEPICKER : dict [str , Any ] = {
103
+ ** api_schemas_catalog_services .ServiceGet .Config .schema_extra ["example" ],
104
+ ** {
108
105
"inputs" : {
109
106
f"input{ i } " : example
110
107
for i , example in enumerate (ServiceInputGet .Config .schema_extra ["examples" ])
111
108
},
112
109
"outputs" : {"outFile" : ServiceOutputGet .Config .schema_extra ["example" ]},
113
- }
114
- )
110
+ },
111
+ }
112
+
113
+
114
+ _EXAMPLE_SLEEPER : dict [str , Any ] = {
115
+ "name" : "sleeper" ,
116
+ "thumbnail" : None ,
117
+ "description" : "A service which awaits for time to pass, two times." ,
118
+ "classifiers" : [],
119
+ "quality" : {},
120
+ "accessRights" : {"1" : {"execute_access" : True , "write_access" : False }},
121
+ "key" : "simcore/services/comp/itis/sleeper" ,
122
+ "version" : "2.2.1" ,
123
+ "version_display" : "2 Xtreme" ,
124
+ "integration-version" : "1.0.0" ,
125
+ "type" : "computational" ,
126
+ "authors" : [
127
+ {
128
+ "name" : "Author Bar" ,
129
+
130
+ "affiliation" : "ACME" ,
131
+ },
132
+ ],
133
+
134
+ "inputs" : {
135
+ "input_1" : {
136
+ "displayOrder" : 1 ,
137
+ "label" : "File with int number" ,
138
+ "description" : "Pick a file containing only one integer" ,
139
+ "type" : "data:text/plain" ,
140
+ "fileToKeyMap" : {"single_number.txt" : "input_1" },
141
+ "keyId" : "input_1" ,
142
+ },
143
+ "input_2" : {
144
+ "unitLong" : "second" ,
145
+ "unitShort" : "s" ,
146
+ "label" : "Sleep interval" ,
147
+ "description" : "Choose an amount of time to sleep in range [0:]" ,
148
+ "keyId" : "input_2" ,
149
+ "displayOrder" : 2 ,
150
+ "type" : "ref_contentSchema" ,
151
+ "contentSchema" : {
152
+ "title" : "Sleep interval" ,
153
+ "type" : "integer" ,
154
+ "x_unit" : "second" ,
155
+ "minimum" : 0 ,
156
+ },
157
+ "defaultValue" : 2 ,
158
+ },
159
+ "input_3" : {
160
+ "displayOrder" : 3 ,
161
+ "label" : "Fail after sleep" ,
162
+ "description" : "If set to true will cause service to fail after it sleeps" ,
163
+ "type" : "boolean" ,
164
+ "defaultValue" : False ,
165
+ "keyId" : "input_3" ,
166
+ },
167
+ "input_4" : {
168
+ "unitLong" : "meter" ,
169
+ "unitShort" : "m" ,
170
+ "label" : "Distance to bed" ,
171
+ "description" : "It will first walk the distance to bed" ,
172
+ "keyId" : "input_4" ,
173
+ "displayOrder" : 4 ,
174
+ "type" : "ref_contentSchema" ,
175
+ "contentSchema" : {
176
+ "title" : "Distance to bed" ,
177
+ "type" : "integer" ,
178
+ "x_unit" : "meter" ,
179
+ },
180
+ "defaultValue" : 0 ,
181
+ },
182
+ "input_5" : {
183
+ "unitLong" : "byte" ,
184
+ "unitShort" : "B" ,
185
+ "label" : "Dream (or nightmare) of the night" ,
186
+ "description" : "Defines the size of the dream that will be generated [0:]" ,
187
+ "keyId" : "input_5" ,
188
+ "displayOrder" : 5 ,
189
+ "type" : "ref_contentSchema" ,
190
+ "contentSchema" : {
191
+ "title" : "Dream of the night" ,
192
+ "type" : "integer" ,
193
+ "x_unit" : "byte" ,
194
+ "minimum" : 0 ,
195
+ },
196
+ "defaultValue" : 0 ,
197
+ },
198
+ },
199
+ "outputs" : {
200
+ "output_1" : {
201
+ "displayOrder" : 1 ,
202
+ "label" : "File containing one random integer" ,
203
+ "description" : "Integer is generated in range [1-9]" ,
204
+ "type" : "data:text/plain" ,
205
+ "fileToKeyMap" : {"single_number.txt" : "output_1" },
206
+ "keyId" : "output_1" ,
207
+ },
208
+ "output_2" : {
209
+ "unitLong" : "second" ,
210
+ "unitShort" : "s" ,
211
+ "label" : "Random sleep interval" ,
212
+ "description" : "Interval is generated in range [1-9]" ,
213
+ "keyId" : "output_2" ,
214
+ "displayOrder" : 2 ,
215
+ "type" : "ref_contentSchema" ,
216
+ "contentSchema" : {
217
+ "title" : "Random sleep interval" ,
218
+ "type" : "integer" ,
219
+ "x_unit" : "second" ,
220
+ },
221
+ },
222
+ "output_3" : {
223
+ "displayOrder" : 3 ,
224
+ "label" : "Dream output" ,
225
+ "description" : "Contains some random data representing a dream" ,
226
+ "type" : "data:text/plain" ,
227
+ "fileToKeyMap" : {"dream.txt" : "output_3" },
228
+ "keyId" : "output_3" ,
229
+ },
230
+ },
231
+
232
+ }
115
233
116
234
117
235
class ServiceGet (api_schemas_catalog_services .ServiceGet ):
@@ -124,7 +242,7 @@ class ServiceGet(api_schemas_catalog_services.ServiceGet):
124
242
)
125
243
126
244
class Config (OutputSchema .Config ):
127
- schema_extra : ClassVar [dict [str , Any ]] = {"example" : _EXAMPLE }
245
+ schema_extra : ClassVar [dict [str , Any ]] = {"example" : _EXAMPLE_FILEPICKER }
128
246
129
247
130
248
class ServiceUpdate (api_schemas_catalog_services .ServiceUpdate ):
@@ -148,39 +266,51 @@ class DEVServiceGet(ServiceGet):
148
266
149
267
class Config (OutputSchema .Config ):
150
268
schema_extra : ClassVar [dict [str , Any ]] = {
151
- "example" : {
152
- ** _EXAMPLE , # 1.0.0
153
- "history" : [
154
- {
155
- "version" : "1.0.5" ,
156
- "version_display" : "Summer Release" ,
157
- "release_date" : "2024-07-20T15:00:00" ,
158
- },
159
- {
160
- "version" : _EXAMPLE ["version" ],
161
- "compatibility" : {
162
- "can_update_to" : "1.0.5" ,
269
+ "examples" : [
270
+ {
271
+ ** _EXAMPLE_SLEEPER , # v2.2.1 (latest)
272
+ "history" : [
273
+ {
274
+ "version" : _EXAMPLE_SLEEPER ["version" ],
275
+ "version_display" : "Summer Release" ,
276
+ "release_date" : "2024-07-20T15:00:00" ,
163
277
},
164
- },
165
- {"version" : "0.9.11" },
166
- {"version" : "0.9.10" },
167
- {
168
- "version" : "0.9.8" ,
169
- "compatibility" : {
170
- "can_update_to" : "0.9.10" ,
278
+ {
279
+ "version" : "2.0.0" ,
280
+ "compatibility" : {
281
+ "can_update_to" : _EXAMPLE_SLEEPER ["version" ],
282
+ },
171
283
},
172
- },
173
- {
174
- "version" : "0.9.1" ,
175
- "version_display " : "Matterhorn " ,
176
- "release_date " : "2024-01-20T18:49:17" ,
177
- "compatibility " : {
178
- "can_update_to" : "0.9.10" ,
284
+ { "version" : "0.9.11" },
285
+ { "version" : "0.9.10" },
286
+ {
287
+ "version " : "0.9.8 " ,
288
+ "compatibility " : {
289
+ "can_update_to " : "0.9.11" ,
290
+ } ,
179
291
},
180
- },
181
- {"version" : "0.9.0" },
182
- {"version" : "0.8.0" },
183
- {"version" : "0.1.0" },
184
- ],
185
- }
292
+ {
293
+ "version" : "0.9.1" ,
294
+ "version_display" : "Matterhorn" ,
295
+ "release_date" : "2024-01-20T18:49:17" ,
296
+ "compatibility" : {
297
+ "can_update_to" : "0.9.11" ,
298
+ },
299
+ },
300
+ {"version" : "0.9.0" },
301
+ {"version" : "0.8.0" },
302
+ {"version" : "0.1.0" },
303
+ ],
304
+ },
305
+ {
306
+ ** _EXAMPLE_FILEPICKER ,
307
+ "history" : [
308
+ {
309
+ "version" : _EXAMPLE_FILEPICKER ["version" ],
310
+ "version_display" : "Odei Release" ,
311
+ "release_date" : "2025-03-25T00:00:00" ,
312
+ }
313
+ ],
314
+ },
315
+ ]
186
316
}
0 commit comments