def METHOD_NAME(self, *, value):
    dims = ["x", "y", "w", "h"]
    if any(d in [k for v in value for k in v.keys()] for d in dims):
        for viewport in value:
            if not all(d in viewport for d in dims):
                missing_dims = [d for d in dims if d not in viewport]
                self.add_error(
                    error=f"Either none or all viewports must have x, y, w, and h keys. Viewport {viewport['viewport_name']} missing {', '.join(missing_dims)}.",
                    field="json",
                )
    else:
        for viewport in value:
            if any(d in viewport for d in dims):
                missing_dims = [d for d in dims if d not in viewport]
                self.add_error(
                    error=f"Either none or all viewports must have x, y, w, and h keys. Viewport {viewport['viewport_name']} missing {', '.join(missing_dims)}.",
                    field="json",
                )