Conversation
make minor-test section pass
Rr refactor sdk 01
Change getpath signature from getpath(path, store, current, state) to getpath(store, path, injdef) matching TS. The injdef parameter replaces current/state with a unified injection definition containing dparent, dpath, handler, base, meta, key properties. Add support for $KEY, $GET:, $REF:, $META: path operators and $$ escaping. Support relative paths via dparent/dpath. https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
Replace plain table injection state with Injection class that tracks dparent/dpath for relative path resolution. Update inject to take (val, store, injdef) instead of (val, store, modify, current, state). Update _injectstr to (val, store, inj) and _injecthandler to (inj, val, ref, store). Remove _setparentprop and _updateAncestors (now handled by Injection:setval). Update _invalidTypeMsg to use typename() for bit-flag type display. https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
- Rename transform_META to transform_ANNO ($META -> $ANNO) - Add transform_APPLY for applying functions from store - Add injectChild helper for EACH/PACK/APPLY transforms - Update all transform_* signatures to use Injection class (inj) - Update main transform() to take (data, spec, injdef) - Use new getpath signature and Injection class methods - Add checkPlacement and injectorArgs helpers https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
- Replace separate validate_NUMBER/BOOLEAN/OBJECT/ARRAY/FUNCTION with generic validate_TYPE using bit flag type system and TYPENAME lookup - Update validate_STRING to use Injection class (inj.dparent, inj.key) - Update validate_ANY, validate_CHILD, validate_ONE, validate_EXACT to use Injection class methods (inj:setval, slice, size, getelem) - Update _validation modify callback to use inj instead of state/current, add exact match support via inj.meta, use typename() for error messages - Add _validatehandler for meta path syntax interception - Update main validate() to new signature: validate(data, spec, injdef) with injdef containing extra/errs/meta fields - Add $INTEGER, $DECIMAL, $MAP, $LIST, $NULL, $NIL, $INSTANCE validators - Use merge() for store construction, matching TS pattern https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
- Add select_AND, select_OR, select_NOT, select_CMP query operators - Add main select function for MongoDB-style queries using validate - Export new utility functions: delprop, flatten, getdef, getelem, jsonify, pad, select, setpath, size, slice, typename - Export type flag constants (T_any, T_boolean, T_string, etc.) - Export DELETE and SKIP markers https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
- Update runner.lua: getpath(base, path) signature in match function
- Update getpath tests: reversed arg order, rename current→relative,
state→special with new injdef parameter
- Update inject-string: use {modify=nullModifier} injdef
- Update transform tests: remove store arg, use {extra=...} and
{modify=...} injdef patterns
- Update validate-custom: use {extra=extra, errs=errs} injdef
- Add new minor tests: getelem, size, slice, pad, setpath, delprop,
jsonify, edge-delprop
- Add new walk tests: depth, copy
- Add merge-depth test
- Add getpath-handler test
- Add transform-ref, transform-format, transform-apply tests
- Add validate-special test
- Add select tests: basic, operators, edge, alts
- Add existence checks for new utility functions
https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
- Fix slice() to handle numbers (clamp/bound) and mutate parameter
- Fix walk() nil callback handling (if/then instead of and/or idiom)
- Fix pad() to right-pad by default (padEnd), left-pad for negative
- Fix items() to return string keys for list indices (match JS entries)
- Add forward declarations for setprop and delprop
- Fix transform store construction: include dataClone in store merge
- Fix path splitting in getpath to match JS split('.') behavior
- Update walk-log test for before/after/both sections
https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
- Fix key sorting in _inject: use plain find for '$' instead of pattern
match (k:find(S_DS, 1, true)) since '$' is a pattern anchor in Lua
- Add JSON_NULL sentinel for dkjson decode to distinguish JSON null from
the literal string "null"
- Rewrite fixJSON with array-aware null handling: preserve "null" string
in arrays to avoid nil holes, use nil in maps/top-level
- Fix validate-basic to use runsetflags with {null=false} matching TS
- Make typify(nil) return T_noval|T_null since Lua nil represents both
JS undefined and null
- Filter both null and absent entries from typify test since Lua can't
distinguish them
- Add checkResult args parameter and error-before-match check to runner
- Add transform_REF, transform_FORMAT, checkPlacement, injectorArgs
- Rewrite slice for unified string/list handling with size()
- Rewrite jsonify with custom serializer matching JSON.stringify behavior
- Fix _injectstr full match regex to handle trailing digits
- Fix getpath meta path syntax and $GET/$REF/$META trailing $ handling
- Fix flatten to handle empty tables
https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
- typify(nil) now returns T_null only (Lua has no undefined concept) - Runner skips test entries where 'in' key is absent before fixJSON - validate_TYPE: $NIL also accepts T_null since Lua nil is null - Simplified typify test filter to only skip JSON_NULL entries https://claude.ai/code/session_01F2aN3PMP426paMXPCJYPQb
Replace string-based injection modes ('key:pre', 'key:post', 'val')
with bitfield constants (M_KEYPRE=1, M_KEYPOST=2, M_VAL=4). Update
InjectMode type to number, checkPlacement to use bitmask operations,
and export mode constants for external use.
https://claude.ai/code/session_01GSURzK61tcu7JjT19KWWbp
Convert injection mode from strings to bitfield constants
- join: filter out "null" sentinel strings to match TS null filtering - Injection:setval: return delprop/setprop result instead of always self.parent, fixing transform_RENAME ancestor node detection - escurl: match encodeURIComponent by preserving !'()* characters - transform_COPY: use checkPlacement for proper error reporting - transform_EACH: use checkPlacement with T_list parent type check and injectorArgs for argument type validation - transform_PACK: use checkPlacement with T_map parent type check and injectorArgs for argument type validation - Add forward declarations for checkPlacement and injectorArgs https://claude.ai/code/session_01Jzi2moac4BhHEpNjwV2HBe
- Add Filter() and Join() functions - Extend Walk() with before/after callbacks and maxdepth support - Extend Merge() with maxdepth support - Fix setval() to return ancestor node (matching TS) - Fix Transform_REF nodes slice (all-except-last, not only-last) - Fix Transform_REF grandparent list check - Fix origspec to be separate clone from injection working copy - Add tests: filter, flatten, typename, join, walk-depth, walk-copy, merge-depth, getpath-relative, getpath-special, transform-ref - Fix test key: joinurl -> join to match test.json https://claude.ai/code/session_01VMyidZ5g3JsaJCoxfiCzXv
…n-kMUEQ Improve injector validation and URL encoding in struct.lua
Enhance Walk function with pre/post-order callbacks and add Filter/Join utilities
Python and PHP Struct Update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.