graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

Pass context to fetch in json-schema loader (used in new-openapi handler)

Open dr3 opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

In the previous open-api handler we had access to context in our fetch function, which gave us access to a few things, for our usecase this was primarily context.request.log which we used for logging.

Describe the solution you'd like

Passing context to fetch when its invoked

Describe alternatives you've considered

n/a

Additional context

The old openapi handler approach The new fetch call

dr3 avatar Aug 11 '22 16:08 dr3

Started draft PR, which functionally solves the problem, however this would require moving from the native fetch type to something more akin to the one in the openapi handler so a different approach may be preferable

dr3 avatar Aug 11 '22 16:08 dr3

customFetch function takes context as a third parameter. Let us know if this doesn't work. https://github.com/Urigo/graphql-mesh/blob/master/packages/types/src/index.ts#L165

ardatan avatar Mar 31 '23 06:03 ardatan