json-schema-to-typescript
json-schema-to-typescript copied to clipboard
`justName` with `$ref` definition may be unexpected
https://github.com/bcherny/json-schema-to-typescript/blob/25c1d2752ff4bad135d6fc53e80c2f99784b0e6f/src/normalizer.ts#L100
In our case, dereferencedName could be #/definitions/v1.ManagedFieldsEntry, it's not a filename but internal reference name, but justName consider it as filename always, it should consider # character actually. Currently, it returns v1 but should be v1.ManagedFieldsEntry or ManagedFieldsEntry, right?
Proposal: https://github.com/bcherny/json-schema-to-typescript/blob/25c1d2752ff4bad135d6fc53e80c2f99784b0e6f/src/utils.ts#L167-L172
export function justName(filename = ''): string {
return filename.includes('#') ? basename(filename) : stripExtension(basename(filename))
}