function extractDocumentId(url) {
  const match = url.match(/\/documents\/(\d+)\//);
  if (match && match[1]) {
    return parseInt(match[1], 10);
  }
  throw new Error('Could not extract document ID from URL');
}
@swagger
/api/tagsCount:
  get:
    summary: Get count of tags
    description: |
      Retrieves the list of tags with their document counts.
      This endpoint returns all tags in the system along with 
      the number of documents associated with each tag.
    tags: 
      - API
      - Metadata
    security:
      - BearerAuth: []
    responses:
      200:
        description: List of tags with document counts retrieved successfully
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: integer
                    description: ID of the tag
                    example: 1
                  name:
                    type: string
                    description: Name of the tag
                    example: "Invoice"
                  count:
                    type: integer
                    description: Number of documents associated with this tag
                    example: 12
      401:
        description: Authentication required
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Error'
      403:
        description: Invalid or expired token
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Error'
      500:
        description: Server error
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Error'