Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make conditional discriminators literals instead of generic string/bool
That's a much better consumer experience. A model generated for gx_conditional.xml would look like ```typescript export type ConditionalType = | WhenTestParameterA | WhenTestParameterB | WhenTestParameterC export type TestParameter = "a" export type IntegerParameter = number export type TestParameter1 = "b" export type BooleanParameter = boolean export type TestParameter2 = "c" export type ColorParameter = string export interface MySchema { conditional_parameter: ConditionalType } export interface WhenTestParameterA { test_parameter: TestParameter integer_parameter: IntegerParameter } export interface WhenTestParameterB { test_parameter: TestParameter1 boolean_parameter: BooleanParameter } export interface WhenTestParameterC { test_parameter: TestParameter2 color_parameter: ColorParameter } ``` instead of ```typescript export type ConditionalType = | WhenTestParameterA | WhenTestParameterB | WhenTestParameterC export type TestParameter = string | boolean export type IntegerParameter = number export type TestParameter1 = string | boolean export type BooleanParameter = boolean export type TestParameter2 = string | boolean export type ColorParameter = string export interface MySchema { conditional_parameter: ConditionalType } export interface WhenTestParameterA { test_parameter: TestParameter integer_parameter: IntegerParameter } export interface WhenTestParameterB { test_parameter: TestParameter1 boolean_parameter: BooleanParameter } export interface WhenTestParameterC { test_parameter: TestParameter2 color_parameter: ColorParameter } ``` With the new model I can write an input object without looking at the tool source, with the previous one I don't know what string I would need to supply.
- Loading branch information