kirill-stepanishin opened a new pull request, #3427: URL: https://github.com/apache/tinkerpop/pull/3427
## Summary JavaScript's single `Number` type (IEEE 754 double) loses the distinction between JVM numeric types like `int`, `float`, `long`, and `double`. This PR gives `gremlin-javascript` users explicit control over numeric type fidelity on both sides of the wire. **Serialization** — New wrapper classes and factory functions (`toInt`, `toFloat`, `toDouble`, `toLong`, `toShort`, `toByte`) control the exact GraphBinary type code and GremlinLang suffix sent to the server. Without wrappers, existing type-inference behavior is unchanged. **Deserialization** — A new `numberMode: 'precise'` connection option wraps incoming numeric values in the same typed wrappers, preserving the server's original type information. Wrappers support transparent arithmetic via `valueOf`/`Symbol.toPrimitive`, and an `unwrap()` helper extracts raw values. **Implementation** — Refactored `GraphBinary.js` IoC initialization into a `createIoc()` factory so precise mode can inject a `postDeserialize` hook via `AnySerializer`. Extended `NumberSerializationStrategy` and `GremlinLang` to route wrapper instances to the correct serializers/suffixes. Enhanced `Long` to accept `bigint` with full int64 range validation. ## Tests - Unit: type-code routing, byte-level verification, round-trip serialize/deserialize for all six types, precise-mode coverage (nulls, nested structures, non-numeric passthrough), GremlinLang emission for all wrappers including edge cases (NaN, ±Infinity, boundary values, predicates, collections) - Integration: precise mode against a live server verifying `Int`/`Double` wrappers on vertex properties and edge weights - Export verification for all new public API symbols ## Documentation - Reference docs: new "Numeric Types" section, updated connection options table and limitations - Upgrade guide: new "JavaScript Typed Numeric Wrappers" section - CHANGELOG entry -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
