Open
Description
What version of kubb
is running?
3.10.12
What kind of platform do you use?
MacOS
Your kubb.config.ts
config file?
The same one as e2e/kubb.config.js
Swagger/OpenAPI file?
The same one as e2e/schemas/discriminator.yaml
What version of external packages are you using(@tanstack-query
, MSW
, React
, Vue
, ...)
-
What steps can reproduce the bug?
The generated types, EnumerationValueSpecificationDto
, RangeValueSpecificationDto
, RegexValueSpecificationDto
and SliderValueSpecificationDto
all have property type
as string
.
For example
export type EnumerationValueSpecificationDto = {
/**
* @minLength 1
* @type string
*/
readonly type: string
/**
* @type array
*/
enumeration: string[]
}
How often does this bug happen?
Every time
What is the expected behaviour?
Instead, their type should be the specific string provided in their discriminator (just like Cat or Dog)
It should be type: 'enum'
for EnumerationValueSpecificationDto
and type: 'range'
for RangeValueSpecificationDto
and so on...
So that when EnumerationValueSpecificationDto
is without the parent context, this should fail
let enum: EnumerationValueSpecificationDto;
enum.type = 'range'; // !!! Should be a type error, but isn't
It is fine for Cat or Dog
export type Cat = {
/**
* @type string, uuid
*/
id: string
/**
* @type string
*/
type: 'Cat'
/**
* @type boolean | undefined
*/
meow?: boolean
}
Additional information
No response