GithubHelp home page GithubHelp logo

protoxygen's Introduction

Protoxygen

Use Doxygen to document Protobuf files

Purpose

This project is designed to allow users to document Google Protocol Buffers using Doxygen.

File Breakdown

The proto2cpp.py file is a filter created by Timo Marjoniemi that is located on SourceForge. I have made some changes to this filter in order to better document the 'Services' portion of protobufs.

The proto2cpp file takes protobuf and translates the code to C++ readable keywords, allowing Doxygen to document the comments. But, we do not want the generated output to look like C++ code, as we will not be able to relate it to the original protobuf files. To solve this, I have written the protofy.sh file, which crawls the generated HTML documents and replaces the C++ keywords with the appropriate protobuf keyword.

DoxygenLayout is an xml file that is generated by Doxygen. I have made changes to page titles and link names in order to, again, replace the C keywords with protobuf keywords.

doc-gen.sh is the script to run to generate the doxygen.

How to Comment

Protobuf files need to be commented a specific way in order for them to be read by Doxygen.

To document Services, I have them grouped based on the name of the service. An example follows:

//@defgroup MyService
// My service brief description!
// My service more detailed description
//@{
service MyService {
	//@addtogroup MyService
	//@{
	//;
	
	// Description of my RPC call
	rpc RPCCall(sent) returns (response);
	
	//@}
}

// This is my message example
message MyMessage {
	// comment
	string my_value = 1;
}

//@}

One of the odd things is the //; on the 8th line. I find that without a semicolon above the first RPC call, Doxygen will not properly document the very first call. In the proto2cpp script the // is removed from in front of the ;. This means you CANNOT USE SEMICOLONS IN YOUR COMMENTS. If you do, the // will be removed from your comment line. This has room for improvement, and I will be working on changing this caveat.

Issues

The above paragraph explains that you cannot use semicolons in your comments, and you need to include a commented semicolon above the first RPC call of every service.

Another issue is something I have mailed the DoxygenUsers group and posted a StackOverflow question about, without any response. The proto2cpp will always add itself to the beginning of my mainpage when I attempt to use a README.md as the mainpage document. This may be a bug in doxygen itself. To get around it, the final line in protofy.sh removes the begining lines of the index.html page to clear out the proto2cpp text. If you are not using a markdown file as your index, you may not run into this issue and will have to remove that line from the protofy.sh.

protoxygen's People

Contributors

lisroach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

protoxygen's Issues

Problem with oneof

First of all thank you very much for this very good implementation, makes it very clear what are services and what are not.

I just found a issue that oneof parameters are not handled well, could not yet find the error in the pyton script.


message ConversionParameters {
	oneof Parameters
	{
		int32	Quality = 2;
		int32	MaxFileSize = 3;
	}
	optional ImageDpi Dpi = 4;
}

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.