Skip to content

Commit

Permalink
[markdown] Fix broken links when generating markdown (#5569)
Browse files Browse the repository at this point in the history
* [markdown] Fix broken links when generating markdown

The `api.mustache` file generates links to the markdown model files.
These links were previously brokeen.

Additionally, the defaultPackage for markdown is "/Models", so this
looked pretty in the heading for model files. So this prefix has been
stripped from the header in `model.mustache`.

* Re-generate Petstore samples for markdown
  • Loading branch information
h committed Mar 10, 2020
1 parent b1aecad commit de2753d
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Class | Method | HTTP request | Description
## Documentation for Models

{{#modelPackage}}
{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}](Models/{{modelDocPath}}{{{classname}}}.md)
{{#models}}{{#model}} - [{{{classname}}}](./{{{modelPackage}}}/{{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}
{{/modelPackage}}
{{^modelPackage}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Method | HTTP request | Description
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**]({{modelPackage}}/{{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}}
{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}{{#generateModelDocs}}[**{{dataType}}**](../{{modelPackage}}/{{baseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{dataType}}**{{/generateModelDocs}}{{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}}
{{/allParams}}

### Return type

{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{#generateModelDocs}}[**{{returnType}}**]({{modelPackage}}/{{returnBaseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{returnType}}**{{/generateModelDocs}}{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}}
{{#returnType}}{{#returnTypeIsPrimitive}}**{{returnType}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}{{#generateModelDocs}}[**{{returnType}}**](../{{modelPackage}}/{{returnBaseType}}.md){{/generateModelDocs}}{{^generateModelDocs}}**{{returnType}}**{{/generateModelDocs}}{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}null (empty response body){{/returnType}}

### Authorization

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#models}}
{{#model}}
# {{{packageName}}}.{{modelPackage}}.{{{classname}}}
# {{{classname}}}
## Properties

Name | Type | Description | Notes
Expand All @@ -16,4 +16,4 @@ Name | Type | Description | Notes
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

{{/model}}
{{/models}}
{{/models}}
16 changes: 8 additions & 8 deletions samples/documentation/markdown/Apis/PetApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Add a new pet to the store

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](/Models/Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](..//Models/Pet.md)| Pet object that needs to be added to the store |

### Return type

Expand Down Expand Up @@ -77,11 +77,11 @@ Finds Pets by status

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**List**](/Models/String.md)| Status values that need to be considered for filter | [default to null] [enum: available, pending, sold]
**status** | [**List**](..//Models/String.md)| Status values that need to be considered for filter | [default to null] [enum: available, pending, sold]

### Return type

[**List**](/Models/Pet.md)
[**List**](..//Models/Pet.md)

### Authorization

Expand All @@ -104,11 +104,11 @@ Finds Pets by tags

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**List**](/Models/String.md)| Tags to filter by | [default to null]
**tags** | [**List**](..//Models/String.md)| Tags to filter by | [default to null]

### Return type

[**List**](/Models/Pet.md)
[**List**](..//Models/Pet.md)

### Authorization

Expand All @@ -135,7 +135,7 @@ Name | Type | Description | Notes

### Return type

[**Pet**](/Models/Pet.md)
[**Pet**](..//Models/Pet.md)

### Authorization

Expand All @@ -156,7 +156,7 @@ Update an existing pet

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](/Models/Pet.md)| Pet object that needs to be added to the store |
**body** | [**Pet**](..//Models/Pet.md)| Pet object that needs to be added to the store |

### Return type

Expand Down Expand Up @@ -214,7 +214,7 @@ Name | Type | Description | Notes

### Return type

[**ApiResponse**](/Models/ApiResponse.md)
[**ApiResponse**](..//Models/ApiResponse.md)

### Authorization

Expand Down
2 changes: 1 addition & 1 deletion samples/documentation/markdown/Models/ApiResponse.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ./Models.ApiResponse
# ApiResponse
## Properties

Name | Type | Description | Notes
Expand Down
2 changes: 1 addition & 1 deletion samples/documentation/markdown/Models/Category.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ./Models.Category
# Category
## Properties

Name | Type | Description | Notes
Expand Down
2 changes: 1 addition & 1 deletion samples/documentation/markdown/Models/Order.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ./Models.Order
# Order
## Properties

Name | Type | Description | Notes
Expand Down
2 changes: 1 addition & 1 deletion samples/documentation/markdown/Models/Pet.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ./Models.Pet
# Pet
## Properties

Name | Type | Description | Notes
Expand Down
2 changes: 1 addition & 1 deletion samples/documentation/markdown/Models/Tag.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ./Models.Tag
# Tag
## Properties

Name | Type | Description | Notes
Expand Down
2 changes: 1 addition & 1 deletion samples/documentation/markdown/Models/User.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ./Models.User
# User
## Properties

Name | Type | Description | Notes
Expand Down
12 changes: 6 additions & 6 deletions samples/documentation/markdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ Class | Method | HTTP request | Description
<a name="documentation-for-models"></a>
## Documentation for Models

- [/Models.ApiResponse](Models/ApiResponse.md)
- [/Models.Category](Models/Category.md)
- [/Models.Order](Models/Order.md)
- [/Models.Pet](Models/Pet.md)
- [/Models.Tag](Models/Tag.md)
- [/Models.User](Models/User.md)
- [ApiResponse](.//Models/ApiResponse.md)
- [Category](.//Models/Category.md)
- [Order](.//Models/Order.md)
- [Pet](.//Models/Pet.md)
- [Tag](.//Models/Tag.md)
- [User](.//Models/User.md)


<a name="documentation-for-authorization"></a>
Expand Down

0 comments on commit de2753d

Please sign in to comment.