protoc-gen-validate icon indicating copy to clipboard operation
protoc-gen-validate copied to clipboard

csharp support

Open thegrumpylion opened this issue 3 years ago • 5 comments

I want to implement support for csharp in this generator. I would like to ask some questions before I begin.

Are there any other initiatives/plans on this? My very limited search didn't provide any results.

Looking into the code and taken the java implementation as reference, I would say that a high level flow of the generator is:

  1. implement the rules the project in csharp under csharp folder
  2. protoc --csharp_out=. --validate_out="lang=csharp:." service.proto
  3. render templates under templates/csharp for messages using code from step 1

Does step 1 require protoc --csharp_out=./csharp -I validate/ validate/validate.proto?

Cheers.

thegrumpylion avatar Jun 10 '21 16:06 thegrumpylion

Yeah, that would be great! Just to calibrate expectations, are you signing up to maintain C# support as well? That would mostly involve consulting when there's some idiomatic language thing that works differently in C# than in the other languages, and helping getting the build/test working initially.

  1. implement the rules the project in csharp under csharp folder

Java is a special beast because of the requirements for its directory structure (and the Python version is totally different from other languages and generates code on the fly). If you can avoid having a language-specific directory that's great, otherwise not a big deal.

Ideally almost everything C#-specific goes under templates/csharp with a similar template structure to the existing code.

akonradi avatar Jun 10 '21 17:06 akonradi

Looks like there are Bazel rules for C#, which is great! https://github.com/bazelbuild/rules_dotnet

akonradi avatar Jun 10 '21 17:06 akonradi

Last year I was looking into adding support for C# (#361), but I didn't find the time to resolve some open topics. Maybe you can use this a starting point.

dominiquehunziker avatar Jun 16 '21 10:06 dominiquehunziker

any updates on this?

ziaulhasanhamim avatar Dec 23 '21 06:12 ziaulhasanhamim

In my case...

Makefile

.PHONY: create
create:
	mkdir -p gen/csharp
	protoc -I=. --csharp_out=./gen/csharp proto/validate/validate.proto
	protoc -I=. -I ${GOPATH}/pkg/mod -I ${GOPATH}/pkg/mod/github.com/envoyproxy/[email protected] --csharp_out=gen/csharp/ proto/v1/*/*.proto

directory structure /proto /proto/v1 /proto/v1/xxx /proto/v1/xxx/xxx.proto /proto/validate /proto/validate/validate.proto

donis-y avatar Apr 07 '22 10:04 donis-y

Why was it closed? Is C# added or it is decided that there will be no support for C#

ziaulhasanhamim avatar Oct 05 '22 02:10 ziaulhasanhamim

Thank you for reaching out and expressing your interest in having C# support for protoc-gen-validate.

While we won't be adding C# support to protoc-gen-validate, I'd like to point out that there's an open issue regarding C# support in the protovalidate project. You can find it here. This issue captures a similar request, and I encourage you to keep an eye on its progress.

As we're actively developing protovalidate to offer a more comprehensive experience, your input is valued. I'll be closing this issue. If you have more suggestions or questions in the future, feel free to get in touch. Thank you for your engagement!

elliotmjackson avatar Aug 10 '23 19:08 elliotmjackson