Forum Discussion

jshier's avatar
jshier
Occasional Contributor
7 years ago

Sample Double Values Rounded in Mock Response

I've created a Location type that return latitude and longitude coordinate values, which are marked as doubles. However, in the mock response, the sample values are being rounded to integers, which is obviously unrealistic. Here's the coordinate definition:

 

Coordinate:
      type: object
      description: "The latitude and longitude associated with a location, specified in WGS 84 reference frame."
      required:
        - longitude
        - latitude
      properties:
        longitude:
          type: number
          format: double
          description: "A longitude value as a double, with positive values being east of the meridian, negative values west."
          maximum: 180.0
          minimum: -180.0
          example: -82.003185
        latitude:
          type: number
          format: double
          description: "A latitude value as a double, with positive values being north of the equator, negaitive values south."
          maximum: 180.0
          minimum: -180.0
          example: 43.505

In the response the sample values are rounded to -82 and 43. Any way to fix this?

  • Hi Jon,

     

    Thanks for your patience! We've pushed out a fix for the double rounding issue, so the workaround is no longer needed. To update the mock, either save your API again, or trigger the mock manually from the integrations list. Let us know if you see any further issues.

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Jon,

     

    Thanks for the report! I've reproduced the issue and logged an internal bug for it.

     

    In the meantime, please add a schema-level example as shown below - the mock response will use the correct values in this case.

        Coordinate:
          type: object
          ...
          example:
            longitude: -82.003185
            latitude: 43.505
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Jon,

     

    Thanks for your patience! We've pushed out a fix for the double rounding issue, so the workaround is no longer needed. To update the mock, either save your API again, or trigger the mock manually from the integrations list. Let us know if you see any further issues.