-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[protobuf] Preserve documentation comments (#2283)
This change preserves `@doc` comments when emitting protobuf schemas. We convert the protobuf documentation comments into a format that will feel familiar to Protobuf developers and that Protobuf tooling will be able to parse. I've never used a documentation generator with Protobuf, but I made sure it works with pseudomuto/protoc-gen-doc, as that seems to be the most recommended community project for doc generation. I also made sure that the protoc Java compiler emits readable documentation based on the example spec in the tests. The rules for comments are: - On _field_ and _enum variant_ declarations, we will emit a trailing `//` comment if the length of the line overall will not be longer than 80 characters. - In all other cases, we will emit a block of `//` comments aligned with the beginning of the declaration. Closes #1878 --------- Co-authored-by: Will Temple <[email protected]> Co-authored-by: Timothee Guerin <[email protected]>
- Loading branch information
1 parent
f33b0fb
commit eeff796
Showing
28 changed files
with
269 additions
and
60 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@typespec/protobuf/protobuf-emit-doc-comments_2023-08-10-18-18.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@typespec/protobuf", | ||
"comment": "Added support for emitting documentation comments in protobuf specifications.", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@typespec/protobuf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.