Repository navigation
fix: treat function names and keywords as member names in dot notation per RFC 9535 - #27
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Member
Author
|
@TristanSpeakEasy I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 5 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would auto-approve. Fixes RFC 9535 compliance by tokenizing names after ./.. as member names even when they match keywords or function names, requiring a direct ( for function calls, and making unknown functions parse errors. Focused bug fix with parser, tokenizer, and query tests.
View guided diff | Turn on auto-fix | Re-trigger cubic
This branch was successfully deployed
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.
Why
The tokenizer treated
length,count,match,searchandvalueas function names whenever any non-identifier character followed them, and treatedtrue,falseandnullas keywords everywhere. That meant valid RFC 9535 queries using those words as member names were rejected:$.value[0],$.value[*],$.value[?@.id == 'x']$.value.id,$..value[0],$[?@.value[0] == 1]$.length[0],$.count.x$.true,$.null.x$.value$.valueonly worked because the end-of-input branch skipped the function check. This was reported againstopenapi arazzo validatein speakeasy-api/openapi#301. Microsoft Graph and OData list responses put their arrays undervalue, so it hits a lot of real Arazzo workflows.What changed
.or..is always tokenized as a member name, which matches RFC 9535member-name-shorthand.FUNCTIONtoken when(follows it directly, matchingfunction-expr = function-name "(" ...with no whitespace allowed.parseFunctionExprnow requires aFUNCTIONtoken instead of accepting any token followed by(.Review notes
(is still rejected (compliance suitewhitespace, functions, *cases). Before, the tokenizer caught that indirectly.$[?foo(@.a) > 1]parsed silently aslength(), becausefunctionTypeLengthis the zero value of the enum. It's now a parse error, which is what RFC 9535 expects.Function call ...tokenizer tests used a method-call form (@.length()), which isn't RFC 9535 syntax and never got through the parser. I rewrote them as real function calls (length(),count(search(...))) so they still coverFUNCTIONtokenization.Testing
go build ./...andgo test ./...(including the RFC 9535 compliance suite) pass locally.(rejection.speakeasy-api/openapiusing a localgo.work: the repro from #301 now validates, and theoverlay,arazzoandopenapipackage tests pass. One Arazzo stress test lists an expected$.length == 5error in its ignore list. It's still rejected, but now at the==(column 9) rather than the space (column 8), so that ignore string needs updating when openapi bumps to the release with this fix.