-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Summary
This request is based on a discussion in this PR.
The ElasticStack Terraform provider uses Kibana's OpenAPI specification to automatically generate a client to call its API.
For schemas defined as occurrences: schema.number(...) the resulting documentation is something like:
occurrences:
description: The total number of recurrences of the schedule.
minimum: 1
type: number
The code generator then types the ocurrences field as float32.
If the field is in practice only an integer, this will lead to awkward conversions when implementing resources.
float32(model.CustomSchedule.Recurring.Occurrences.ValueInt32())
We need to cast back and forth between what is defined in the resource schema, in this case integer, and the automatically generated API types.
Ideally, in the schema definition, we could pass some field that would let us decide if we want the documentation to state type: number or rather type: integer.
Changing TypeMeta is only a suggestion based on the fact that the description is set there.