File tree Expand file tree Collapse file tree 4 files changed +146
-271
lines changed
Expand file tree Collapse file tree 4 files changed +146
-271
lines changed Original file line number Diff line number Diff line change @@ -26,15 +26,31 @@ def post_validate_bco(request):
2626 """
2727
2828 bco_list = request .data ["POST_validate_bco" ]
29+
2930 results = {}
3031 any_failed = False
31- for bco in bco_list :
32- results = parse_bco (bco , results )
33- identifier = bco ["object_id" ]
3432
35- if results [identifier ]["number_of_errors" ] == 0 :
36- results [identifier ]["error_detail" ] = ["BCO Valid" ]
37- else :
33+ for bco in bco_list :
34+ try :
35+ results = parse_bco (bco , results )
36+
37+ if bco ["object_id" ] == '' :
38+ identifier = bco_list .index (bco )
39+ results [identifier ] = results ['' ]
40+ del results ['' ]
41+ else :
42+ identifier = bco ["object_id" ]
43+
44+ if results [identifier ]["number_of_errors" ] == 0 :
45+ results [identifier ]["error_detail" ] = ["BCO Valid" ]
46+ else :
47+ any_failed = True
48+
49+ except Exception as error :
50+ results [bco_list .index (bco )] = {
51+ "number_of_errors" : 1 ,
52+ "error_detail" : ["Bad request. BCO is not formatted correctly." ]
53+ }
3854 any_failed = True
3955
4056 if any_failed is True :
Original file line number Diff line number Diff line change @@ -1783,8 +1783,8 @@ class ValidateBCO(APIView):
17831783 ```JSON
17841784 {
17851785 "POST_validate_bco": [
1786- {...},
1787- {...}
1786+ {...BCO CONTENTS... },
1787+ {...BCO CONTENTS... }
17881788 ]
17891789 }
17901790
@@ -1810,10 +1810,10 @@ class ValidateBCO(APIView):
18101810 @swagger_auto_schema (
18111811 request_body = request_body ,
18121812 responses = {
1813- 201 : "Account has been authorized ." ,
1814- 208 : "Account has already been authorized." ,
1815- 403 : "Requestor 's credentials were rejected." ,
1816- 424 : "Account has not been registered." ,
1813+ 200 : "All BCO validations are successful ." ,
1814+ 207 : "Some or all BCO validations failed. Each object submitted"
1815+ " will have it 's own response object with it's own status"
1816+ " message: \n "
18171817 },
18181818 tags = ["BCO Management" ],
18191819 )
Original file line number Diff line number Diff line change 65246524 "state" : " PUBLISHED" ,
65256525 "last_update" : " 2022-06-28T23:44:58.161Z"
65266526 }
6527- }, {
6527+ },
6528+ {
65286529 "model" : " api.bco" ,
65296530 "pk" : 13 ,
65306531 "fields" : {
67556756 "last_update" : " 2022-06-28T23:44:58.161Z"
67566757 }
67576758 },
6759+ {
6760+ "model" : " api.bco" ,
6761+ "pk" : 14 ,
6762+ "fields" : {
6763+ "contents" : {
6764+ "object_id" : " " ,
6765+ "spec_version" : " https://w3id.org/ieee/ieee-2791-schema/2791object.json" ,
6766+ "etag" : " da75a2c36dd6bf449d1f7b150197096e11c51812" ,
6767+ "provenance_domain" : {
6768+ "name" : " " ,
6769+ "version" : " " ,
6770+ "license" : " " ,
6771+ "created" : " 2023-09-05T18:10:23" ,
6772+ "modified" : " 2023-09-05T18:10:23.167Z" ,
6773+ "contributors" : [
6774+ {
6775+ "name" : " " ,
6776+ "affiliation" : " " ,
6777+ "email" : " " ,
6778+ "contribution" : [],
6779+ "orcid" : " "
6780+ }
6781+ ]
6782+ },
6783+ "usability_domain" : [],
6784+ "description_domain" : {
6785+ "pipeline_steps" : []
6786+ },
6787+ "parametric_domain" : [],
6788+ "io_domain" : {},
6789+ "execution_domain" : {
6790+ "script" : [],
6791+ "script_driver" : " " ,
6792+ "software_prerequisites" : [],
6793+ "external_data_endpoints" : [],
6794+ "environment_variables" : {}
6795+ },
6796+ "extension_domain" : []
6797+ },
6798+ "object_class" : null ,
6799+ "object_id" : " http://127.0.0.1:8000/TEST_000002/DRAFT" ,
6800+ "owner_group" : " bco_api_user" ,
6801+ "owner_user" : " test50" ,
6802+ "prefix" : " DRAFT" ,
6803+ "schema" : " IEEE" ,
6804+ "state" : " DRAFT" ,
6805+ "last_update" : " 2023-09-24T09:16:04.123Z"
6806+ }
6807+ },
67586808 {
67596809 "model" : " api.groupinfo" ,
67606810 "pk" : 1 ,
You can’t perform that action at this time.
0 commit comments