winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.9k stars 194 forks source link

Add support for Graphql API #4769

Open asmajlovicmars opened 10 months ago

asmajlovicmars commented 10 months ago

Feature Spec

The concept is similar, if not identical, to the Amplify GraphQL API, which offers queries, mutations, and real-time event subscriptions.

The GraphQL API facilitates several essential steps for expedited development:

Regarding the @ directives:

References:

Use Cases

This would give us lot of benefits for Rapid Development:

Boost in Rapid Development:

In essence, the GraphQL API acts as a catalyst, streamlining many traditional development tasks and allowing for a focus on feature development and business logic, ultimately accelerating the overall development process.

Implementation Notes

These two references could be helpful as a starting point:

Component

SDK

Community Notes

staycoolcall911 commented 10 months ago

Amazing - I'm adding this to the Wing Standard Library Roadmap instead of #2155 (closing #2155 as a duplicate).

Copying over an important remark from #2155 by @olivernybroe:

I think a new resource under cloud would be cleanest I think, e.g.

bring cloud;

let gql = new cloud.Gql('schema.gql');

gql.mutation("createPost", inflight (request: cloud.GqlRequest): cloud.GqlResponse => {
    return cloud.GqlResponse {
        title: "My title"
    };
});
garysassano commented 9 months ago

I've read the related blog post about this L3 construct and honestly I believe Wing should avoid opting for an opinionated solution using a pre-packaged bundle of resources. It would be more appropriate for the end user to craft such a bundle independently.

eladb commented 9 months ago

I've read the related blog post about this L3 construct and honestly I believe Wing should avoid opting for an opinionated solution using a pre-packaged bundle of resources. It would be more appropriate for the end user to craft such a bundle independently.

Not sure I fully understand. Can you elaborate or provide an example?

garysassano commented 9 months ago

It seemed to me that Wing preferred not to depend on third-party constructs. In the past, when I brought up the idea of using the openapix L2 construct for the API Gateway, I was told that a PR including it would likely not be approved.

Also, I'm left with two unresolved questions:

github-actions[bot] commented 7 months ago

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days. Feel free to re-open this issue when there's an update or relevant information to be added. Thanks!