Skip to content

Commit c26c985

Browse files
committed
fix fileid check
1 parent 96b5af7 commit c26c985

File tree

2 files changed

+324
-4
lines changed

2 files changed

+324
-4
lines changed

services/api-server/openapi.json

Lines changed: 321 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,15 @@
449449
"content": {
450450
"application/json": {
451451
"schema": {
452-
"$ref": "#/components/schemas/ClientFile"
452+
"anyOf": [
453+
{
454+
"$ref": "#/components/schemas/ClientFileInProgramJob"
455+
},
456+
{
457+
"$ref": "#/components/schemas/ClientFile"
458+
}
459+
],
460+
"title": "Client File"
453461
}
454462
}
455463
}
@@ -1248,6 +1256,189 @@
12481256
}
12491257
}
12501258
},
1259+
"/v0/programs": {
1260+
"get": {
1261+
"tags": [
1262+
"programs"
1263+
],
1264+
"summary": "List Programs",
1265+
"description": "Lists all available solvers (latest version)\n\nSEE get_solvers_page for paginated version of this function",
1266+
"operationId": "list_programs",
1267+
"responses": {
1268+
"200": {
1269+
"description": "Successful Response",
1270+
"content": {
1271+
"application/json": {
1272+
"schema": {
1273+
"items": {
1274+
"$ref": "#/components/schemas/Program"
1275+
},
1276+
"type": "array",
1277+
"title": "Response List Programs V0 Programs Get"
1278+
}
1279+
}
1280+
}
1281+
}
1282+
},
1283+
"security": [
1284+
{
1285+
"HTTPBasic": []
1286+
}
1287+
]
1288+
}
1289+
},
1290+
"/v0/programs/{program_key}/releases/{version}": {
1291+
"get": {
1292+
"tags": [
1293+
"programs"
1294+
],
1295+
"summary": "Get Program Release",
1296+
"description": "Gets a specific release of a solver",
1297+
"operationId": "get_program_release",
1298+
"security": [
1299+
{
1300+
"HTTPBasic": []
1301+
}
1302+
],
1303+
"parameters": [
1304+
{
1305+
"name": "program_key",
1306+
"in": "path",
1307+
"required": true,
1308+
"schema": {
1309+
"type": "string",
1310+
"pattern": "^simcore/services/dynamic/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
1311+
"title": "Program Key"
1312+
}
1313+
},
1314+
{
1315+
"name": "version",
1316+
"in": "path",
1317+
"required": true,
1318+
"schema": {
1319+
"type": "string",
1320+
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
1321+
"title": "Version"
1322+
}
1323+
}
1324+
],
1325+
"responses": {
1326+
"200": {
1327+
"description": "Successful Response",
1328+
"content": {
1329+
"application/json": {
1330+
"schema": {
1331+
"$ref": "#/components/schemas/Program"
1332+
}
1333+
}
1334+
}
1335+
},
1336+
"422": {
1337+
"description": "Validation Error",
1338+
"content": {
1339+
"application/json": {
1340+
"schema": {
1341+
"$ref": "#/components/schemas/HTTPValidationError"
1342+
}
1343+
}
1344+
}
1345+
}
1346+
}
1347+
}
1348+
},
1349+
"/v0/programs/{program_key}/releases/{version}/jobs": {
1350+
"post": {
1351+
"tags": [
1352+
"programs"
1353+
],
1354+
"summary": "Create Program Job",
1355+
"description": "Creates a job in a specific release with given inputs.\n\nNOTE: This operation does **not** start the job",
1356+
"operationId": "create_program_job",
1357+
"security": [
1358+
{
1359+
"HTTPBasic": []
1360+
}
1361+
],
1362+
"parameters": [
1363+
{
1364+
"name": "program_key",
1365+
"in": "path",
1366+
"required": true,
1367+
"schema": {
1368+
"type": "string",
1369+
"pattern": "^simcore/services/dynamic/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
1370+
"title": "Program Key"
1371+
}
1372+
},
1373+
{
1374+
"name": "version",
1375+
"in": "path",
1376+
"required": true,
1377+
"schema": {
1378+
"type": "string",
1379+
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
1380+
"title": "Version"
1381+
}
1382+
},
1383+
{
1384+
"name": "x-simcore-parent-project-uuid",
1385+
"in": "header",
1386+
"required": false,
1387+
"schema": {
1388+
"anyOf": [
1389+
{
1390+
"type": "string",
1391+
"format": "uuid"
1392+
},
1393+
{
1394+
"type": "null"
1395+
}
1396+
],
1397+
"title": "X-Simcore-Parent-Project-Uuid"
1398+
}
1399+
},
1400+
{
1401+
"name": "x-simcore-parent-node-id",
1402+
"in": "header",
1403+
"required": false,
1404+
"schema": {
1405+
"anyOf": [
1406+
{
1407+
"type": "string",
1408+
"format": "uuid"
1409+
},
1410+
{
1411+
"type": "null"
1412+
}
1413+
],
1414+
"title": "X-Simcore-Parent-Node-Id"
1415+
}
1416+
}
1417+
],
1418+
"responses": {
1419+
"201": {
1420+
"description": "Successful Response",
1421+
"content": {
1422+
"application/json": {
1423+
"schema": {
1424+
"$ref": "#/components/schemas/Job"
1425+
}
1426+
}
1427+
}
1428+
},
1429+
"422": {
1430+
"description": "Validation Error",
1431+
"content": {
1432+
"application/json": {
1433+
"schema": {
1434+
"$ref": "#/components/schemas/HTTPValidationError"
1435+
}
1436+
}
1437+
}
1438+
}
1439+
}
1440+
}
1441+
},
12511442
"/v0/solvers": {
12521443
"get": {
12531444
"tags": [
@@ -2014,9 +2205,9 @@
20142205
"tags": [
20152206
"solvers"
20162207
],
2017-
"summary": "Create Job",
2208+
"summary": "Create Solver Job",
20182209
"description": "Creates a job in a specific release with given inputs.\n\nNOTE: This operation does **not** start the job",
2019-
"operationId": "create_job",
2210+
"operationId": "create_solver_job",
20202211
"security": [
20212212
{
20222213
"HTTPBasic": []
@@ -5923,6 +6114,64 @@
59236114
"title": "ClientFile",
59246115
"description": "Represents a file stored on the client side"
59256116
},
6117+
"ClientFileInProgramJob": {
6118+
"properties": {
6119+
"filename": {
6120+
"type": "string",
6121+
"pattern": ".+",
6122+
"title": "Filename",
6123+
"description": "File name"
6124+
},
6125+
"filesize": {
6126+
"type": "integer",
6127+
"minimum": 0,
6128+
"title": "Filesize",
6129+
"description": "File size in bytes"
6130+
},
6131+
"sha256_checksum": {
6132+
"type": "string",
6133+
"pattern": "^[a-fA-F0-9]{64}$",
6134+
"title": "Sha256 Checksum",
6135+
"description": "SHA256 checksum"
6136+
},
6137+
"program_key": {
6138+
"type": "string",
6139+
"pattern": "^simcore/services/dynamic/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
6140+
"title": "Program Key",
6141+
"description": "Program identifier"
6142+
},
6143+
"program_version": {
6144+
"type": "string",
6145+
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
6146+
"title": "Program Version",
6147+
"description": "Program version"
6148+
},
6149+
"job_id": {
6150+
"type": "string",
6151+
"format": "uuid",
6152+
"title": "Job Id",
6153+
"description": "Job identifier"
6154+
},
6155+
"workspace_path": {
6156+
"type": "string",
6157+
"pattern": "^workspace/.*",
6158+
"format": "path",
6159+
"title": "Workspace Path",
6160+
"description": "The file's relative path within the job's workspace directory. E.g. 'workspace/myfile.txt'"
6161+
}
6162+
},
6163+
"type": "object",
6164+
"required": [
6165+
"filename",
6166+
"filesize",
6167+
"sha256_checksum",
6168+
"program_key",
6169+
"program_version",
6170+
"job_id",
6171+
"workspace_path"
6172+
],
6173+
"title": "ClientFileInProgramJob"
6174+
},
59266175
"ClientFileUploadData": {
59276176
"properties": {
59286177
"file_id": {
@@ -7522,6 +7771,75 @@
75227771
"type": "object",
75237772
"title": "ProfileUpdate"
75247773
},
7774+
"Program": {
7775+
"properties": {
7776+
"id": {
7777+
"type": "string",
7778+
"pattern": "^simcore/services/dynamic/([a-z0-9][a-z0-9_.-]*/)*([a-z0-9-_]+[a-z0-9])$",
7779+
"title": "Id",
7780+
"description": "Program identifier"
7781+
},
7782+
"version": {
7783+
"type": "string",
7784+
"pattern": "^(0|[1-9]\\d*)(\\.(0|[1-9]\\d*)){2}(-(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*)(\\.(0|[1-9]\\d*|\\d*[-a-zA-Z][-\\da-zA-Z]*))*)?(\\+[-\\da-zA-Z]+(\\.[-\\da-zA-Z-]+)*)?$",
7785+
"title": "Version",
7786+
"description": "semantic version number of the node"
7787+
},
7788+
"title": {
7789+
"type": "string",
7790+
"title": "Title",
7791+
"description": "Human readable name"
7792+
},
7793+
"description": {
7794+
"anyOf": [
7795+
{
7796+
"type": "string"
7797+
},
7798+
{
7799+
"type": "null"
7800+
}
7801+
],
7802+
"title": "Description"
7803+
},
7804+
"maintainer": {
7805+
"type": "string",
7806+
"title": "Maintainer"
7807+
},
7808+
"url": {
7809+
"anyOf": [
7810+
{
7811+
"type": "string",
7812+
"maxLength": 2083,
7813+
"minLength": 1,
7814+
"format": "uri"
7815+
},
7816+
{
7817+
"type": "null"
7818+
}
7819+
],
7820+
"title": "Url",
7821+
"description": "Link to get this resource"
7822+
}
7823+
},
7824+
"type": "object",
7825+
"required": [
7826+
"id",
7827+
"version",
7828+
"title",
7829+
"maintainer",
7830+
"url"
7831+
],
7832+
"title": "Program",
7833+
"description": "A released solver with a specific version",
7834+
"example": {
7835+
"description": "Simulation framework",
7836+
"id": "simcore/services/dynamic/sim4life",
7837+
"maintainer": "[email protected]",
7838+
"title": "Sim4life",
7839+
"url": "https://api.osparc.io/v0/solvers/simcore%2Fservices%2Fdynamic%2Fsim4life/releases/8.0.0",
7840+
"version": "8.0.0"
7841+
}
7842+
},
75257843
"RunningState": {
75267844
"type": "string",
75277845
"enum": [

services/api-server/src/simcore_service_api_server/services_http/storage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535

3636
AccessRight = Literal["read", "write"]
3737

38-
_FILE_ID_PATTERN = re.compile(r"^api\/(?P<file_id>[\w-]+)\/(?P<filename>.+)$")
38+
_FILE_ID_PATTERN = re.compile(
39+
r"^api\/(?P<file_id>[\w-]+)\/(?P<filename>.+)|(?P<project_id>[\w-]+)\/(?P<node_id>[\w-]+)\/workspace/.*$"
40+
)
3941

4042

4143
def to_file_api_model(stored_file_meta: StorageFileMetaData) -> File:

0 commit comments

Comments
 (0)