Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.

[FEATURE] Implement Mediator types #3

Closed
jhoogstraat opened this issue Mar 10, 2020 · 4 comments
Closed

[FEATURE] Implement Mediator types #3

jhoogstraat opened this issue Mar 10, 2020 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@jhoogstraat
Copy link
Contributor

jhoogstraat commented Mar 10, 2020

Problem

It may not be desirable to always use CorvusModel for decoding the body of certain requests, like create or update requests.

Solution

To have more control over what the user is able to provide in a request body 'mediator', or 'carrier' types can be used.
These types are also refered to as 'Data Transfer Objects' or DTOs.
These can be implemented as DTOModifiers and ResponseModifier.

Alternative Solutions

Altering Create and Update endpoint to support these operations.
Altering CorvusModel to inherit this functionality.

@bmikaili
Copy link
Contributor

I agree this is needed. I haven't figured out a way to solve this generically yet. I struggle to find a way to do it generically in CorvusModel itself. We may have to resort to how you did it in your pull request, where developers will have to manually extend their models.

@jhoogstraat
Copy link
Contributor Author

jhoogstraat commented Mar 12, 2020

My solution requires no changes to existing code, because by default nothing changes. By default the CorvusModel itself is used to decode create/update requests, just like before.

What do you have in mind? Somehow the developer has to tell the system, which properties to decode, no?

@bmikaili
Copy link
Contributor

Yeah you're right. Currently in Swift there is probably no other way. If there was a way to iterate over the properties of a struct that implements a protocol it would be possible to do generically, but that's not something that can be done in Swift.

@jhoogstraat jhoogstraat changed the title Allow for mediator types [FEATURE] Allow for mediator types Apr 7, 2020
@jhoogstraat jhoogstraat changed the title [FEATURE] Allow for mediator types Allow for mediator types Apr 7, 2020
This was referenced Apr 7, 2020
@bmikaili bmikaili added the enhancement New feature or request label Apr 11, 2020
@bmikaili bmikaili linked a pull request Apr 13, 2020 that will close this issue
7 tasks
@jhoogstraat jhoogstraat changed the title Allow for mediator types [FEATURE] Implement Mediator types Apr 27, 2020
@PSchmiedmayer
Copy link
Contributor

We will archive Corvus in favor of Apodini as a worthy successor.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants