Add the -p:detectMissing parameter to the command to generate the cs file , and the optional type data in the generated cs file will have a bool type attribute of [name+Specified]. For example, the optional attribute name will have a nameSpecified attribute corresponding to it.
In addition, you can see detailed help by running protogen.exe on the console
I hope it will be helpful to friends who encounter the same problem.