Skip to content

Comments

Kostiantyn Shchepanovskyi edited this page Jul 1, 2015 · 5 revisions

Parser supports C/C++-style // comments syntax.

message Request {
  // This comment is attached to `foo`
  string foo = 1; 
  int32 bar = 2; // This comment is attached to `bar`
  // These two lines
  // are attached to `baz`
  int32 baz = 3;  
}

All comments attached to element are accessible using comments property (list of strings). Parser automatically removes leading spaces from all comments if all lines has common number of spaces.

Comments can be attached to following objects:

  • message
  • message field
  • oneof
  • enum
  • enum constant
  • service
  • service method
Clone this wiki locally