as an example how would I build this? ```message D...
# grpc
d
as an example how would I build this?
Copy code
message DateRange {
  // The beginning of the date range
  google.type.Date from = 1 [(validate.rules).message.required = true];

  // The end of the date range
  google.type.Date until = 2 [(validate.rules).message.required = true];
}
The generated class isn't particularly helpful:
message has been deleted
d
by default, you would use
grpc-java
way of using builders
Copy code
DateRange.newBuilder()
  // set your fields using their builders
  .build()
if you use the
grpc-kotlin
then you should be able to use the generated DSL which should be something among the lines
Copy code
dateRange {
  from = ...
  unti = ...
}
d
Thanks, the second one seems to be the right path, but now I have to figure out how to create a
com.google.type.Date
; doesn't seem to use the DSL syntax and none of the constructors appear to be the right approach, but maybe I'm missing one
Wait I think I have it:
Copy code
val dateRange = dateRange {
            from = newBuilder().setDay(7).setMonth(7).setYear(2022).build()
            until = newBuilder().setDay(12).setMonth(7).setYear(2022).build()
        }
I guess what I don't get it when I'm supposed to be using the DSL syntax like
dateRange { ... }
instead of the other builder syntax
d
I'd imagine you should also have
Copy code
date {
  day = 7
  month = 7
  year = 2022
}
*unless google protos are treated in some custom special way
d
yeah that doesn't seem to work, unfortunately
m
I suspect this comes down to your build system and how Google's protos are built by it
You'll need to run the Kotlin proto compiler on them to get those DSL "factories"