Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract REST Resources into standalone Gem #1194

Open
nelsonwittwer opened this issue Aug 12, 2023 · 3 comments
Open

Extract REST Resources into standalone Gem #1194

nelsonwittwer opened this issue Aug 12, 2023 · 3 comments

Comments

@nelsonwittwer
Copy link
Contributor

The REST resources have key roles as they provide an interface in interacting with every endpoint of the API as well as casting responses into objects with defined attributes and methods.

These files are all generated from an OpenAPI schema that, ironically, are not yet open to the public. Given how many files are generated across many different versions of the API, this surface area brings a large amount of bugs and the root causes are found upstream in processes the community doesn't have access to. We have immediate plans to move those schemas/logic into the open source sphere, but we'd also like to take this time to extract the resources into their own gem separate from this Gem.

Why extract these resources into their own gem

  1. Fewer breaking changes to the foundational authentication/client level gem.
  2. Encourage more customization. Many of our users were upset about the direction of removing ActiveModel from our resources. By uncoupling these files from the foundational API we open the community up to add features, create their own gems, and better customize their development experience without having to fork the core authentication/client logic of this root gem.
  3. Open up the path for similar GraphQL types / interfaces.

Gem Architecture

Gem Name Job
Shopify API (this gem) Obtain a session, clients for APIs (REST, GraphQL), error handling, webhook management
REST Resources Interfaces to the APIs. Response casting into defined objects with attributes/methods
Shopify App Build Shopify app using Rails conventions. Oauth, webhook processing, persistence, etc
App Template Template demonstrating how to use all these components in one starting boilerplate application
@Trehana
Copy link
Contributor

Trehana commented Aug 30, 2023

Another functionality that will be beneficial to be added to the REST Resources gem is to define the number of retries that the method should retry. currently, Shopify API gem does not have this functionality of adding the number of times the request should try. For an example this would be beneficial when tackling the Exceeded 2 calls per second for api client issue.

@panckreous
Copy link

hey @nelsonwittwer are you able to give us a little more on your plans/ideas/etc for this? Thanks again for everything

@mibock
Copy link

mibock commented Nov 23, 2023

Hi @nelsonwittwer - you mention above that you internally have an OpenAPI schema that is used to generate the REST Resources (among others). We are currently working to support Shopify in our Data Integration tool (www.rapidionline.com). I have been looking high and low for a schema that describes the REST API Resources, but found nothing until now. A schema like this would allow us to stay current with the updates to the API that you make (without having to reverse engineer and build it from e.g. this repo). Can we somehow get access to this OpenAPI schema ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants