Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings during generation due to missing summary and description #178

Merged
merged 1 commit into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generate/templates/api.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type {{cut classname "Api"}} struct {

{{#if isDeprecated}}
// Deprecated{{/if}}
// {{operationId}} {{{summary}}}{{#if notes}}
// {{operationId}} {{#if summary}}{{{summary}}}{{/if}}{{#if notes}}
// {{{notes}}}{{/if}}{{#each pathParams}}{{#endsWith baseName "_mount_path"}}{{else}}{{#with description}}
// {{paramName}}: {{.}}{{/with}}{{/endsWith}}{{/each}}{{#each bodyParams}}{{#with description}}
// {{paramName}}: {{.}}{{/with}}{{/each}}{{#each queryParams}}{{#neq paramName "list"}}{{#with description}}
Expand Down
10 changes: 5 additions & 5 deletions generate/templates/api_doc.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

Method | HTTP request | Description
------------- | ------------- | -------------
{{#with operations}}{{#each operation}}{{#endsWith operationId "2"}}{{else}}{{#endsWith operationId "3"}}{{else}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{#with operations}}{{#each operation}}{{#endsWith operationId "2"}}{{else}}{{#endsWith operationId "3"}}{{else}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#if summary}}{{summary}}{{/if}}
{{/endsWith}}{{/endsWith}}{{/each}}{{/with}}

{{#with operations}}
{{#each operation}}{{#endsWith operationId "2"}}{{else}}{{#endsWith operationId "3"}}{{else}}

## {{{operationId}}}

{{{summary}}}{{#if notes}}
{{#if summary}}{{{summary}}}{{/if}}{{#if notes}}

{{{unespacedNotes}}}{{/if}}

Expand All @@ -38,7 +38,7 @@ func main() {
log.Fatal(err)
}
{{#each allParams}}{{#if isPathParam}}{{#endsWith baseName "_mount_path"}}{{else}}
{{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{{description}}}{{#with defaultValue}} (defaults to {{{.}}}){{/with}}{{/endsWith}}{{/if}}{{/each}}{{#each bodyParams}}
{{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{#if description}}{{{description}}}{{/if}}{{#with defaultValue}} (defaults to {{{.}}}){{/with}}{{/endsWith}}{{/if}}{{/each}}{{#each bodyParams}}
request := schema.New{{{dataType}}}WithDefaults(){{/each}}{{#each allParams}}{{#if isQueryParam}}{{#neq paramName "list"}}
{{paramName}} := {{{vendorExtensions.x-go-example}}} // {{{dataType}}} | {{{description}}}{{#with defaultValue}} (defaults to {{{.}}}){{/with}}{{/neq}}{{/if}}{{/each}}
resp, err := client.{{cut classname "Api"}}.{{operationId}}(
Expand All @@ -63,14 +63,14 @@ func main() {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for request cancellation {{/if}}{{/each}}{{#each pathParams}}{{#endsWith baseName "_mount_path"}}{{else}}
**{{paramName}}** | {{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{baseType}}.md){{/unless}}{{/unless}} | {{description}} | {{#with defaultValue}}[default to {{.}}]{{/with}}{{/endsWith}}{{/each}}
**{{paramName}}** | {{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{baseType}}.md){{/unless}}{{/unless}} | {{#if description}}{{description}}{{/if}} | {{#with defaultValue}}[default to {{.}}]{{/with}}{{/endsWith}}{{/each}}

### Other Parameters

{{#each allParams}}{{#if @last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/if}}{{/each}}{{#each allParams}}
{{#unless isPathParam}} **{{paramName}}** | {{#if isContainer}}{{#if isArray}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**[]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{#if isMap}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**map[string]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{/if}}{{#unless isContainer}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/unless}} | {{description}} | {{#with defaultValue}}[default to {{.}}]{{/with}}{{/unless}}{{/each}}
{{#unless isPathParam}} **{{paramName}}** | {{#if isContainer}}{{#if isArray}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**[]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{#if isMap}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**map[string]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{/if}}{{#unless isContainer}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/unless}} | {{#if description}}{{description}}{{/if}} | {{#with defaultValue}}[default to {{.}}]{{/with}}{{/unless}}{{/each}}

{{#with returnType}}{{#with returnTypeIsPrimitive}}**{{{returnType}}}**{{/with}}{{#unless returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/unless}}{{/with}}{{#unless returnType}} (empty response body){{/unless}}

Expand Down
2 changes: 1 addition & 1 deletion generate/templates/model_doc.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------{{#with vendorExtensions.x-is-one-of-interface}}
**{{classname}}Interface** | **interface { {{#with discriminator}}{{propertyGetter}}() {{propertyType}}{{/with}} }** | An interface that can hold any of the proper implementing types |
{{/with}}{{#unless vendorExtensions.x-is-one-of-interface}}
{{#each vars}}**{{name}}** | {{#unless required}}Pointer to {{/unless}}{{#if isContainer}}{{#if isArray}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**[]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{dataType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{#if isMap}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**map[string]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{/if}}{{#unless isContainer}}{{#unless isPrimitiveType}}{{#unless isFile}}{{#unless isDateTime}}[{{/unless}}{{/unless}}{{/unless}}**{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}{{#unless isDateTime}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/unless}}{{/unless}} | {{description}} | {{#unless required}}[optional] {{/unless}}{{#if isReadOnly}}[readonly] {{/if}}{{#with defaultValue}}[default to {{{.}}}]{{/with}}
{{#each vars}}**{{name}}** | {{#unless required}}Pointer to {{/unless}}{{#if isContainer}}{{#if isArray}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**[]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{dataType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{#if isMap}}{{#with items}}{{#unless isPrimitiveType}}{{#unless isFile}}[{{/unless}}{{/unless}}**map[string]{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/with}}{{/if}}{{/if}}{{#unless isContainer}}{{#unless isPrimitiveType}}{{#unless isFile}}{{#unless isDateTime}}[{{/unless}}{{/unless}}{{/unless}}**{{dataType}}**{{#unless isPrimitiveType}}{{#unless isFile}}{{#unless isDateTime}}]({{#unless baseType}}{{dataType}}{{/unless}}{{baseType}}.md){{/unless}}{{/unless}}{{/unless}}{{/unless}} | {{#if description}}{{description}}{{/if}} | {{#unless required}}[optional] {{/unless}}{{#if isReadOnly}}[readonly] {{/if}}{{#with defaultValue}}[default to {{{.}}}]{{/with}}
{{/each}}
{{/unless}}

Expand Down
2 changes: 1 addition & 1 deletion generate/templates/model_simple.handlebars
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// {{classname}} {{{description}}}{{#unless description}}struct for {{{classname}}}{{/unless}}
// {{classname}} {{#if description}}{{{description}}}{{else}}struct for {{{classname}}}{{/if}}
type {{classname}} struct {
{{#with parent}}
{{#unless isMap}}
Expand Down