cap-js / cds-typer

CDS type generator for JavaScript
Apache License 2.0
29 stars 10 forks source link

Enable service names with non-alphanum characters #355

Open daogrady opened 1 month ago

daogrady commented 1 month ago

Allows "proper" naming of service containing non-alphanumeric names:

service "Foo/Bar" {}

would become

class __Foo_Bar {}  // not exported directly
export { __Foo_Bar as "Foo/Bar" }

and users would have to import like so:

import { "Foo_Bar" as FooBar } from ...
//                      ^ any alias

Note that this creates a discrepancy between service that don't contain special characters, as they are exported as default export, and ones that have names containing special characters, that are only exported in named style.