(self, **kwargs)
return res
---
        get:
          tags: ["Vulnerability"]
          summary: "Group vulnerabilities by the field set in the group_by GET parameter."
          responses:
            200:
              description: Ok
              content:
                application/json:
                  schema: VulnerabilityWeb
            404:
              description: group_by is not specified
        tags: ["Vulnerability"]
        responses:
          200:
            description: Ok
---
        get:
          tags: ["Vulnerability"]
          summary: "Group vulnerabilities by the field set in the group_by GET parameter."
          responses:
            200:
              description: Ok
              content:
                application/json:
                  schema: VulnerabilityWeb
            404:
              description: group_by is not specified
        tags: ["Vulnerability"]
        responses:
          200:
            description: Ok
--- get : tags : [ Vulnerability ] summary : Group vulnerabilities by the field set in the group_by GET parameter . responses : 200 : description : Ok content : application / json : schema : VulnerabilityWeb 404 : description : group_by is not specified tags : [ Vulnerability ] responses : 200 : description : Ok
def count(self, **kwargs):
        """
        ---
        get:
          tags: ["Vulnerability"]
          summary: "Group vulnerabilities by the field set in the group_by GET parameter."
          responses:
            200:
              description: Ok
              content:
                application/json:
                  schema: VulnerabilityWeb
            404:
              description: group_by is not specified
        tags: ["Vulnerability"]
        responses:
          200:
            description: Ok
        """
        res = super().count(**kwargs)

        def convert_group(group):
            group = group.copy()
            severity_map = {
                "informational": "info",
                "medium": "med"
            }
            severity = group['severity']
            group['severity'] = group['name'] = severity_map.get(
                severity, severity)
            return group

        if request.args.get('group_by') == 'severity':
            res['groups'] = [convert_group(group) for group in res['groups']]
        return res
def count ( self , * * kwargs ) : res = super ( ) . count ( * * kwargs ) def convert_group ( group ) : group = group . copy ( ) severity_map = { "informational" : "info" , "medium" : "med" } severity = group [ 'severity' ] group [ 'severity' ] = group [ 'name' ] = severity_map . get ( severity , severity ) return group if request . args . get ( 'group_by' ) == 'severity' : res [ 'groups' ] = [ convert_group ( group ) for group in res [ 'groups' ] ] return res