Open
Description
$(npm bin)/typescript-json-schema --version
0.42.0
ITest.ts
declare enum ButtonType {
PRIMARY = "PRIMARY",
SECONDARY = "SECONDARY"
}
export interface ITest {
button: {
[ButtonType.PRIMARY]: {
click: string;
};
[ButtonType.SECONDARY]: {
click: string;
};
};
}
$(npm bin)/typescript-json-schema --noExtraProps src/interfaces/ITest.ts ITest
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"button": {
"properties": {
},
"type": "object"
}
},
"type": "object"
}
button is empty
But when I add at least 1 string name - it works fine. Example:
declare enum ButtonType {
PRIMARY = "PRIMARY",
SECONDARY = "SECONDARY"
}
export interface ITest {
button: {
[ButtonType.PRIMARY]: {
click: string;
};
[ButtonType.SECONDARY]: {
click: string;
};
z: string;
};
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"button": {
"additionalProperties": false,
"properties": {
"PRIMARY": {
"additionalProperties": false,
"properties": {
"click": {
"type": "string"
}
},
"type": "object"
},
"SECONDARY": {
"additionalProperties": false,
"properties": {
"click": {
"type": "string"
}
},
"type": "object"
},
"z": {
"type": "string"
}
},
"type": "object"
}
},
"type": "object"
}
I think there is a bug when "all names is from variabled (enum)".