GoodNotes / ts-interface-generator

Export JSII Compatible Interface from public NPM packages
Apache License 2.0
1 stars 0 forks source link

DataDog Dashboard missing attributeTypeMap #1

Open vincentgna opened 1 year ago

vincentgna commented 1 year ago

the generator stores an attribute mapping for serialization:

DataDog/datadog-api-client-typescript/packages/datadog-api-client-v1/models/Dashboard.ts - attributeTypeMap

this mapping is generated from the OpenAPI spec with following conversions for TypeScript interfaces DataDog/datadog-api-client-typescript/.generator/src/generator/formatter.py - attribute_name

When using the generated TS and converting directly to JSON string, the object won't match the API spec.

A hack is to "decamelize" (or "snake_case") the keys, but this doesn't guarantee correct results

vincentgna commented 1 year ago

see this workaround

https://github.com/GoodNotes/cdk-datadog-resources/blob/80f752b4f4e976a49a978d5c5b6d40b450d49116/src/dashboards/datadog-dashboard.ts#L22-L28