Skip to content

Normalize API surface to use abstractions vs concrete implementations #93

Open
@egil

Description

@egil

The generated code should follow the general API design pattern related to MA0016.

There many places in the generated code which could use abstractions instead of the concrete types. This will make it easier for us to change implementation details in the future without introducing a breaking change.

This issue should serve as a parent feature for updating all the parts of the code that can generate a collection type.

  • All "result" types should take an IEnumerable<T> as input instead of List<T>. #99 All "result" types should take an IEnumerable<T> as input instead of List<T>.
    Non-breaking change.
  • All "parameter" types should use IReadOnlyList<T> for array properties instead of List<T>. The default value assigned to these should be Array.Empty<T>. E.g.: public IReadOnlyList<string> Items { get; set; } = Array.Empty<string>()
    Breaking change.
  • All "model" types should use IReadOnlyList<T> for array properties instead of List<T>. The default value assigned to these should be Array.Empty<T>. E.g.: public IReadOnlyList<string> Items { get; set; } = Array.Empty<string>()
    Breaking change.

Related: https://github.com/meziantou/Meziantou.Analyzer/blob/main/docs/Rules/MA0016.md

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions