Popcorn is a .Net Middleware for your RESTful API that allows your consumers to request exactly as much or as little as they need, with no effort from you.
We can make it so the [IncludeByDefault]'s are respected for a base class and all of it's derived classes
We can also optionally (or additionally) add a attribute that can be specified on a base class that indicates whether its sub class [IncludeByDefault]'s should be included.
Steps to Reproduce
Given the following projections
public class BaseProjection
{
[IncludeByDefault]
public Guid? Id { get; set; }
public string Name { get; set; }
}
public class SubProjection:BaseProjection
{
[IncludeByDefault]
public Guid? SubId { get; set; }
[IncludeByDefault]
public string SubName { get; set; }
}
If then we make a hypothetical call as shown below (that for sake of example is just a call for an object that contains a property that correlates to BaseProjection) , we get the following response:
We would minimally expect the "Id" for the BaseProjection to be included as well
Actual Behavior
Note that the "Id" property isn't included.
Possible Implementation
It's a bit up for debate how we could choose to implement this, but here is a note from a chat we had on whether this is a bug or enhancement:
Well, the question is what the expectation was; should it have included the base properties marked include by default? There's arguments either way. If they are included by default, it is hard (or potentially impossible) for me to then exclude them in a subclass. If they are not, then it is hard (or potentially impossible) for me to then additionally include them in a subclass. (Either case is probably solved by an explicit include on the request)
Possible Solution
Steps to Reproduce
Given the following projections
If then we make a hypothetical call as shown below (that for sake of example is just a call for an object that contains a property that correlates to BaseProjection) , we get the following response:
Expected Behavior
We would minimally expect the "Id" for the BaseProjection to be included as well
Actual Behavior
Note that the "Id" property isn't included.
Possible Implementation
It's a bit up for debate how we could choose to implement this, but here is a note from a chat we had on whether this is a bug or enhancement: Well, the question is what the expectation was; should it have included the base properties marked include by default? There's arguments either way. If they are included by default, it is hard (or potentially impossible) for me to then exclude them in a subclass. If they are not, then it is hard (or potentially impossible) for me to then additionally include them in a subclass. (Either case is probably solved by an explicit include on the request)