-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for controlled trailing semi-colons and injecting custom properties #1059
base: main
Are you sure you want to change the base?
Add support for controlled trailing semi-colons and injecting custom properties #1059
Conversation
…injecting custom properties
@manikandan-ravikumar Could you please elaborate on the reasons for |
@panchenko I am not disabling semi-colons. I am just introducing an option to disable it. The default value for disabling semi-colon is false. |
@@ -129,6 +130,8 @@ public class GenerateTask extends DefaultTask { | |||
public boolean jackson2ModuleDiscovery; | |||
public List<String> jackson2Modules; | |||
public Logger.Level loggingLevel; | |||
public boolean disableTrailingSemiColon; | |||
public Map<Class<?>, List<String>> injectCustomProperties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This task is setup in build.gradle
, but the corresponding user-defined classes are not accessible there.
Should be class name as string - similar to other fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed this comment
I am trying to understand why it matters. Code analysis should be just disabled for the generated file. For example, in the file header there are comments to disable tslint/eslint. |
I agree from the functional POV. But from code maintenance POV, it makes this file stand-out. I am working in a project where we maintain a common standard across the code base and it involves no semi-colon usage. So, we had to |
In this PR, I would like to introduced the following two new settings,
disableTrailingSemiColon
- A boolean flag indicating if the generator should append every line with a semi-coloninjectCustomProperties
- A map of class to string property lists. Similar toimportDeclarations
but instead injects additional properties into the given type. This is useful for when we try to be backward-compatible in the FE API and update the backend logic to have the newer property names. Also avoids adding these properties manually every time after running thetypscript-generator
.This PR also includes some minor improvements in other parts of the code.