elastic/kibana

[@kbn/config-schema] extend `TypeMeta` to distinguish number types in documentation.

Open

#233,739 建立於 2025年9月2日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)TypeScript (19,065 star) (8,021 fork)batch import
Team:Coreenhancementgood first issuekbn/config-schema

描述

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.

貢獻者指南