swagger-typescript-api
swagger-typescript-api copied to clipboard
Code generation crashes if description has `*/` substring
If any description in the Open API Document has */
substring, then that causes the multiline comment used for description to end early, resulting in a syntax error.
I know one way of fixing this could be to preprocess the schema and replace this substring with something else (like *'/
) in the onInit
hook, but:
- Is there a simpler way of doing it where I don't need to traverse the whole schema and look at every description?
- Since this is an error that is likely to occur frequently (since there's no restriction on what descriptions can be), should it be handled in the
onInit
hook, or should this be auto handled by the library internally with perhaps a log/callback informing the user about the issue and the fix?
This issue can be re-created by running the code gen for Kubernetes API
Commenting to say that we're running into the same thing.
I also encountered this problem
Configure prettier.requirePragma=true when generatingApi to only format files containing specific tags (called Pragma comments)