@ExecuteOn(TaskExecutors.IO)
    @Get(uri = "{namespace}/files/stats")
    @Operation(tags = {"Files"}, summary = "Get namespace file stats such as size, creation & modification dates and type")
    public FileAttributes stats(
        @Parameter(description = "The namespace id") @PathVariable String namespace,
        @Parameter(description = "The internal storage uri") @Nullable @QueryValue URI path
    ) throws IOException, URISyntaxException {
        forbiddenPathsGuard(path);

        // if stats is performed upon namespace root, and it doesn't exist yet, we create it
        if (path == null) {
            if(!storageInterface.exists(tenantService.resolveTenant(), NamespaceFile.of(namespace).uri())) {
                storageInterface.createDirectory(tenantService.resolveTenant(), NamespaceFile.of(namespace).uri());
            }
            return storageInterface.getAttributes(tenantService.resolveTenant(), NamespaceFile.of(namespace).uri());
        }

        return storageInterface.getAttributes(tenantService.resolveTenant(), NamespaceFile.of(namespace, path).uri());
    }
@Test
    void stats() throws IOException {
        String hw = "Hello World";
        storageInterface.put(null, toNamespacedStorageUri(NAMESPACE, URI.create("/test.txt")), new ByteArrayInputStream(hw.getBytes()));
        FileAttributes res = client.toBlocking().retrieve(HttpRequest.GET("/api/v1/namespaces/" + NAMESPACE + "/files/stats?path=/test.txt"), TestFileAttributes.class);
        assertThat(res.getFileName(), is("test.txt"));
        assertThat(res.getType(), is(FileAttributes.FileType.File));
    }