ebowman / api-first-hand

API-First bootstrapping tool for building RESTful web services from a Swagger/OpenAPI spec
MIT License
142 stars 22 forks source link

Fix datetime tests generator #53

Closed gipeshka closed 7 years ago

gipeshka commented 7 years ago

This PR fixes autogenerated tests for date-time params e.g.:

    dateTimeExample:
        type: string
        format: 'date-time'

Currently tests fail with message:

[info] - should discard invalid data *** FAILED ***
[info]   Invalid value for Year (valid values -999999999 - 999999999): -292277022657 did not equal (swagger.yaml.scala:165)
[info] - should do something with valid data *** FAILED ***
[info]   Invalid value for Year (valid values -999999999 - 999999999): 6351938632 did not equal (swagger.yaml.scala:175)

This happens because generation of arbitrary ZonedDateTime uses arbitrary Long which exceeds allowed time interval.

In this PR the generator is switched to arbitrary java.util.Date.

slavaschmidt commented 7 years ago

@gipeshka Cool, thanks for the fix