By pfrenssen on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
3.x
Introduced in version:
3.0.0-alpha2
Issue links:
Description:
On number, range, rating and scale elements, the min, max and step fields can now return decimal numbers. Webform lets these be configured with decimals (for example a price field with a 0.01 step), but the API previously returned them as whole numbers, so a configured step of 0.5 came back as 0. The same query now returns the value the form was configured with.
In most cases the queries do not need to change. If your frontend reads these fields, make sure it is adapted to handle decimals: treat the values as floating-point numbers rather than integers. If you generate types from the schema, regenerate them.
Query (unchanged)
query { webformById(id: "my_form") { form { elements { ... on WebformElementNumber { min max step } } } } }
Response before
{ "min": 0, "max": 10, "step": 0 }
Response after
{ "min": 0.5, "max": 10.5, "step": 0.5 }
Impacts:
Themers