3.0.0 • Published 9 months ago

@openapi-typescript-infra/apollo-datasource-rest v3.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

apollo-datasource-rest

This module allows you to use typed OpenAPI-based method calls in an Apollo RESTDataSource subclass. The apollo-datasource-rest package is in fact deprecated, but we still use this heavily so I will start with this package and move to the new @apollo packages when we move the rest of the service.

To use this module, you should derive from TypedRESTDataSource<Paths, Context> instead of directly from RESTDataSource. The first generic argument should point to the paths object created by openapi-typescript, and the second to your Apollo server context.

Now, instead of calling this.get to use the generic REST client, call this.openapi.get to use the typed client (which in turn calls this.get after fixing up all the types and parameters).

See the test for an example using the PetStore API.

3.0.0

9 months ago

2.1.1

9 months ago

2.1.0

10 months ago

2.0.0

10 months ago

1.0.4

10 months ago