OpenAPITools / openapi-diff

Utility for comparing two OpenAPI specifications.
Apache License 2.0
812 stars 154 forks source link

Increasing/Decreasing the Precision & Scale property for a Decimal field results in No differences detected #463

Open Hazel-John opened 1 year ago

Hazel-John commented 1 year ago

While testing various corner-cases with the help of this tool, we've noticed that increasing/decreasing the Precision or Scale property for a Decimal field would return an output of No differences. Specifications are equivalents.


We would like to understand as to why is the change in Scale/Precision not detected as a breaking change or backward compatible change (if applicable)?

e.g., Precision & Scale are defined respectively as follows:
 type SAMPLE: Decimal(38,2)



I have attached the corresponding Json snippet for the same: 

oldSpec.json

“SAMPLE”: {
            "anyOf": [
              {
                "type": "number",
                "format": "decimal",
                "multipleOf": 0.01       //indicates scale=2
              },
              {
                "type": "string"
              }
            ],
            "example": 0,
            "nullable": true
          },


newSpec.json

“SAMPLE”: {
            "anyOf": [
              {
                "type": "number",
                "format": "decimal",
                "multipleOf": 0.1     //indicates scale=1
              },
              {
                "type": "string"
              }
            ],
            "example": 0,
            "nullable": true
          },

Result No differences. Specifications are equivalents

Thank You

michael-schnell commented 1 year ago

Related to: #483