Gerrit0 opened a new pull request, #3128:
URL: https://github.com/apache/avro/pull/3128

   ## What is the purpose of the change
   
   As requested by AVRO-4035, this uses the `doc` field from the avro schema 
when generating code.
   
   That is, this schema:
   
   ```json
   {
       "type": "record",
       "doc": "Top level Doc.\nWith multiple lines",
       "name": "RootRecord",
       "fields": [
           {
               "name": "mylong",
               "doc": "mylong field doc.",
               "type": "long"
           },
   ```
   
   Generates the following when run through `avrogencpp`
   
   ```c++
   // Top level Doc.
   // With multiple lines
   struct RootRecord {
       typedef _bigrecord_Union__0__ myunion_t;
       typedef _bigrecord_Union__1__ anotherunion_t;
       // mylong field doc.
       int64_t mylong;
   ```
   
   Note: I decided to use line comments (`//`) rather than block comments (`/*` 
or `/**`) as they make the logic for handling escapes simpler, and make it easy 
to properly indent the entire comment when generating comments for record 
fields.
   
   ## Verifying this change
   
   This change is already covered by existing tests - avrogencpp is used to 
compile several schemas which include `doc` fields. The generated code is still 
valid, and one schema was adjusted to test the edge case with new lines.
   
   ## Documentation
   
   - Does this pull request introduce a new feature? yes
   - If yes, how is the feature documented? I have updated the Jira issue to 
contain the release note:
   
       > avrogencpp will now include the `doc` fields in schemas in the 
generated code for records 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@avro.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to