Skip to main content

non-conflicting-model-and-field-name

Overview

This rule belongs to the apimatic-codegen-validation ruleset and states that:

A model's name must not conflict with names of its fields. This is because some languages do not allow member names to be the same name as their enclosing type. The accessor or variable names may be changed to address this problem.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageField name conflicts with its model name which may cause code generation issues.
CodeAPIMATICCODEGEN_V136
TypeValidation
Rule SystemSemantic
Broad CategoryGlobal Types/Models
Products ImpactedCode Generation, Developer Experience Portal
Tagsapimatic code generation codegen sdks portal docs validation apimatic name field property type custom type model complex model

Suggested Fixes

  • Change the name of the model to avoid a conflict with its fields.
  • Remove the field from the model declaration.
  • Names are compared in a case-insensitive manner.

For More Information