proto doc: support file level 'not-implemented-hide' annotation#18923
proto doc: support file level 'not-implemented-hide' annotation#18923phlax merged 7 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: wbpcode <[email protected]>
Signed-off-by: wbpcode <[email protected]>
Signed-off-by: wbpcode <[email protected]>
|
I am not familiar with protodoc. But I still hava a try in my local env. My initial idea was to completely hide the document with the file level 'not-implemented-hide' annotation. But I failed. 😞 In the end, I had to choose a compromise. If there is a 'not-implemented-hide' annotation, I simply ignore all messages and return a result containing only the warning info. So, if there is a better solution, feel free to close this PR. |
|
It's probably reasonable to do it this way. Can you share a link to some generated docs with the output? Doesn't look like this is used yet. |
|
docs for this PR are rendered here: https://storage.googleapis.com/envoy-pr/18923/docs/index.html |
tools/protodoc/protodoc.py
Outdated
| 'breaking changes. Do not use this feature without understanding each of the previous ' | ||
| 'points.\n\n') | ||
|
|
||
| FILE_LEVEL_NOT_IMPLEMENTED = ( |
There was a problem hiding this comment.
im wondering whether we want a message, or rather no page at all
There was a problem hiding this comment.
My initial idea was to completely hide the document (no page at all). But the protoc plugin always need a output. 😞
There was a problem hiding this comment.
ah, i see the comments above now
wondering if there is a way around this as it seems messy to include empty/hidden pages
There was a problem hiding this comment.
what about hacking api_proto_plugin/plugin.py to bail if its an empty proto file ?
There was a problem hiding this comment.
I have tried this approach. I skip the output file generating or return output file with empty content. But I still failed. Perhaps because I am not familiar with this tool yet, there are other better methods. But I cannot be sure at the moment. 🤔
There was a problem hiding this comment.
there is already a situation in which the proto plugin skips certain files - see here:
envoy/tools/api_proto_plugin/plugin.py
Lines 69 to 70 in 8fc53a0
i may be wrong, but i think we can do something similar for hidden proto files
There was a problem hiding this comment.
@phlax it not works.
If it's independent API (not link in any doc tree):
/tmp/tmpqc31del1/generated/rst/api-v3/service/endpoint/v3/leds.proto.rst: WARNING: document isn't included in any toctree
If it's normal API:
/tmp/tmpqc31del1/generated/rst/api-v3/config/filter/network/network.rst:4: WARNING: toctree contains reference to document 'api-v3/extensions/filters/network/echo/v3/echo.proto' that doesn't have a title: no link will be generated
|
/retest |
|
Retrying Azure Pipelines: |
Remove the unnecessary file level 'not-implemented-hide' annotation. I found these annotations during the development of PR #18923 . But it seems that they should not have this annotation. If this is a misunderstanding on my part, please close this PR. Risk Level: Doc Only. Testing: N/A. Docs Changes: N/A. Release Notes: N/A. Signed-off-by: wbpcode <[email protected]>
|
OK, this generally makes sense. I'm also curious if we could generate an empty file and just not copy that into the docs tree and skip linking? |
only with what is done here - adding an orphan tag - otherwise sphinx will complain about superfluous pages |
|
Yeah, maybe just an orphan tag then. |
This is a good idea. But I am not sure how to skip linking. 🤔 It seems that we need to update |
|
@htuch @phlax I made a few additional attempts, but they all failed. If I skip whole If I return empty file or file only contains orphan tag, then there are some errors as follow: |
|
i think the former way of not producing the file at all is preferable, but not sure exactly what is required to make it work can i suggest just building the rst files and linking to it (the tarball) here - that way we can see what protodoc produces, and what sphinx tries to build from |
|
yep, and before sending these generated/collated rst files to sphinx, an $ bazel build //docs:rstit would be helpful to look at what is inside this to figure out a way forward
given that the way of adding an orphan tag etc isnt working out of the box, i would suggest focusing on not including the page at all my reading of if we really cant get protoc/protodoc/api_proto_plugin to skip some files as desired then one option is to make the file empty and have the |
I get it and has done it. Thanks. But I still cannot find a way to solve our current problem. 🤣
I am not sure, but may be we can filter the proto targets at the beginning.
This is also a possible idea. 🤔 |
i think we have to parse with protoc to get the annotations, but im wondering whether we can return empty and skip - if not i guess its plan b with stripping empty files |
I thought about it a bit more. Not too good. 😞 |
hmm, well, mho is that anything other than using |
|
I think we can just do a custom docs copy phase that take 0 byte length files and drops them. Then we just need to have these hidden pages get turned into 0 bytes. It's a bit magical, but not that unintuitive; there aren't any valid use cases for rendering a completely blank page in the API docs. |
|
/wait-any |
|
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: wbpcode <[email protected]>
Signed-off-by: wbpcode <[email protected]>
tools/docs/generate_api_rst.py
Outdated
| continue | ||
|
|
||
| # Skip copying empty files. | ||
| if (os.path.getsize(rst_file_path) == 0): |
There was a problem hiding this comment.
| if (os.path.getsize(rst_file_path) == 0): | |
| if os.path.getsize(rst_file_path) == 0: |
There was a problem hiding this comment.
get it. i will create new commit for it.
Signed-off-by: wbpcode <[email protected]>
…yproxy#18923) Signed-off-by: wbpcode <[email protected]> Signed-off-by: Josh Perry <[email protected]>

Commit Message: proto doc: support file level 'not-implemented-hide' annotation
Additional Description:
Ref #18841 for more background info.
Risk Level: Low.
Testing: N/A.
Docs Changes: N/A.
[Optional Fixes #Issue] #18841