Giter VIP home page Giter VIP logo

Comments (3)

mikeparisstuff avatar mikeparisstuff commented on June 15, 2024

@YikSanChan We have discussed something like this in the past and I'm curious how you would like to see this done. A few things to consider:

  1. How does this work with pipeline resolvers?
  2. If a unit resolver, how do you specify the data source?
  3. If I write a req.vtl and not a res.vtl what happens? Vice versa?

Open to suggestions here. I think one option would be to consider using a structured file with good support for multi-line strings such as toml or yaml. Use one file per resolver and likewise one function per function. A single resolver might look like this:

In yaml:

# Query.getPost.yaml
resolver:
  request: >
    {
      "operation": "GetItem",
      "key": { "id": { "S": "$ctx.args.id" } }
    }
  response: "$util.toJson($ctx.result)"
  datasource: PostTable

In toml:

# Query.getPost.toml
[resolver]
request = """
{
  "operation": "GetItem",
  "key": { "id": { "S": "$ctx.args.id" } }
}
"""
response = """
$util.toJson($ctx.result)
"""
datasource = "PostTable"

from amplify-category-api.

YikSanChan avatar YikSanChan commented on June 15, 2024

@mikeparisstuff I like your proposal. I am curious if the data source name is the only thing AWS need from users, why it asks users to write (or copy-and-paste) the whole resolver resource file?

Regarding your questions:

  1. For pipeline resolver authWrite that consists of multiple steps getAuth, checkAuth and writeItem, users can define each step in separate toml files, and chain them together in another toml file annotated with [pipeline-resolver]:
# Query.authWrite.toml
[pipeline-resolver]
- getAuth
- checkAuth
- writeItem

It can go even further. People may want a graph rather than a (linear) pipeline, and we can learn from akka-streams.

  1. As your proposal does.
  2. Throw validation error.

from amplify-category-api.

AnilMaktala avatar AnilMaktala commented on June 15, 2024

Hey @YikSanChan, We apologize for the significant delay in our response. It was essential for us to ensure that any future readers could access the resolution. We have transferred control from resource management to the customer for implementation in GraphQL transformer version V2. For further information, please refer to this link.

from amplify-category-api.

Related Issues (20)

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.