-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCK bug? Use of equalTo PetStoreAppTest#testSchema rejects 10.0 for schema.multipleOf #412
Comments
Related (I think), if the server replies with OpenAPI JSON that contain this as part of the schema data:
(with the explicit type tags) then the checks for Not surprisingly, if I inspect the
This seems to be triggering the same behavior I mentioned earlier with |
Possible solution would be to update numeric equality checks with |
Allow setting version and other info elements
In
PetStoreAppTest#testSchema
, line 58 retrievesschema.multipleOf
and uses Hamcrest'sequalTo(10)
to check the value returned from the server under test.The
Schema
annotation declaresmultipleOf
as adouble
, and thepetId
parameter onPetResource#getPetById
is 10.The
Schema
model interface defines 'multipleOf' as aBigDecimal
. As it turns out the SnakeYAML serializer emits10.0
in this case, using theBigDecimal
type on the model interface to drive the output format.This causes the TCK test to fail -- incorrectly I think -- because the test uses Hamcrest's
equalTo(10)
which does not match10.0
.I have worked around this in the extensions we use with SnakeYAML so we can pass that TCK test, but it's a bit of a pain.
(There is a mention of the
double
/BigDecimal
mismatch regardingmultipleOf
in #178 (closed) but that issue is really not directly related to this one.)Using decimal notation to format a
BigDecimal
seems perfectly reasonable, so can the test be changed to accept10
and10.0
?I have not looked for similar constructs elsewhere in the tests that might also need attention. This was the only test failure I saw due to this problem.
The text was updated successfully, but these errors were encountered: