Files
2026-07-11 23:54:36 +07:00

22 lines
707 B
Python

import json
from core.base import BaseRenderer
from core.plugin_types import EmptyPluginConfig
from reporting.models import AuditReport, RenderedReport
class JsonRenderer(BaseRenderer):
content_type = "json"
media_type = "application/json"
file_extension = ".json"
aliases = ("application/json",)
config_model = EmptyPluginConfig
def render(self, report: AuditReport, config: EmptyPluginConfig) -> RenderedReport:
return RenderedReport(
format_name=self.content_type,
media_type=self.media_type,
file_extension=self.file_extension,
content=json.dumps(report.model_dump(mode="json"), ensure_ascii=True, indent=2),
)