-
Notifications
You must be signed in to change notification settings - Fork 54
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
Easy customization of generated code through YAML file #235
Comments
I am not opposed to the idea but also not sold on it either. I've always treated this code as a means to an end in that I haven't tried to make it clean since at the end of the day the only thing that matters is the generated files it produces. So I'd probably be opposed to say doubling the amount of code without adding any functionality (just an example) but if the amount of code is comparable then why not. Having said that, I see this as fairly low value. I haven't had a chance to look at it at all but I noticed this in the release notes for 9.0.108:
This could potentially obsolete this code, if not a large part of |
Yup, I agree that it's not huge value as of now. I'd just keep this as an idea once we will be adding more features, yet as you mentioned Yet I didn't have chance to look into new version, I will try to update my FW in upcoming days and check that to see the impact on |
I will create a separate GitHub issue regarding the official API but coming back to your specific suggestions here, I'd actually prefer to move in the opposite direction where we move away from customisations or, if necessary, use generic transformations rather than per-resource customisations. I worry that making it easier to customise the generated code like this takes us further away from code generation and at some point maybe we are better off just hand-crafting the generated code and using code generation to do some form of contract testing instead. For example, the The The major issue I see with these customisations is that they reduce the utility of our generated code. If we can no longer rely on the generated code because someone needs to somehow verify that new fields don't require any customisations, then the utility is significantly diminished. |
It would be nice to have simplified way of customizing generated code and fields, I mean this part in particular (ref: https://github.com/paultyng/go-unifi/blob/main/fields/main.go#L342-L452)
so that it's easier to maintain and modify by external contributors. My idea is to be able to codify it in simple yaml file in following structure:
This way we could have
customizations.yml
like:Order of processing:
where each subsequent customization could amend previous ones.
What do you think @joshuaspence ? If you're fine with idea, I can jump on that and draft some code.
The text was updated successfully, but these errors were encountered: