grantila / grantila/typeconv

[jsc-to-ts] Discards descriptions on enums

Open
#22 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
447
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Consider this schema:

```json
{
"title": "RDAP schema",
"definitions": {
"RdapEvent": {
"title": "RdapEvent",
"description": "This data structure represents events that have occurred on an instance of\nan object class.",
"type": "object",
"properties": {
"eventAction": {
"description": "the reason for the event",
"type": "string"
}
},
"required": ["eventAction"],
"additionalProperties": false
}
}
}
```

typeconv translates this to the following TypeScript definition:

```ts
/**
* This data structure represents events that have occurred on an instance of
* an object class.
*/
export interface RdapEvent {
/** the reason for the event */
eventAction: string;
}
```

However if you update `eventAction`'s definition to

```json
{
"description": "the reason for the event",
"enum": ["registration", "reregistration", "last changed"]
}
```

The property's TSDoc comment is gone:

```ts
/**
* This data structure represents events that have occurred on an instance of
* an object class.
*/
export interface RdapEvent {
eventAction: "registration" | "reregistration" | "last changed";
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.