IBM / openapi-to-graphql

Translate APIs described by OpenAPI Specifications (OAS) into GraphQL
https://developer.ibm.com/open/projects/openapi-to-graphql/
MIT License
1.6k stars 206 forks source link

Hotfix #471 #482

Closed Alan-Cha closed 1 year ago

Alan-Cha commented 1 year ago

I preemptively merged #471 without letting the CI run and it turns out, many things started breaking. This is an attempt to address those issues.

Alan-Cha commented 1 year ago

The current concerns are the example API 7 test, the one for subscriptions, and a type mismatch here between the CLI and the main library.

Pagebakers commented 1 year ago

here

The package that is used in the test is actually archived and not maintained anymore since 2018, should migrate to use: https://github.com/enisdenjo/graphql-ws

Pagebakers commented 1 year ago

This fixes the test, not all required props are passed down.

        subscriptionServer = new SubscriptionServer(
          {
            execute: (
              schema,
              document,
              rootValue,
              contextValue,
              variableValues,
              operationName
            ) =>
              execute({
                schema,
                document,
                rootValue,
                contextValue,
                variableValues,
                operationName
              }),
            subscribe: (
              schema,
              document,
              rootValue,
              contextValue,
              variableValues,
              operationName
            ) => {
              return subscribe({
                schema,
                document,
                rootValue,
                contextValue,
                variableValues,
                operationName
              })
            },
            schema,
            onConnect: (params, socket, context) => {
              // Add pubsub to subscribe context
              return { pubsub }
            }
          },
          {
            server: wsServer,
            path: '/subscriptions'
          }
        )
Alan-Cha commented 1 year ago

@Pagebakers Thanks for your suggestions! I'll make a new release now. We definitely need to upgrade the other modules but I don't want to delay things any further.

Pagebakers commented 1 year ago

Nice! I will see if there are other low hanging fruits this week.