no-redundant-model
Overview
This rule belongs to the apimatic-preliminary-linting
ruleset and states that:
To get a good quality output, it is recommended to avoid redundant models. A redundant model can be one which has exactly the same properties as another model or which is a subset of another model so that it can be easily replaced by its superset model instead.
Property | Value |
---|---|
Enabled | Yes |
Maximum Severity | Information |
Message | Possible redundant models found. |
Code | APIMATICPRE_L106 |
Type | Linting |
Rule System | Semantic |
Broad Category | Types/Models |
Products Impacted | Code Generation, Developer Experience Portal, API Transformer |
Tags | preliminary checks linting apimatic redundant model type custom type complex model global models |
Suggested Fixes
- If the models are indeed redundant, keep one and update references of all other models to use this one chosen model instead. Then, once its safe to do so, remove the extra models.
- If a model is a subset of another model, you may want to review if keeping only the superset model would make more sense. If yes, remove the subset model and update all its references to use the superset model instead.
- If a model is a subset of another model, you can choose to make it a base type of the superset model and then remove the repeating fields from the superset model. Use this option only if the models do imply a hierarchy in your API's context.