Configure OpenAPI-/REST Datasource
The OpenAPI-/REST data source introspects an OpenAPI Specification and generates a GraphQL schema from it.
Example Configuration
WunderGraph will automatically cache the introspection result in the local file-system.
If you intend to frequently change the OpenAPI Specification, e.g. during development, you should specify the pollingIntervalSeconds
to 5 seconds for example.
overriding the base URL
Sometimes, it's important to be able to override the base URL of the OpenAPI Specification. In this case, you can use the baseUrl
option:
dynamically overriding the base URL
Other use cases require to dynamically override the base URL, e.g. when the accountID is part of the URL. This is possible using the following templating syntax.
Using the template {accountID}
as part of the baseURL adds the accountID
field to all generated root fields of the resulting GraphQL schema. This means, for each operation, you have to provide the accountID
argument. Here's an example schema: