diff --git a/api/src/backend/api/schema_hooks.py b/api/src/backend/api/schema_hooks.py new file mode 100644 index 0000000000..f94db59562 --- /dev/null +++ b/api/src/backend/api/schema_hooks.py @@ -0,0 +1,95 @@ +def _pick_task_response_component(components): + schemas = components.get("schemas", {}) or {} + for candidate in ("TaskResponse",): + if candidate in schemas: + return candidate + return None + + +def _extract_task_example_from_components(components): + schemas = components.get("schemas", {}) or {} + candidate = "TaskResponse" + doc = schemas.get(candidate) + if isinstance(doc, dict) and "example" in doc: + return doc["example"] + + res = schemas.get(candidate) + if isinstance(res, dict) and "example" in res: + example = res["example"] + return example if "data" in example else {"data": example} + + # Fallback + return { + "data": { + "type": "tasks", + "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", + "attributes": { + "inserted_at": "2019-08-24T14:15:22Z", + "completed_at": "2019-08-24T14:15:22Z", + "name": "string", + "state": "available", + "result": None, + "task_args": None, + "metadata": None, + }, + } + } + + +def attach_task_202_examples(result, generator, request, public): # noqa: F841 + if not isinstance(result, dict): + return result + + components = result.get("components", {}) or {} + task_resp_component = _pick_task_response_component(components) + task_example = _extract_task_example_from_components(components) + + paths = result.get("paths", {}) or {} + for path_item in paths.values(): + if not isinstance(path_item, dict): + continue + + for method_obj in path_item.values(): + if not isinstance(method_obj, dict): + continue + + responses = method_obj.get("responses", {}) or {} + resp_202 = responses.get("202") + if not isinstance(resp_202, dict): + continue + + content = resp_202.get("content", {}) or {} + jsonapi = content.get("application/vnd.api+json") + if not isinstance(jsonapi, dict): + continue + + # Inject example if missing + if "examples" not in jsonapi and "example" not in jsonapi: + jsonapi["examples"] = { + "Task queued": { + "summary": "Task queued", + "value": task_example, + } + } + + # Rewrite schema $ref if needed + if task_resp_component: + schema = jsonapi.get("schema") + must_replace = False + if not isinstance(schema, dict): + must_replace = True + else: + ref = schema.get("$ref") + if not ref: + must_replace = True + else: + current = ref.split("/")[-1] + if current != task_resp_component: + must_replace = True + + if must_replace: + jsonapi["schema"] = { + "$ref": f"#/components/schemas/{task_resp_component}" + } + + return result diff --git a/api/src/backend/api/specs/v1.yaml b/api/src/backend/api/specs/v1.yaml index cf64a00ffd..b09998234a 100644 --- a/api/src/backend/api/specs/v1.yaml +++ b/api/src/backend/api/specs/v1.yaml @@ -147,7 +147,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/PaginatedTaskList' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: The task is in progress '500': description: Compliance overviews generation task failed @@ -230,6 +245,25 @@ paths: $ref: '#/components/schemas/OpenApiResponseResponse' description: Compliance overviews metadata obtained successfully '202': + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: The task is in progress '500': description: Compliance overviews generation task failed @@ -360,6 +394,25 @@ paths: $ref: '#/components/schemas/PaginatedComplianceOverviewDetailList' description: Compliance requirement details obtained successfully '202': + content: + application/vnd.api+json: + schema: + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: The task is in progress '500': description: Compliance overviews generation task failed @@ -417,6 +470,7 @@ paths: name: filter[delta] schema: type: string + x-spec-enum-id: fef6b0e2506af8bc nullable: true enum: - changed @@ -452,6 +506,7 @@ paths: name: filter[impact] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -540,6 +595,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -560,6 +616,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -715,6 +772,7 @@ paths: name: filter[severity] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -740,6 +798,7 @@ paths: name: filter[status] schema: type: string + x-spec-enum-id: ce612ddbfa464789 enum: - FAIL - MANUAL @@ -941,6 +1000,7 @@ paths: name: filter[delta] schema: type: string + x-spec-enum-id: fef6b0e2506af8bc nullable: true enum: - changed @@ -976,6 +1036,7 @@ paths: name: filter[impact] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -1061,6 +1122,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -1081,6 +1143,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -1236,6 +1299,7 @@ paths: name: filter[severity] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -1261,6 +1325,7 @@ paths: name: filter[status] schema: type: string + x-spec-enum-id: ce612ddbfa464789 enum: - FAIL - MANUAL @@ -1392,6 +1457,7 @@ paths: name: filter[delta] schema: type: string + x-spec-enum-id: fef6b0e2506af8bc nullable: true enum: - changed @@ -1427,6 +1493,7 @@ paths: name: filter[impact] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -1490,6 +1557,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -1510,6 +1578,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -1650,6 +1719,7 @@ paths: name: filter[severity] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -1675,6 +1745,7 @@ paths: name: filter[status] schema: type: string + x-spec-enum-id: ce612ddbfa464789 enum: - FAIL - MANUAL @@ -1794,6 +1865,7 @@ paths: name: filter[delta] schema: type: string + x-spec-enum-id: fef6b0e2506af8bc nullable: true enum: - changed @@ -1829,6 +1901,7 @@ paths: name: filter[impact] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -1917,6 +1990,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -1937,6 +2011,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -2092,6 +2167,7 @@ paths: name: filter[severity] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -2117,6 +2193,7 @@ paths: name: filter[status] schema: type: string + x-spec-enum-id: ce612ddbfa464789 enum: - FAIL - MANUAL @@ -2234,6 +2311,7 @@ paths: name: filter[delta] schema: type: string + x-spec-enum-id: fef6b0e2506af8bc nullable: true enum: - changed @@ -2269,6 +2347,7 @@ paths: name: filter[impact] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -2332,6 +2411,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -2352,6 +2432,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -2492,6 +2573,7 @@ paths: name: filter[severity] schema: type: string + x-spec-enum-id: c93e070ed135d9bf enum: - critical - high @@ -2517,6 +2599,7 @@ paths: name: filter[status] schema: type: string + x-spec-enum-id: ce612ddbfa464789 enum: - FAIL - MANUAL @@ -2633,6 +2716,7 @@ paths: name: filter[integration_type] schema: type: string + x-spec-enum-id: 6cfd0ff9cf4d6dcc enum: - amazon_s3 - aws_security_hub @@ -2649,6 +2733,7 @@ paths: type: array items: type: string + x-spec-enum-id: 6cfd0ff9cf4d6dcc enum: - amazon_s3 - aws_security_hub @@ -2893,7 +2978,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/OpenApiResponseResponse' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: '' /api/v1/invitations/accept: post: @@ -3096,7 +3196,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/OpenApiResponseResponse' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: '' /api/v1/overviews/findings: get: @@ -3161,6 +3276,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -3181,6 +3297,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -3326,6 +3443,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -3346,6 +3464,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -3507,6 +3626,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -3527,6 +3647,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -3625,6 +3746,7 @@ paths: name: filter[processor_type] schema: type: string + x-spec-enum-id: 53cda4a99fe3d655 enum: - mutelist description: '* `mutelist` - Mutelist' @@ -3634,6 +3756,7 @@ paths: type: array items: type: string + x-spec-enum-id: 53cda4a99fe3d655 enum: - mutelist description: |- @@ -4217,6 +4340,7 @@ paths: name: filter[provider] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -4473,7 +4597,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/OpenApiResponseResponse' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: '' /api/v1/providers/{id}/connection: post: @@ -4498,7 +4637,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/OpenApiResponseResponse' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: '' /api/v1/providers/secrets: get: @@ -4800,6 +4954,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -4820,6 +4975,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -5163,6 +5319,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -5183,6 +5340,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -5427,6 +5585,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -5447,6 +5606,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -5697,6 +5857,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -5717,6 +5878,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -6527,6 +6689,7 @@ paths: name: filter[provider_type] schema: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -6547,6 +6710,7 @@ paths: type: array items: type: string + x-spec-enum-id: 4c1e219dad1cc0e7 enum: - aws - azure @@ -6607,6 +6771,7 @@ paths: name: filter[state] schema: type: string + x-spec-enum-id: d38ba07264e1ed34 enum: - available - cancelled @@ -6627,6 +6792,7 @@ paths: type: array items: type: string + x-spec-enum-id: d38ba07264e1ed34 enum: - available - cancelled @@ -6649,6 +6815,7 @@ paths: name: filter[trigger] schema: type: string + x-spec-enum-id: 2e52c981d1c89bdf enum: - manual - scheduled @@ -6741,7 +6908,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/OpenApiResponseResponse' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: '' /api/v1/scans/{id}: get: @@ -6945,7 +7127,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/OpenApiResponseResponse' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: '' /api/v1/tasks: get: @@ -7110,7 +7307,22 @@ paths: content: application/vnd.api+json: schema: - $ref: '#/components/schemas/OpenApiResponseResponse' + $ref: '#/components/schemas/TaskResponse' + examples: + Task queued: + summary: Task queued + value: + data: + type: tasks + id: 497f6eca-6276-4993-bfeb-53cbbbba6f08 + attributes: + inserted_at: '2019-08-24T14:15:22Z' + completed_at: '2019-08-24T14:15:22Z' + name: string + state: available + result: null + task_args: null + metadata: null description: '' /api/v1/tenants: get: @@ -7532,6 +7744,7 @@ paths: name: filter[state] schema: type: string + x-spec-enum-id: 92a1c1fd12e13e25 enum: - accepted - expired @@ -8217,6 +8430,7 @@ paths: name: filter[role] schema: type: string + x-spec-enum-id: 12c359ee5dc51001 enum: - member - owner @@ -8378,11 +8592,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/ComplianceOverviewTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - compliance-overviews id: {} attributes: type: object @@ -8417,11 +8632,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/ComplianceOverviewAttributesTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - compliance-requirements-attributes id: {} attributes: type: object @@ -8447,10 +8663,6 @@ components: - version - description - attributes - ComplianceOverviewAttributesTypeEnum: - type: string - enum: - - compliance-requirements-attributes ComplianceOverviewDetail: type: object required: @@ -8459,11 +8671,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/ComplianceOverviewDetailTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - compliance-requirements-details id: {} attributes: type: object @@ -8486,16 +8699,13 @@ components: * `FAIL` - Fail * `PASS` - Pass * `MANUAL` - Manual + x-spec-enum-id: ce612ddbfa464789 required: - id - framework - version - description - status - ComplianceOverviewDetailTypeEnum: - type: string - enum: - - compliance-requirements-details ComplianceOverviewMetadata: type: object required: @@ -8504,11 +8714,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/ComplianceOverviewMetadataTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - compliance-overviews-metadata id: {} attributes: type: object @@ -8519,14 +8730,6 @@ components: type: string required: - regions - ComplianceOverviewMetadataTypeEnum: - type: string - enum: - - compliance-overviews-metadata - ComplianceOverviewTypeEnum: - type: string - enum: - - compliance-overviews Finding: type: object required: @@ -8535,11 +8738,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/FindingTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - findings id: type: string format: uuid @@ -8558,6 +8762,7 @@ components: description: |- * `new` - New * `changed` - Changed + x-spec-enum-id: fef6b0e2506af8bc nullable: true status: enum: @@ -8569,6 +8774,7 @@ components: * `FAIL` - Fail * `PASS` - Pass * `MANUAL` - Manual + x-spec-enum-id: ce612ddbfa464789 status_extended: type: string nullable: true @@ -8586,6 +8792,7 @@ components: * `medium` - Medium * `low` - Low * `informational` - Informational + x-spec-enum-id: c93e070ed135d9bf check_id: type: string maxLength: 100 @@ -8682,11 +8889,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/FindingDynamicFilterTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - finding-dynamic-filters id: {} attributes: type: object @@ -8709,10 +8917,6 @@ components: $ref: '#/components/schemas/FindingDynamicFilter' required: - data - FindingDynamicFilterTypeEnum: - type: string - enum: - - finding-dynamic-filters FindingMetadata: type: object required: @@ -8721,11 +8925,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/FindingMetadataTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - findings-metadata id: {} attributes: type: object @@ -8753,10 +8958,6 @@ components: $ref: '#/components/schemas/FindingMetadata' required: - data - FindingMetadataTypeEnum: - type: string - enum: - - findings-metadata FindingResponse: type: object properties: @@ -8764,10 +8965,6 @@ components: $ref: '#/components/schemas/Finding' required: - data - FindingTypeEnum: - type: string - enum: - - findings Integration: type: object required: @@ -8776,11 +8973,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeC82Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - integrations id: type: string format: uuid @@ -8816,6 +9014,7 @@ components: * `aws_security_hub` - AWS Security Hub * `jira` - JIRA * `slack` - Slack + x-spec-enum-id: 6cfd0ff9cf4d6dcc configuration: {} required: - integration_type @@ -8859,11 +9058,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeC82Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - integrations attributes: type: object properties: @@ -8898,6 +9098,7 @@ components: * `aws_security_hub` - AWS Security Hub * `jira` - JIRA * `slack` - Slack + x-spec-enum-id: 6cfd0ff9cf4d6dcc configuration: oneOf: - type: object @@ -8924,8 +9125,8 @@ components: send_only_fails: type: boolean default: false - description: If true, only findings with status 'FAIL' will - be sent to Security Hub. + description: If true, only findings with status 'FAIL' will be + sent to Security Hub. archive_previous_findings: type: boolean default: false @@ -9056,6 +9257,7 @@ components: * `aws_security_hub` - AWS Security Hub * `jira` - JIRA * `slack` - Slack + x-spec-enum-id: 6cfd0ff9cf4d6dcc configuration: oneOf: - type: object @@ -9190,11 +9392,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeC82Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - integrations id: {} attributes: type: object @@ -9230,6 +9433,7 @@ components: * `aws_security_hub` - AWS Security Hub * `jira` - JIRA * `slack` - Slack + x-spec-enum-id: 6cfd0ff9cf4d6dcc readOnly: true configuration: oneOf: @@ -9257,8 +9461,8 @@ components: send_only_fails: type: boolean default: false - description: If true, only findings with status 'FAIL' will - be sent to Security Hub. + description: If true, only findings with status 'FAIL' will be + sent to Security Hub. archive_previous_findings: type: boolean default: false @@ -9350,11 +9554,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeD4dEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - invitations id: type: string format: uuid @@ -9385,6 +9590,7 @@ components: * `accepted` - Invitation was accepted by a user * `expired` - Invitation expired after the configured time * `revoked` - Invitation was revoked by a user + x-spec-enum-id: 92a1c1fd12e13e25 token: type: string readOnly: true @@ -9485,11 +9691,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeD4dEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - invitations attributes: type: object properties: @@ -9514,6 +9721,7 @@ components: * `accepted` - Invitation was accepted by a user * `expired` - Invitation expired after the configured time * `revoked` - Invitation was revoked by a user + x-spec-enum-id: 92a1c1fd12e13e25 readOnly: true token: type: string @@ -9620,6 +9828,7 @@ components: * `accepted` - Invitation was accepted by a user * `expired` - Invitation expired after the configured time * `revoked` - Invitation was revoked by a user + x-spec-enum-id: 92a1c1fd12e13e25 readOnly: true token: type: string @@ -9710,11 +9919,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeD4dEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - invitations id: type: string format: uuid @@ -9740,6 +9950,7 @@ components: * `accepted` - Invitation was accepted by a user * `expired` - Invitation expired after the configured time * `revoked` - Invitation was revoked by a user + x-spec-enum-id: 92a1c1fd12e13e25 readOnly: true token: type: string @@ -9790,11 +10001,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type4bfEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - lighthouse-configurations id: type: string format: uuid @@ -9821,6 +10033,7 @@ components: - gpt-5-mini-2025-08-07 - gpt-5-mini type: string + x-spec-enum-id: bd2108eb25b2d472 description: |- Must be one of the supported model names @@ -9866,11 +10079,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type4bfEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - lighthouse-configurations attributes: type: object properties: @@ -9895,6 +10109,7 @@ components: - gpt-5-mini-2025-08-07 - gpt-5-mini type: string + x-spec-enum-id: bd2108eb25b2d472 description: |- Must be one of the supported model names @@ -9975,6 +10190,7 @@ components: - gpt-5-mini-2025-08-07 - gpt-5-mini type: string + x-spec-enum-id: bd2108eb25b2d472 description: |- Must be one of the supported model names @@ -10031,11 +10247,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type4bfEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - lighthouse-configurations id: type: string format: uuid @@ -10063,6 +10280,7 @@ components: - gpt-5-mini-2025-08-07 - gpt-5-mini type: string + x-spec-enum-id: bd2108eb25b2d472 description: |- Must be one of the supported model names @@ -10105,11 +10323,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/MembershipTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - memberships attributes: type: object properties: @@ -10121,6 +10340,7 @@ components: description: |- * `owner` - Owner * `member` - Member + x-spec-enum-id: 12c359ee5dc51001 date_joined: type: string format: date-time @@ -10187,10 +10407,6 @@ components: $ref: '#/components/schemas/Membership' required: - data - MembershipTypeEnum: - type: string - enum: - - memberships OpenApiResponseResponse: type: object properties: @@ -10206,11 +10422,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/OverviewFindingTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - findings-overview id: {} attributes: type: object @@ -10265,10 +10482,6 @@ components: $ref: '#/components/schemas/OverviewFinding' required: - data - OverviewFindingTypeEnum: - type: string - enum: - - findings-overview OverviewProvider: type: object required: @@ -10277,11 +10490,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/OverviewProviderTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - providers-overview id: {} attributes: type: object @@ -10315,10 +10529,6 @@ components: $ref: '#/components/schemas/OverviewProvider' required: - data - OverviewProviderTypeEnum: - type: string - enum: - - providers-overview OverviewService: type: object required: @@ -10327,11 +10537,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/OverviewServiceTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - services-overview id: {} attributes: type: object @@ -10359,10 +10570,6 @@ components: $ref: '#/components/schemas/OverviewService' required: - data - OverviewServiceTypeEnum: - type: string - enum: - - services-overview OverviewSeverity: type: object required: @@ -10371,11 +10578,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/OverviewSeverityTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - findings-severity-overview id: {} attributes: type: object @@ -10406,10 +10614,6 @@ components: $ref: '#/components/schemas/OverviewSeverity' required: - data - OverviewSeverityTypeEnum: - type: string - enum: - - findings-severity-overview PaginatedComplianceOverviewAttributesList: type: object properties: @@ -10633,6 +10837,7 @@ components: * `aws_security_hub` - AWS Security Hub * `jira` - JIRA * `slack` - Slack + x-spec-enum-id: 6cfd0ff9cf4d6dcc readOnly: true configuration: oneOf: @@ -10785,6 +10990,7 @@ components: * `accepted` - Invitation was accepted by a user * `expired` - Invitation expired after the configured time * `revoked` - Invitation was revoked by a user + x-spec-enum-id: 92a1c1fd12e13e25 readOnly: true token: type: string @@ -10868,6 +11074,7 @@ components: - gpt-5-mini-2025-08-07 - gpt-5-mini type: string + x-spec-enum-id: bd2108eb25b2d472 description: |- Must be one of the supported model names @@ -11174,6 +11381,7 @@ components: * `static` - Key-value pairs * `role` - Role assumption * `service_account` - GCP Service Account Key + x-spec-enum-id: 20c74ebcd6671497 secret: oneOf: - type: object @@ -11806,11 +12014,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type552Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - processors id: type: string format: uuid @@ -11830,6 +12039,7 @@ components: - mutelist type: string description: '* `mutelist` - Mutelist' + x-spec-enum-id: 53cda4a99fe3d655 configuration: oneOf: - type: object @@ -11907,11 +12117,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type552Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - processors attributes: type: object properties: @@ -11928,6 +12139,7 @@ components: - mutelist type: string description: '* `mutelist` - Mutelist' + x-spec-enum-id: 53cda4a99fe3d655 configuration: oneOf: - type: object @@ -12030,6 +12242,7 @@ components: - mutelist type: string description: '* `mutelist` - Mutelist' + x-spec-enum-id: 53cda4a99fe3d655 configuration: oneOf: - type: object @@ -12124,11 +12337,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type552Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - processors id: {} attributes: type: object @@ -12225,11 +12439,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type227Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - providers id: type: string format: uuid @@ -12260,6 +12475,7 @@ components: * `kubernetes` - Kubernetes * `m365` - M365 * `github` - GitHub + x-spec-enum-id: 4c1e219dad1cc0e7 uid: type: string title: Unique identifier for the provider, set by the provider @@ -12347,11 +12563,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type227Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - providers attributes: type: object properties: @@ -12376,6 +12593,7 @@ components: * `kubernetes` - Kubernetes * `m365` - M365 * `github` - GitHub + x-spec-enum-id: 4c1e219dad1cc0e7 uid: type: string title: Unique identifier for the provider, set by the provider @@ -12423,6 +12641,7 @@ components: * `kubernetes` - Kubernetes * `m365` - M365 * `github` - GitHub + x-spec-enum-id: 4c1e219dad1cc0e7 uid: type: string minLength: 3 @@ -12447,11 +12666,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type34dEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - provider-groups id: type: string format: uuid @@ -12537,11 +12757,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type34dEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - provider-groups attributes: type: object properties: @@ -12828,11 +13049,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type049Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - provider-secrets id: type: string format: uuid @@ -12862,6 +13084,7 @@ components: * `static` - Key-value pairs * `role` - Role assumption * `service_account` - GCP Service Account Key + x-spec-enum-id: 20c74ebcd6671497 required: - secret_type relationships: @@ -12900,11 +13123,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type049Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - provider-secrets attributes: type: object properties: @@ -12931,6 +13155,7 @@ components: * `static` - Key-value pairs * `role` - Role assumption * `service_account` - GCP Service Account Key + x-spec-enum-id: 20c74ebcd6671497 secret: oneOf: - type: object @@ -13177,6 +13402,7 @@ components: * `static` - Key-value pairs * `role` - Role assumption * `service_account` - GCP Service Account Key + x-spec-enum-id: 20c74ebcd6671497 secret: oneOf: - type: object @@ -13406,11 +13632,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type049Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - provider-secrets id: type: string format: uuid @@ -13440,6 +13667,7 @@ components: * `static` - Key-value pairs * `role` - Role assumption * `service_account` - GCP Service Account Key + x-spec-enum-id: 20c74ebcd6671497 secret: oneOf: - type: object @@ -13657,11 +13885,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/ResourceTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - resources id: type: string format: uuid @@ -13767,11 +13996,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/ResourceMetadataTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - resources-metadata id: {} attributes: type: object @@ -13799,10 +14029,6 @@ components: $ref: '#/components/schemas/ResourceMetadata' required: - data - ResourceMetadataTypeEnum: - type: string - enum: - - resources-metadata ResourceResponse: type: object properties: @@ -13810,10 +14036,6 @@ components: $ref: '#/components/schemas/Resource' required: - data - ResourceTypeEnum: - type: string - enum: - - resources Role: type: object required: @@ -13822,11 +14044,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type6bbEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - roles id: type: string format: uuid @@ -13956,11 +14179,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type6bbEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - roles attributes: type: object properties: @@ -14299,11 +14523,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/SAMLConfigurationTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - saml-configurations id: type: string format: uuid @@ -14378,10 +14603,6 @@ components: $ref: '#/components/schemas/SAMLConfiguration' required: - data - SAMLConfigurationTypeEnum: - type: string - enum: - - saml-configurations Scan: type: object required: @@ -14390,11 +14611,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeE53Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - scans id: type: string format: uuid @@ -14414,6 +14636,7 @@ components: description: |- * `scheduled` - Scheduled * `manual` - Manual + x-spec-enum-id: 2e52c981d1c89bdf readOnly: true state: enum: @@ -14431,6 +14654,7 @@ components: * `completed` - Completed * `failed` - Failed * `cancelled` - Cancelled + x-spec-enum-id: d38ba07264e1ed34 readOnly: true unique_resource_count: type: integer @@ -14614,11 +14838,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TypeE53Enum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - scans id: type: string format: uuid @@ -14678,11 +14903,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TaskTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - tasks id: type: string format: uuid @@ -14723,10 +14949,6 @@ components: $ref: '#/components/schemas/Task' required: - data - TaskTypeEnum: - type: string - enum: - - tasks Tenant: type: object required: @@ -14735,11 +14957,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TenantTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - tenants id: type: string format: uuid @@ -14849,10 +15072,6 @@ components: $ref: '#/components/schemas/Tenant' required: - data - TenantTypeEnum: - type: string - enum: - - tenants Token: type: object required: @@ -14860,11 +15079,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TokenTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - tokens attributes: type: object properties: @@ -14896,11 +15116,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TokenRefreshTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - tokens-refresh attributes: type: object properties: @@ -14948,10 +15169,6 @@ components: $ref: '#/components/schemas/TokenRefresh' required: - data - TokenRefreshTypeEnum: - type: string - enum: - - tokens-refresh TokenRequest: type: object properties: @@ -15012,11 +15229,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/TokenSwitchTenantTypeEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - tokens-switch-tenant attributes: type: object properties: @@ -15076,54 +15294,6 @@ components: $ref: '#/components/schemas/TokenSwitchTenant' required: - data - TokenSwitchTenantTypeEnum: - type: string - enum: - - tokens-switch-tenant - TokenTypeEnum: - type: string - enum: - - tokens - Type049Enum: - type: string - enum: - - provider-secrets - Type227Enum: - type: string - enum: - - providers - Type34dEnum: - type: string - enum: - - provider-groups - Type4bfEnum: - type: string - enum: - - lighthouse-configurations - Type552Enum: - type: string - enum: - - processors - Type6bbEnum: - type: string - enum: - - roles - Type8cdEnum: - type: string - enum: - - users - TypeC82Enum: - type: string - enum: - - integrations - TypeD4dEnum: - type: string - enum: - - invitations - TypeE53Enum: - type: string - enum: - - scans User: type: object required: @@ -15132,11 +15302,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type8cdEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - users id: type: string format: uuid @@ -15230,11 +15401,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type8cdEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - users attributes: type: object properties: @@ -15348,11 +15520,12 @@ components: additionalProperties: false properties: type: - allOf: - - $ref: '#/components/schemas/Type8cdEnum' + type: string description: The [type](https://jsonapi.org/format/#document-resource-object-identification) member is used to describe resource objects that share common attributes and relationships. + enum: + - users id: type: string format: uuid @@ -15397,30 +15570,45 @@ tags: refreshing an existing token for authentication purposes. - name: Tenant description: Endpoints for managing tenants, along with their memberships. +- name: Membership + description: Endpoints for managing tenant memberships, allowing retrieval and filtering + of user membership information within tenants. - name: Invitation description: Endpoints for tenant invitations management, allowing retrieval and filtering of invitations, creating new invitations, accepting and revoking them. +- name: Role + description: Endpoints for managing RBAC roles within tenants, allowing creation, + retrieval, updating, and deletion of role configurations and permissions. - name: Provider description: Endpoints for managing providers (AWS, GCP, Azure, etc...). +- name: Provider Secret + description: Endpoints for managing provider secrets, allowing secure storage and + management of credentials for providers. - name: Provider Group description: Endpoints for managing provider groups. +- name: Task + description: Endpoints for task management, allowing retrieval of task status and + revoking tasks that have not started. - name: Scan description: Endpoints for triggering manual scans and viewing scan results. +- name: Schedule + description: Endpoints for managing scan schedules, allowing configuration of automated + scans with different scheduling options. - name: Resource description: Endpoints for managing resources discovered by scans, allowing retrieval and filtering of resource information. - name: Finding description: Endpoints for managing findings, allowing retrieval and filtering of findings that result from scans. -- name: Overview - description: Endpoints for retrieving aggregated summaries of resources from the - system. +- name: Processor + description: Endpoints for managing post-processors used to process Prowler findings, + including registration, configuration, and deletion of post-processing actions. - name: Compliance Overview description: Endpoints for checking the compliance overview, allowing filtering by scan, provider or compliance framework ID. -- name: Task - description: Endpoints for task management, allowing retrieval of task status and - revoking tasks that have not started. +- name: Overview + description: Endpoints for retrieving aggregated summaries of resources from the + system. - name: Integration description: Endpoints for managing third-party integrations, including registration, configuration, retrieval, and deletion of integrations such as S3, JIRA, or other @@ -15429,6 +15617,6 @@ tags: description: Endpoints for managing Lighthouse configurations, including creation, retrieval, updating, and deletion of configurations such as OpenAI keys, models, and business context. -- name: Processor - description: Endpoints for managing post-processors used to process Prowler findings, - including registration, configuration, and deletion of post-processing actions. +- name: SAML + description: Endpoints for Single Sign-On authentication management via SAML for + seamless user authentication. diff --git a/api/src/backend/api/v1/views.py b/api/src/backend/api/v1/views.py index 28cbc3ab5f..59706c8bc1 100644 --- a/api/src/backend/api/v1/views.py +++ b/api/src/backend/api/v1/views.py @@ -308,23 +308,48 @@ class SchemaView(SpectacularAPIView): "name": "Tenant", "description": "Endpoints for managing tenants, along with their memberships.", }, + { + "name": "Membership", + "description": "Endpoints for managing tenant memberships, allowing retrieval and filtering of " + "user membership information within tenants.", + }, { "name": "Invitation", "description": "Endpoints for tenant invitations management, allowing retrieval and filtering of " "invitations, creating new invitations, accepting and revoking them.", }, + { + "name": "Role", + "description": "Endpoints for managing RBAC roles within tenants, allowing creation, retrieval, " + "updating, and deletion of role configurations and permissions.", + }, { "name": "Provider", "description": "Endpoints for managing providers (AWS, GCP, Azure, etc...).", }, + { + "name": "Provider Secret", + "description": "Endpoints for managing provider secrets, allowing secure storage and management " + "of credentials for providers.", + }, { "name": "Provider Group", "description": "Endpoints for managing provider groups.", }, + { + "name": "Task", + "description": "Endpoints for task management, allowing retrieval of task status and " + "revoking tasks that have not started.", + }, { "name": "Scan", "description": "Endpoints for triggering manual scans and viewing scan results.", }, + { + "name": "Schedule", + "description": "Endpoints for managing scan schedules, allowing configuration of automated " + "scans with different scheduling options.", + }, { "name": "Resource", "description": "Endpoints for managing resources discovered by scans, allowing " @@ -336,8 +361,9 @@ class SchemaView(SpectacularAPIView): "findings that result from scans.", }, { - "name": "Overview", - "description": "Endpoints for retrieving aggregated summaries of resources from the system.", + "name": "Processor", + "description": "Endpoints for managing post-processors used to process Prowler findings, including " + "registration, configuration, and deletion of post-processing actions.", }, { "name": "Compliance Overview", @@ -345,9 +371,8 @@ class SchemaView(SpectacularAPIView): " compliance framework ID.", }, { - "name": "Task", - "description": "Endpoints for task management, allowing retrieval of task status and " - "revoking tasks that have not started.", + "name": "Overview", + "description": "Endpoints for retrieving aggregated summaries of resources from the system.", }, { "name": "Integration", @@ -357,12 +382,13 @@ class SchemaView(SpectacularAPIView): { "name": "Lighthouse", "description": "Endpoints for managing Lighthouse configurations, including creation, retrieval, " - "updating, and deletion of configurations such as OpenAI keys, models, and business context.", + "updating, and deletion of configurations such as OpenAI keys, models, and business " + "context.", }, { - "name": "Processor", - "description": "Endpoints for managing post-processors used to process Prowler findings, including " - "registration, configuration, and deletion of post-processing actions.", + "name": "SAML", + "description": "Endpoints for Single Sign-On authentication management via SAML for seamless user " + "authentication.", }, ] return super().get(request, *args, **kwargs) @@ -3033,7 +3059,9 @@ class RoleProviderGroupRelationshipView(RelationshipView, BaseRLSViewSet): description="Compliance overviews metadata obtained successfully", response=ComplianceOverviewMetadataSerializer, ), - 202: OpenApiResponse(description="The task is in progress"), + 202: OpenApiResponse( + description="The task is in progress", response=TaskSerializer + ), 500: OpenApiResponse( description="Compliance overviews generation task failed" ), @@ -3065,7 +3093,9 @@ class RoleProviderGroupRelationshipView(RelationshipView, BaseRLSViewSet): description="Compliance requirement details obtained successfully", response=ComplianceOverviewDetailSerializer(many=True), ), - 202: OpenApiResponse(description="The task is in progress"), + 202: OpenApiResponse( + description="The task is in progress", response=TaskSerializer + ), 500: OpenApiResponse( description="Compliance overviews generation task failed" ), diff --git a/api/src/backend/config/django/base.py b/api/src/backend/config/django/base.py index 514dcfc6ff..37d905ba58 100644 --- a/api/src/backend/config/django/base.py +++ b/api/src/backend/config/django/base.py @@ -116,6 +116,9 @@ SPECTACULAR_SETTINGS = { "PREPROCESSING_HOOKS": [ "drf_spectacular_jsonapi.hooks.fix_nested_path_parameters", ], + "POSTPROCESSING_HOOKS": [ + "api.schema_hooks.attach_task_202_examples", + ], "TITLE": "API Reference - Prowler", }