OData / Microsoft Graph
This handler allows you to load remote OData metadata/schema as GraphQL Schema.
To get started, install the handler library from NPM:
Now, you can use it directly in your Mesh config file:
#
Dynamic Header ValuesMesh can take dynamic values from the GraphQL Context or the environmental variables. If you use mesh serve
, GraphQL Context will be the incoming HTTP request.
The expression inside dynamic values should be as in JS.
mesh serve
)#
From Context (HTTP Header for And for mesh serve
, you can pass the value using x-my-graphql-api-token
HTTP header.
#
From Environmental VariableMY_API_TOKEN
is the name of the environmental variable you have the value.
#
Codesandbox ExampleYou can check out our TripPin example that uses OData handler.
#
Config API ReferencebaseUrl
(type:String
, required) - Base URL for OData APImetadata
(type:String
) - Custom $metadata File or URLoperationHeaders
(type:JSON
) - Headers to be used with the operation requestsschemaHeaders
(type:JSON
) - Headers to be used with the $metadata requestsbatch
(type:String (multipart | json)
) - Enable batchingexpandNavProps
(type:Boolean
) - Use $expand for navigation props instead of seperate HTTP requests (Default: false)customFetch
(type:Any
) - Custom Fetch