Grafbase makes it easy to unify existing APIs with the GraphQL and OpenAPI connectors.
Until now, connectors didn't require a unique name. The new configuration format for @grafbase/sdk
version 0.6.1
and above now requires a name
:
import { config, connector, g } from '@grafbase/sdk'
const stripe = connector.OpenAPI('Stripe', {
schema:
'https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json'
})
export default config({
schema: g
})
If you are using the GraphQL SDL format to configure your project, you must pass the name
value:
extend schema
@graphql(
name: "Stripe"
schema: "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json"
) {
query: Query
}
The namespace
type has also been changed from String
to Boolean
. If you want to disable namespaces using the SDL, you can now do that by passing namespace: false
:
extend schema
@graphql(
name: "Stripe"
namespace: false
schema: "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json"
) {
query: Query
}
Please make sure you're running the @latest
version of the Grafbase CLI (0.33.2
) when using the new configuration format.
We're also busy updating our documentation, templates, examples and guides to use this new format. If you spot anything that doesn't look right, please let us know on Discord.