enum-elements-count-matches-schema-enum-items-count
Overview
This rule belongs to the openapi-v3-codegen-linting ruleset and states that:
The x-enum-elements extension is used to provide additional information or metadata for each enum item. The x-enum-elements extension, when used, should have an object count that matches the number of enum items defined in the schema.
| Property | Value |
|---|---|
| Enabled | Yes |
| Maximum Severity | Warning |
| Message | Object count in x-enum-elements extension does not match with the enum items count. |
| Code | OPENAPI3CODEGEN_L629 |
| Type | Linting |
| Rule System | Semantic |
| Broad Category | OpenAPI Schemas |
| Products Impacted | Code Generation, Developer Experience Portal |
| Tags | code generation sdks openapi3 openapi semantic linting apimatic x-enum-elements enum elements count mismatch |
Suggested Fixes
- Ensure that the object count in the x-enum-elements extension matches the number of enum items.
- Adjust the object count or the number of enum items to ensure they match each other.
For More Information
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schema-object
- https://docs.apimatic.io/specification-extensions/swagger-codegen-extensions/#enumeration-extensions
- https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md
- https://docs.apimatic.io/rulesets/overview/