docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Feature request: Add swagger type definitions to REST API documentation

Open Mangepange opened this issue 9 years ago • 15 comments

When generating a REST API documentation from a swagger-file I would expect that the types from the "definitions" section would be included in the documentation, especially if the type is used as a method parameter.

Mangepange avatar Sep 21 '17 06:09 Mangepange

https://github.com/dotnet/docfx/issues/465 describes the same feature. It is actually expanded in code however needs template support

vicancy avatar Sep 25 '17 04:09 vicancy

Hi! Any update on this issue?

sirjeppe avatar Oct 31 '17 12:10 sirjeppe

Could you please advise what template I should modify to get definitions into generated documentation? I've exported default.pdf template. Is it _exported_templates\pdf.default\partials\rest.child.tmpl.partial file? If yes what variables should I use from RestApi.common.js ?

rebrovoleksii avatar Dec 05 '17 14:12 rebrovoleksii

@rebrovoleksii it should be _exported_templates\pdf.default\partials\rest.child.tmpl.partial we need to update for, the "definition" object is defined in child of RestApi.common.js. @vicancy to confirm.

hellosnow avatar Dec 12 '17 04:12 hellosnow

Hi @rebrovoleksii yes, it is the rest.child.tmpl.partial file. And to render complex type, for complex type, the type is actually inside the model however not rendered. You can use docfx build --exportViewModel to view the model waiting for applying template. Take body from updatePet for example, the detailed type for body is: image

vicancy avatar Dec 12 '17 04:12 vicancy

Without support of Definitions swagger-generated documentation isn't usable. I'm waiting for its implementation. Also OpenAPI support required since it is more handy for REST API specification. For the present I am obliged to use ReDoc for the OpenAPI part of documentation.

ipanin avatar Jul 03 '18 14:07 ipanin

Hi - just wondered if this is planned at all? I too need the swagger generated docs to include the definitions, without this I'll have to find an alternative solution.

mattwoberts avatar Dec 04 '18 10:12 mattwoberts

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Mar 06 '19 03:03 stale[bot]

Thanks for the pointer vicancy, I've had a go at modifying the default template to add swagger type definitions support similar to what Microsoft already use.

https://mcm-ham.github.io/docfx-seed/restapi/petstore.html https://github.com/mcm-ham/docfx-seed/commit/81151ef0a52da8cf07cf4b38061478d1b7c05ef1

mcm-ham avatar Sep 16 '19 04:09 mcm-ham

@mcm-ham, thanks a lot. @vicancy, do you have any plans to embed this change to the default template?

ipanin avatar Oct 28 '19 20:10 ipanin

Any updates?

ipanin avatar Apr 13 '20 09:04 ipanin

@mcm-ham @ipanin We are happy to merge pull requests for this.

superyyrrzz avatar Apr 13 '20 10:04 superyyrrzz

Thank you, @mcm-ham - your solution worked for me. I just added the new files onto my existing template. It would be great to have this included in the default template.

vad710 avatar Oct 30 '20 23:10 vad710

hello guys, even though this issue is 3 years old, I wanted to ask about the current status? Is the template adjustment still working and can it be added to docfx via PR? :)

sbaeurle avatar Aug 08 '23 07:08 sbaeurle

thanks @yufeih :)

sbaeurle avatar Aug 14 '23 09:08 sbaeurle