Are there any plans to have built-in validation AP...
# declarative-gradle
a
Are there any plans to have built-in validation API for DSL properties, which could work together with "static" software types and used by IDE without need for run configuration phase I think this problem exists now with Kotlin and Groovy too, validation for fields it's just not what one can express using Java/Kotlin type system (and most of other languages too). But it very important for any configs, to know what is expected from user. Examples could be some APIs like min/max length for field, min/max int value or just only regex (which covers wast majority of cases, even length, just not so nice in terms of IDE support). I understand that on current stage it could be premature, not sure that anyone from the team could invest into it. But I feel that this thing is really missing now, and it could be a great example of advantages of Declarative Gradle approach
2
o
Hi. I am not sure about the "built-in" one. IMHO it might make more sense to have it on external side via the Language Server Protocol or the experimental Build Server Protocol used in #C07206WNGES
But, regardless of the implementation, it would be a nice feature
a
I do not mean that Gradle should provide IDE support, I mean that API of software types properties which declared by plugin author, should be able to express more complex restrictions for fields than we can do now with language types, it can be done with annotations, same as software type is declared Maybe something like https://www.baeldung.com/spring-validate-requestparam-pathvariable It could be a list of built-in annotations, but also some way to link validator class for property content Just an example, things like valid port range or docker container name restrictions now cannot be expressed without starting actual configuration. Now all those are checked on configuration time, so plugin user set value, sync, got gradle error, no typing assistance. The only way to do this, is to allow plugin authors declare it on level of DSL (which is now will be generated by declarative gradle), so IDE can use this data to help user before they synced project, while typing, it will be IDE feature, just using data from Gradle Plugin, thanks for restricted DSL declaration system As a bonus it allows Gradle itself to validate config during configuration validate properties values and separate simple validation logic from business logic of the plugin
a
Yes, we have talked about being able to declare some kind of constraints of the value of a property, in addition to its type. However, there are no concrete plans to implement anything just yet.
thank you 1
a
Maybe it would make sense to create an issue to collect community feedback?
o
If you create a search issue, I'm happy to convert it to a template so that we can create more such things or maybe even have a free form in the repository