Closed borzaka closed 2 months ago
Well, I have figured out what was I missing: --custom-replacers
only works with --normalize
and not with --normalize-keys
So my final working CLI:
genum-openapi ./src/openapi/cart.yaml -o src/lib/api/cart-enums.ts --with-parent --normalize --uppercase-keys --custom-replacers '[{"regExp":"[@]","replaceWith":"_"}]'
Yup. If I remember correctly --normalize-names
should work too in your case. It should normalize exported enums names. --normalize
works on both exported names and enum keys.
I have this (extracted) schema:
When generating, I have this error:
I tried to replace the
@
with the custom replacers, but with no luck.This is my command line:
And also when I tried without
--normalize-keys
and use just the custom replacers, it didn't replace any. I used the one in the example:'[{"regExp":"[-/]","replaceWith":"_"}]'
It didn't replace any enums with-
in it.So my guess is that the
--custom-replacers
is not working as intended. Or am I missing something?