Skip to content

Feature Request - type conversions #38

@DellanX

Description

@DellanX

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

I have some code to convert a type (User) into a more obscure type (PublicUser). The two classes are basically the same, except that PublicUser does not have an email field.

Now, I am adding in some tests and realize that my process may be something that could be moved into TypeManager.

Describe the solution you'd like

Ideally, I could list two types, and the field data from the original object would be applied to the newly created converted representation, which the non-applicable fields removed. I figure this process could also take in an object to populate any new fields.

Describe alternatives you've considered

My current process is pretty simple. I serialize the original object, then deserialize it into the target type via TypeManager. That said, I still have to manually scrub the undesired fields.

Additional context

To be honest, all I really need is a way to get a property list so that I can make my convertType helper automatically scrub the undesired fields. That said, I figured I'd ask about adding convertType into TypeManager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions