tkrajina / typescriptify-golang-structs

A Golang struct to TypeScript class/interface converter
Apache License 2.0
501 stars 86 forks source link

CamelCase option #73

Open msummers-nr opened 8 months ago

msummers-nr commented 8 months ago

For JSII compatibility it would be handy to have a flag that enforces camelCase for methods and properties.

vincentgna commented 6 months ago

I just published an internal fork and added CamelCase support as typescriptify is useful for CDK8s/CDKTF construct library generation with JSII support (which is only possible in TS, while most k8s controllers / TF providers are written in golang).

Docs here: https://github.com/GoodNotes/typescriptify-golang-structs?tab=readme-ov-file#upstream-golang-structs

The utility functions I added to work with upstream golang structs aren't ideal and if I find the time I'd rather re-write the functionality as suggested here: https://github.com/GoodNotes/typescriptify-golang-structs/issues/1

I wouldn't mind upstreaming these

vincentgna commented 6 months ago

FYI, as part of my CDK/CDKTF/CDK8s I bundle the popular decamelize/.. npm packages converting the TS object back to JSON with the right fieldNames ... I did not test Typescriptify Class generation to handle serialization to and from the original golang struct json tags.

msummers-nr commented 6 months ago

Ah, good to know (about decamelize).

I ended-up abandoning Go and have written TypeScript that generates JSII compliant TypeScript from a GraphQL Schema.

Now I'm working on generating working Constructs, we'll see.