This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/master by this push:
     new d763e3a32e Document that asBool() trims whitespace before parsing 
strings
d763e3a32e is described below

commit d763e3a32e4ee407c91d175b17692d271953cec3
Author: Stephen Mallette <[email protected]>
AuthorDate: Wed Jul 22 15:32:14 2026 +0000

    Document that asBool() trims whitespace before parsing strings
    
    The asBool() step trims leading and trailing whitespace from string
    input before the case-insensitive comparison against "true" and
    "false", so values such as " true", "false\t", and "\nTRUE" are
    accepted. The reference documentation and the Gremlin semantics
    provider documentation both stated that strings were only accepted when
    exactly equal to "true" or "false", which did not reflect the actual
    behavior. Both sections are updated to describe the trimming.
    
    Assisted-by: Kiro:claude-opus-4.8
---
 docs/src/dev/provider/gremlin-semantics.asciidoc | 4 ++--
 docs/src/reference/the-traversal.asciidoc        | 8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/docs/src/dev/provider/gremlin-semantics.asciidoc 
b/docs/src/dev/provider/gremlin-semantics.asciidoc
index a66e3fe69d..4c6a6525ec 100644
--- a/docs/src/dev/provider/gremlin-semantics.asciidoc
+++ b/docs/src/dev/provider/gremlin-semantics.asciidoc
@@ -864,11 +864,11 @@ None
 
 *Considerations:*
 
-Booleans are passed as is, numbers evaluate to `true` if non-zero, and `false` 
if zero or `NaN`. Strings only accept "true" or "false" (case-insensitive).
+Booleans are passed as is, numbers evaluate to `true` if non-zero, and `false` 
if zero or `NaN`. Strings are accepted when, after trimming leading and 
trailing whitespace (spaces, tabs, newlines, and carriage returns), they equal 
"true" or "false" (case-insensitive). For example, " true", "false\t", and 
"\nTRUE" are all accepted.
 
 *Exceptions:*
 
-If the incoming traverser type is unsupported, a string other than "true" or 
"false", or `null`, then an `Argument Error` is raised.
+If the incoming traverser type is unsupported, a string that (after trimming 
leading and trailing whitespace) is neither "true" nor "false", or `null`, then 
an `Argument Error` is raised.
 
 See: 
link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AsBoolStep.java[source],
 link:https://tinkerpop.apache.org/docs/x.y.z/reference/#asBool-step[reference]
diff --git a/docs/src/reference/the-traversal.asciidoc 
b/docs/src/reference/the-traversal.asciidoc
index 17ca3fb6cf..d1d4136d95 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -928,9 +928,11 @@ 
link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gre
 === AsBool Step
 
 The `asBool()`-step (*map*) converts the incoming traverser to a boolean 
value. If the traverser is already a boolean value, it is passed as-is. Numbers 
evaluate to
-`true` if non-zero, and to `false` if zero or `NaN`. Strings are only accepted 
when
-equal to `"true"` or `"false"` (case-insensitive), otherwise an 
`IllegalArgumentException` is thrown.
-All other types (including `null`) will throw an `IllegalArgumentException`.
+`true` if non-zero, and to `false` if zero or `NaN`. Strings are accepted 
when, after trimming
+leading and trailing whitespace (spaces, tabs, newlines, and carriage 
returns), they equal `"true"`
+or `"false"` (case-insensitive). For example, `" true"`, `"false\t"`, and 
`"\nTRUE"` are all
+accepted. Any other string, and all other types (including `null`), will throw 
an
+`IllegalArgumentException`.
 
 [gremlin-groovy,modern]
 ----

Reply via email to