Open mamonth opened 2 years ago
@mamonth thank you very much for this PR! I would love to only emit these quotes if they're needed... I wonder about adding a new Handlebars helper that could do that... is it a kind of quoteIdentifier
? Interesting to think... TypeScript lets you do that but Java doesn't. We can add language-specific helpers, e.g. in typescript-common
in the exportTemplates
method.
Maybe it's quoteIdentifierIfNeeded
and it looks for any characters in the serialised name that aren't legal and then quotes it. I guess it then also escapes quotes themselves using the escapeString
function already in typescript-common
.
Are you happy to try out these changes?
@mamonth also could you please add a sample .yml
test case that demonstrates the issue? That will then test it with all of the generators.
Language specific helper seems like valid option. I wasn't able to dive in to architecture of generators deep enough to see this possibility. And good point about test case. I'll try to make it right :)
Changes needed to support properties like 'some:property' widely used in API design. See HAL format for example.