Create a new API for Compliance status dashboard v2
Description
- Create a GraphQL field similar to
projectcompliancestandardsadherenceto fetch the rows fromproject_compliance_configuration_statustable for the given namespace. This table only stores results for the controls for projects that have requirements configured, therefore, we do not need to filter rows further and can display all the records in the default view. - We also need to support filters like
compliancestandardsadherenceinput.
Old description
- Create a new API, either REST or GraphQL whichever is feasible. As per our GraphQL docs "We want the GraphQL API to be the primary means of interacting programmatically with GitLab. To achieve this, it needs full coverage - anything possible in the REST API should also be possible in the GraphQL API."
- In case it is not technically feasible or requires too much effort to design the required API via GraphQL we should switch to using REST.
- This API would be used at the frontend to render the dashboard as per the designs.
- The following is the proposed structure of the API:
Proposed API schema
[
{
"name":"projectA",
"frameworks":[
{
"Name":"FrameworkA",
"Description":"Description of Framework A",
"Requirements":[
{
"Name":"Req A",
"Description":"Description of requirement A",
"Status":"2/2",
"checks":[
{
"enum":"at_least_two_approvals",
"name":"At least two approvals on MRs",
"status":"SUCCESS",
"date":"2024-10-19"
},
{
"enum":"prevent_approval_by_merge_request_author",
"name":"Prevent authors to approve",
"status":"SUCCESS",
"date":"2024-10-19"
}
]
}
]
},
{
"Name":"FrameworkB",
"Description":"Description of Framework B",
"requirements":[
{
"Name":"Req B",
"Status":"0/1",
"Checks":[
{
"enum":"at_least_two_approvals",
"name":"At least two approvals on MRs",
"result":"FAIL",
"date":"2024-10-19"
}
]
}
]
}
]
}
]
- Each project can have multiple frameworks, and each framework can have multiple requirements, and each requirement can have multiple checks.
- We need to fetch
project_compliance_standards_adherencefor the given group. We also need to fetch all the compliance frameworks for that group. We also need to the fetch all the projects for that group. Once we have all of this data we would need to re-arrange the data to match the API schema. This could potentially be a very slow process and might not scale but we are willing to do this for the initial MVC. In case the queries don't scale we have an alternate approach to create a separate table for storing the aggregated data and do all the aggregations in background, check this comment. - Discuss with frontend if the proposed API will be sufficient as per the proposed UI design.
Edited by Huzaifa Iftikhar