GithubHelp home page GithubHelp logo

Add Versioning Support about shopify HOT 4 CLOSED

nsweeting avatar nsweeting commented on May 27, 2024
Add Versioning Support

from shopify.

Comments (4)

Ninigi avatar Ninigi commented on May 27, 2024

@nsweeting Another question is, how are we going to handle outdated/updated resource structs? Are we going to keep outdated structs around to support different versions? Would we namespace them then (that would probably mess with pattern matching though)?

from shopify.

Ninigi avatar Ninigi commented on May 27, 2024

@nsweeting I thought about the issue a little more, and I realized that using maps instead of structs would get rid of all problems and would also allow for a seamless graphql integration.

I absolutely love the key safety structs provide, so I would like to keep that even if we decided to ditch them for this library. So my idea would be to extract the structs into a different library, and make it an optional dependency. That would also enable you to require different versions of the shopify resources for different api versions. If someone needs to support version X, he could use version 1.x structs and the shopify library would be agnostic to versions other than specifying it in the url.

from shopify.

nsweeting avatar nsweeting commented on May 27, 2024

Yeah I've been thinking about providing bare maps for a while now. It also prevents issues with missing attributes.

I'm wondering how other libraries will be handling the versioning. The ruby library uses ActiveResource, so that is much more dynamic in nature. The shopify go library would be a bit more like how elixir works. Technically, we could just maintain both old and new attributes in the same struct. It really depends on how complicated shopify ends up making the difference in versions.

Not sure about the extraction of the structs. Actually using them in reference to responses would get pretty complicated.

Will need to think on this a bit more...

from shopify.

mmccall10 avatar mmccall10 commented on May 27, 2024

I like the idea of using maps or at least have the option to use a bare maps instead of structs. The scope of api changes is still unknown but updating/deprecating versioned structs on a rolling basis might become a maintenance issue. Using bare maps eliminates a lot of the questions around how manage versions. A developer can reference the Shopify Api docs for relevant fields.

Looking at the official ruby/python libs they now require a version when initializing a session, I think this lib could adopt that. Ideally there would also be a way to dynamically make calls to various versions. ie.

Shopify.Session.put_version/2

or even something like

Shopify.Product.find(session, id, api_version: 'unstable')
Shopify.Product.find(session, id, api_version: '2019-04')

That's my 2 cents. Hope that helps.

from shopify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.