optimizely / ruby-sdk

Ruby SDK for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/ruby-sdk
Apache License 2.0
24 stars 29 forks source link

Feature request: DatafileProjectConfig should be round-trippable #246

Closed jasonkarns closed 1 year ago

jasonkarns commented 4 years ago

Given that the DatafileProjectConfig represents the object form of the datafile JSON structure, it seems reasonable to expect that his object could be re-serialized to JSON. A compelling use-case is for servers to use the ruby-sdk for polling/fetching/storing the datafile and inline the datafile into (cached) page requests. This way the client-side optimizely sdk can avoid another costly HTTP request to fetch data that the server already has.

A rough spike of this feature: (this proof of concept implementation relies on ActiveSupport extensions as_json and deep_transform_keys.)

      def datafile
        as_json.slice *::Optimizely::Helpers::Constants::JSON_SCHEMA_V2["properties"].keys
      end

      def as_json
        project_config_manager.config.as_json.deep_transform_keys { |k| k.camelize(:lower) }
      end

Even without the use-case described above, I would generally expect any library class which represents a serialized data structure to be round-trippable.

Tamara-Barum commented 1 year ago

My apologies for the delay in response to this issue. The team is updating our processes and reviewing all open issues and PR's. If this Feature Request is still relevant, please add your suggestion to our idea portal here https://feedback.optimizely.com/ where it can be evaluated with the other ideas for the product. From here it will be appropriately prioritized and brought to the engineering team.