Skip to content

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

@adcoelho

Description

@adcoelho

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//enhancementNew value added to drive a business resultgood first issuelow hanging fruitkbn/config-schema

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions