microsoft / microsoft/kiota-ruby

add shorthand functions for serialization

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Standard GitHub label
Dominant language
Ruby
Stars
5
Forks
8
Avg merge
11h 9m
Merged PRs (30d)
24

Description

to facilitate serialization and deserialization of models and collections of models, we're adding static helper functions.
More details to be found at https://github.com/microsoft/kiota/issues/3406

For serialization we need:

  • Serialize(contentType, model): string
  • Serialize(contentType, model): stream
  • SerializeCollection(contentType, models): string
  • SerializeCollection(contentType, models): stream
  • Serialize(model): stream (maps to same one passing the json content type as a constant)
  • Serialize(model): string (same)
  • Serialize(models): stream (same)
  • Serialize(models): string (same)

Note: if converting from stream to string is trivial we can ommit the string overloads
Note: if another parameter for the serialization method needs to be added, feel free to do so
Note: if both a string and and stream method need to be added, but can't have the same name, name the string methods with AsString suffix
Note: if the Json methods and the ones accepting the same content type can't have the same namde/would need to be aliased in the consuming code to avoid conflicts, as a ToJsonSuffix (full convention with string SerializeCollectionToJsonAsString)

For deserialization we need:

  • Deserialize(contentType, stream, createTFromDiscriminatorMethod): T
  • Deserialize(contentType, string, createTFromDiscriminatorMethod): T
  • Deserialize(contentType, stream): T (uses reflection, only if possible, calls into the previous one)
  • Deserialize(contentType, string): T (same)
  • DeserializeCollection(contentType, stream, createCallback): T[]
  • DeserializeCollection(contentType, string, createCallback): T[]
  • reflection version x2
  • Json equivalent with constant for all the previous

Note: the same notes as serialization apply
Note: if the collection and single methods can have the same name, make them same

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing serialization and deserialization entry points in the Ruby library, then read the linked Kiota issue #3406 for context. Compare current model and collection handling with the requested shorthand, stream, string, and JSON variants; done means the supported APIs and naming for overload conflicts are settled and implemented consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.