fix(rds): AWS validation errors, table aliases and template where clauses - #285
Merged
Conversation
…uses Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
A bug report flagged that malformed input to the
rdsquery builders raises a rawTypeError, which surfaces as an opaque internal error rather than a message naming the offending key. This raises AWS's validation error instead, and closes the input cases where we diverged.AppSyncUserErrormoves out ofindex.jsintoerrors.jssords/index.jscan throw it without an import cycle, and every message the builders raise now uses it.Behaviour, recorded from
EvaluateCode:TypeError, silently wrong SQL, or the wrong wording now produce AWS's message: nullish comparison values, malformed and non-arrayorderBy, non-string column names, missing or non-objectvalues, unsupported condition operators, non-booleanattributeExists, non-numericlimit/offset, and malformed statement payloads.columnssharesreturning's validation, ordering included — a malformed list is reported before MySQL's lack ofRETURNINGsupport.orderBydirsorts ascending instead of being rejected; v0.1.4 was stricter than AWS here.limitandoffsetare coerced to numbers.whereclause may be asqltagged template, and a table may be named by an alias object ({ persons: "p" }→"p" as "persons", in all four statement types). Both were reachable inputs that previously crashed or rendered garbage.Validation errors carry the errorType
Code, which is how AppSync attributes a fault in the resolver code itself. Without it a consumer cannot tell a rejection raised by the library from an error a resolver author raised deliberately withutil.error, since the two are otherwise identical.The test harness now strips the
code.js:<line>:<col>source position AWS prefixes a thrown message with, so an error is snapshotted like any other result. The nineteen assertions the previous two PRs had to pin as string literals are recorded snapshots now, and every parity claim in therdssuite is compared against AWS. The exception is three tests covering the errorType above:EvaluateCodereports an error as a bare message and never mentions errorType, so there is nothing to record and they pin our own contract instead.Bumps to v0.1.5, with a changelog line covering #284's conditions and alias as well since that release was not cut.