From fbc8b4cb67130fbf4f34a81dbe683a1eb07ae5a3 Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Mon, 13 Jul 2026 14:42:43 +0100 Subject: [PATCH 1/3] Gate additional_properties on ellmer version --- R/s7-elmer_TypeObject.R | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/s7-elmer_TypeObject.R b/R/s7-elmer_TypeObject.R index 8a3d7aef..d6598a67 100644 --- a/R/s7-elmer_TypeObject.R +++ b/R/s7-elmer_TypeObject.R @@ -30,10 +30,8 @@ opts_ellmer_TypeObject <- function(constructor = c("type_object", "TypeObject", args <- c( list(.description = attr(x, "description")), attr(x, "properties"), - list( - .required = attr(x, "required"), - .additional_properties = attr(x, "additional_properties") - ) + list(.required = attr(x, "required")), + if (with_versions(ellmer < "0.4.2")) list(.additional_properties = attr(x, "additional_properties")) ) args <- keep_only_non_defaults(args, ellmer::type_object) names(args)[names(args) == ".description"] <- "" From e18c29d2cf4491b4e17819039f61fd88b2093dfe Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Mon, 13 Jul 2026 14:55:16 +0100 Subject: [PATCH 2/3] Version-gate tests --- tests/testthat/test-s7-elmer_TypeBasic.R | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/tests/testthat/test-s7-elmer_TypeBasic.R b/tests/testthat/test-s7-elmer_TypeBasic.R index 95b40168..d4477e80 100644 --- a/tests/testthat/test-s7-elmer_TypeBasic.R +++ b/tests/testthat/test-s7-elmer_TypeBasic.R @@ -10,20 +10,6 @@ test_that("ellmer::TypeBasic", { ) ) ) - expect_construct( - ellmer::type_array( - "An array", - items = ellmer::type_object( - "An object", - x = ellmer::type_boolean("A boolean", required = FALSE), - y = ellmer::type_string("A string"), - z = ellmer::type_number("A number"), - json = ellmer::type_from_schema("[1,2]"), - .additional_properties = TRUE - ), - required = FALSE - ) - ) }) test_that("ellmer::TypeBasic v <= 0.2.1", { @@ -91,9 +77,9 @@ test_that("ellmer::TypeBasic v <= 0.2.1", { ) }) -test_that("ellmer::TypeBasic v > 0.2.1", { +test_that("ellmer::TypeBasic v > 0.2.1 and v < 0.4.2", { skip_if_not_installed("ellmer") - skip_if(with_versions(ellmer <= "0.2.1")) + skip_if(with_versions(ellmer <= "0.2.1" || ellmer >= "0.4.2")) # from o.3.0 .additional_properties in type_object() and # additional_properties in TypeObject() both default to FALSE From 1697039bedf1cece052b2fd8700fffb1bcad8c63 Mon Sep 17 00:00:00 2001 From: Nic Crane Date: Sat, 25 Jul 2026 15:50:59 -0400 Subject: [PATCH 3/3] Add test back in --- tests/testthat/test-s7-elmer_TypeBasic.R | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/testthat/test-s7-elmer_TypeBasic.R b/tests/testthat/test-s7-elmer_TypeBasic.R index d4477e80..a30f6dc2 100644 --- a/tests/testthat/test-s7-elmer_TypeBasic.R +++ b/tests/testthat/test-s7-elmer_TypeBasic.R @@ -10,6 +10,19 @@ test_that("ellmer::TypeBasic", { ) ) ) + expect_construct( + ellmer::type_array( + "An array", + items = ellmer::type_object( + "An object", + x = ellmer::type_boolean("A boolean", required = FALSE), + y = ellmer::type_string("A string"), + z = ellmer::type_number("A number"), + json = ellmer::type_from_schema("[1,2]") + ), + required = FALSE + ) + ) }) test_that("ellmer::TypeBasic v <= 0.2.1", {