bboure / middy-appsync Goto Github PK
View Code? Open in Web Editor NEWA middy middleware for AWS AppSync
A middy middleware for AWS AppSync
With"@middy/core": "4.4.0" error are not thrown correctly.
Line 39 in 14f40b0
I suppose here lies the problem. The new version of middy doesn't expect that return, you should return just the response like this:
.onError(async (request) => {
const error = request.error as any;
return {
data: error?.data,
errorInfo: error?.info,
errorType: error?.type,
errorMessage: error?.message,
};
});
AppSync/GraphQL already does some heavy lifting about validation. Field types and optionality/requirement are already handled. However, there are some times when you just need more. eg: - a string should be > n characters
etc.
I think it might be a good idea to implement a solution to allow a second layer of validation at the code level for deeper control. Maybe averaging a library like Joi or Yup, with possibly an option for custom implementation.
I see at least 3 things that could use validation.
event.arguments
event.source
The API might look like this:
middy(...).use(appSync({
validate: {
arguments: ...,
source: ...,
output: ...,
},
}));
By default, no validation should be made.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.