Description
DefaultGenerator allows for generating api docs without model docs, and model docs without api docs. Templates for csharp, java, and possibly others make the assumption these are always generated together. I discovered this while creating a new generator and looking at how doc templates are done in existing generators.
Swagger-codegen version
All versions supporting api/model docs.
Swagger declaration file content or url
N/A
Command line used for generation
N/A
Steps to reproduce
# NOTE: You have to delete existing docs, otherwise old model docs still "work"
\rm -rf samples/client/petstore/csharp/SwaggerClient/docs
JAVA_OPTS="$JAVA_OPTS -DmodelDocs=false" ./bin/csharp-petstore.sh
git status
You'll notice after running git status that all model documentation is marked for deletion.
In C#, the README will reference files that no longer exist:

In addition to README, api docs point back to the model documentation section from the above screenshot:
[[Back to Model list]](../README.md#documentation-for-models)
As well as linking to missing parameter models:
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
and return types:
### Return type
[**ApiResponse**](ApiResponse.md)
Related issues
N/A
Suggest a Fix
As part of #5731, I've added the global additionalProperties: generateApiDocs and generateModelDocs. In that PR, I've used these to conditionally modify parameters, return types, and README sections to avoid generating broken links.
For example (from linked Kotlin client PR):
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{#generateModelDocs}}[**{{returnType}}**]({{returnBaseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{returnType}}**{{/generateModelDocs}}{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}}
This should be an easy modification after PR #5731 is merged and the template properties are available. We'll probably want to list affected generator documentation templates as a TODO in this description.
Description
DefaultGeneratorallows for generating api docs without model docs, and model docs without api docs. Templates for csharp, java, and possibly others make the assumption these are always generated together. I discovered this while creating a new generator and looking at how doc templates are done in existing generators.Swagger-codegen version
All versions supporting api/model docs.
Swagger declaration file content or url
N/A
Command line used for generation
N/A
Steps to reproduce
You'll notice after running
git statusthat all model documentation is marked for deletion.In C#, the README will reference files that no longer exist:
In addition to README, api docs point back to the model documentation section from the above screenshot:
As well as linking to missing parameter models:
and return types:
Related issues
N/A
Suggest a Fix
As part of #5731, I've added the global additionalProperties:
generateApiDocsandgenerateModelDocs. In that PR, I've used these to conditionally modify parameters, return types, and README sections to avoid generating broken links.For example (from linked Kotlin client PR):
This should be an easy modification after PR #5731 is merged and the template properties are available. We'll probably want to list affected generator documentation templates as a TODO in this description.