typescript-json-schema
typescript-json-schema copied to clipboard
type alias lose annotations
/**
* @format uuid
*/
export type UUID=string
interface A{
u:UUID
}
gives
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"A": {
"properties": {
"u": {
"format": "uuid",
"type": "string"
}
},
"type": "object"
},
"UUID": {
"type": "string"
}
}
}
I'd expect format: uuid in the UUID definition.
This prevents importing annotated type aliases, which would be a really cool thing.
This is odd. Can you send a pull request with this test case so we can look into it? Maybe you can even take a stab at a fix. The code for this tool is actually not that large.
I seem to see similar; format doesn't get added to the schema.
Is there a workaround?
/**
* An EDTF level 0 or 1 date, with optional seasonal range.
*
* See https://github.com/retorquere/json-schema-edtf
*
* @format edtf/level-1+season-intervals
*/
export type EDTFDATE = string | null | undefined;
Any updates on this?