Description
The current problem with --empty-objects-unknown is, that Empty objects are either fully respresented as "never" or as "any". Even though it might be preferrable to just completely ignore them.
E.g.: assume I have the following Entity structure which I expose on a Controller...
public abstract class PolicyEntity<TEntity> : IEntity
{
public abstract int Id { get; set; }
}
public class Plant : PolicyEntity<Plant>
{
public override int Id { get; set; }
}
[HttpGet("Get/{id}")]
public ActionResult<Plant>? Get([FromRoute] int id)
{
// ...
}
Then I convert this to equivalent Typescript Code and get something like this:
export type components = {
schemas: {
PolicyEntity_Plant_: Record<string, unknown>;
Plant: components['schemas']['PolicyEntity_Plant_'] & ({
/** Format: int32 */
Id: number;
}
}
}
which essentially means, that Schema<'Plant'>.Id and all other Properties are ALWAYS any.
Proposal
Instead, there should be aflag to fully ignore empty objects and "strip" them from the source, instead of having them as eiher Record<string, unknown> OR Record<string, never>.
Extra
Might be verry similar to this issue and provide a possible solution for: #1520
Description
The current problem with
--empty-objects-unknownis, that Empty objects are either fully respresented as "never" or as "any". Even though it might be preferrable to just completely ignore them.E.g.: assume I have the following Entity structure which I expose on a Controller...
Then I convert this to equivalent Typescript Code and get something like this:
which essentially means, that
Schema<'Plant'>.Idand all other Properties are ALWAYSany.Proposal
Instead, there should be aflag to fully ignore empty objects and "strip" them from the source, instead of having them as eiher
Record<string, unknown>ORRecord<string, never>.Extra
Might be verry similar to this issue and provide a possible solution for: #1520