Giter VIP home page Giter VIP logo

middy-appsync's Introduction

Hi there ๐Ÿ‘‹

Contact me/Follow me ๐Ÿ‘‡

ย  ย 

middy-appsync's People

Contributors

bboure avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

middy-appsync's Issues

Error handling doesn't work with latest middy

With"@middy/core": "4.4.0" error are not thrown correctly.

return false;

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,
    };
  });

[Idea] Implement validation functionality

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

  • a number has a min/max limit
  • a date cannot be in the past/future

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 resolver output

The API might look like this:

middy(...).use(appSync({
	validate: {
 	  arguments: ...,
 	  source: ...,
 	  output: ...,
	},
}));

By default, no validation should be made.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.