Skip to main content

schema-multiple-of-only-for-numbers

Overview

This rule belongs to the openapi-v3-standards-linting ruleset and states that:

The property multipleOf can only be used for Schema Objects when the type is either unspecified (implying any type), set as number or as integer. This property is not applicable for any other types.

PropertyValue
EnabledYes
Maximum SeverityWarning
MessageProperty multipleOf is not applicable for the current Schema Object type.
CodeOPENAPI3STANDARDS_L178
TypeLinting
Rule SystemSemantic
Broad CategorySchemas
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi standards semantic linting multiple of number integer schema

Suggested Fixes

  • Ensure that the value of type in the Schema Object is not set to a value other than number or integer.
  • Type names are compared in a case-sensitive manner.
  • If you use the multipleOf keyword, ensure that the data instance you intend to validate can be a number or integer.
  • If the type of the instance can vary i.e. it can be an number/integer or some other type, consider removing the type keyword to allow any types. If you use the oneOf/anyOf constructs instead, consider moving the multipleOf to the oneOf/anyOf schema that has the type set as number or integer.

For More Information