Closed tschmidtb51 closed 1 year ago
The remote validation code currently does not handle details of the validation.
To do so this code has to be extended.
_Originally posted by @s-l-teichmann in https://github.com/csaf-poc/csaf_distribution/pull/323#discussion_r1090619138_
Accepted would be a display of results in JSON Format.
@tschmidtb51 to post an example
A request with
curl -X 'POST' \
'http://localhost:8082/api/v1/validate' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"tests": [
{
"name": "basic",
"type": "preset"
}
],
"document": {
"additionalProp1": {}
}
}'
results in:
{
"isValid": false,
"tests": [
{
"errors": [
{
"instancePath": "",
"message": "must have required property 'document'"
},
{
"instancePath": "",
"message": "must NOT have additional properties"
}
],
"infos": [],
"warnings": [],
"isValid": false,
"name": "csaf_2_0_strict"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_1"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_10"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_11"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_12"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_13"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_14"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_15"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_16"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_17"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_18"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_19"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_2"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_20"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_21"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_22"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_23"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_24"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_25"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_26"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_1"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_10"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_11"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_2"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_3"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_4"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_5"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_6"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_7"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_8"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_9"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_28"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_29"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_3"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_30"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_31"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_32"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_33"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_4"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_5"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_6"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_7"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_9"
}
]
}
Here is another example using OASIS_CSAF_TC-CSAF_2.0-2021-6-1-03-01 as input:
{
"tests": [
{
"name": "mandatory",
"type": "preset"
}
],
"document": {
"document": {
"category": "csaf_base",
"csaf_version": "2.0",
"publisher": {
"category": "other",
"name": "OASIS CSAF TC",
"namespace": "https://csaf.io"
},
"title": "Mandatory test: Circular Definition of Product ID (failing example 1)",
"tracking": {
"current_release_date": "2021-07-21T10:00:00.000Z",
"id": "OASIS_CSAF_TC-CSAF_2.0-2021-6-1-03-01",
"initial_release_date": "2021-07-21T10:00:00.000Z",
"revision_history": [
{
"date": "2021-07-21T10:00:00.000Z",
"number": "1",
"summary": "Initial version."
}
],
"status": "final",
"version": "1"
}
},
"product_tree": {
"full_product_names": [
{
"product_id": "CSAFPID-9080700",
"name": "Product A"
}
],
"relationships": [
{
"category": "installed_on",
"full_product_name": {
"name": "Product B",
"product_id": "CSAFPID-9080701"
},
"product_reference": "CSAFPID-9080700",
"relates_to_product_reference": "CSAFPID-9080701"
}
]
}
}
}
Response:
{
"isValid": false,
"tests": [
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_1"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_10"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_11"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_12"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_13"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_14"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_15"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_16"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_17"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_18"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_19"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_2"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_20"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_21"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_22"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_23"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_24"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_25"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_26"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_1"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_10"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_11"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_2"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_3"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_4"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_5"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_6"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_7"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_8"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_27_9"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_28"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_29"
},
{
"errors": [
{
"instancePath": "/product_tree/relationships/0/relates_to_product_reference",
"message": "circular reference"
}
],
"infos": [],
"warnings": [],
"isValid": false,
"name": "mandatoryTest_6_1_3"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_30"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_31"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_32"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_33"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_4"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_5"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_6"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_7"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_8"
},
{
"errors": [],
"infos": [],
"warnings": [],
"isValid": true,
"name": "mandatoryTest_6_1_9"
}
]
}
@s-l-teichmann Is that sufficient for assessing the issue?
Please add an option to see the results of the remote validator (as one could use that to run optional or informative tests).
_Originally posted by @tschmidtb51 in https://github.com/csaf-poc/csaf_distribution/pull/323#discussion_r1090236695_