Skip to content

[REQ] [dart-dio] Refactor api methods and classes #15477

@ahmednfwela

Description

@ahmednfwela

Is your feature request related to a problem? Please describe.

currently dart-dio

  1. generates api methods that handle both serialization and networking (see [BUG][dart-dio] Accept header not generated #15427 (comment) for further explaination)
  2. generates api classes are tightly coupled to the serializer, which means that different serialization options have to change networking mustache files directly, leading to complexities mentioned in [REQ] [dart-dio] [internal refactor] Unify test schemas #15449 (comment)
    e.g.:

Describe the solution you'd like

We can mitigate both of these issues with some non-breaking refactor of the generated API classes, essentially removing that api mustache folder, that each serializer has to adapt.

  • for the first issue, we introduce 2 method signatures (raw + json, as described in my comment)
  • for the second issue, we introduce a new interface IJsonSerializationRepository which all serialization options have to implement.
    It will include these 2 abstract methods
    Object serialize<T>(T src, {Object? context});
    T deserialize<T>(Object value, {Object? context});
    where the general rule is that
    json == serialize<T>(deserialize<T>(json))
    object == deserialize<T>(serialize<T>(object))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions