Skip to content

Commit

Permalink
docs(clients): add ACL section to code doc (#2576)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Jan 29, 2024
1 parent 7a60a98 commit b3d6112
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 61 deletions.
4 changes: 4 additions & 0 deletions clients/algoliasearch-client-java/algoliasearch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked', '-Xlint:cast', '-Xlint:rawtypes']
}

javadoc {
options.encoding = 'UTF-8'
}
15 changes: 9 additions & 6 deletions templates/csharp/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ namespace Algolia.Search.Clients;
{
{{#operation}}
/// <summary>
/// {{{summary}}}
/// </summary>
/// <remarks>
/// {{{notes}}}
/// </remarks>
/// </summary>
{{#allParams}}
/// <param name="{{paramName}}">{{{description}}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}
Expand Down Expand Up @@ -106,8 +103,14 @@ namespace Algolia.Search.Clients;
{{#supportsAsync}}

/// <summary>
/// {{{summary}}} {{notes}}
/// </summary>
/// {{{notes}}}
/// </summary>{{#vendorExtensions}}{{#x-acl.0}}
///
/// Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
/// - {{.}}
{{/x-acl}}
{{/vendorExtensions}}
{{#allParams}}
/// <param name="{{paramName}}">{{description}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}</param>
{{/allParams}}
Expand Down
11 changes: 8 additions & 3 deletions templates/dart/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ final class {{classname}} implements ApiClient {
}
{{#operation}}

/// {{{summary}}}{{^summary}}{{{nickname}}}{{/summary}}
/// {{{notes}}}
/// {{{notes}}}{{#vendorExtensions}}{{#x-acl.0}}
///
/// Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
/// - {{.}}
{{/x-acl}}
{{/vendorExtensions}}
///
/// Parameters:
{{#allParams}}
Expand Down Expand Up @@ -203,4 +208,4 @@ final class {{classname}} implements ApiClient {
@override
void dispose() => _retryStrategy.dispose();
}
{{/operations}}
{{/operations}}
12 changes: 10 additions & 2 deletions templates/go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,19 @@ func (r {{#structPrefix}}{{&classname}}{{/structPrefix}}{{^structPrefix}}Api{{/s
{{/allParams}}
{{/hasParams}}
/*
{{operationId}} {{{summary}}} Wraps {{nickname}}WithContext using context.Background.{{^summary}}Method for {{operationId}}{{/summary}}
{{operationId}} Wraps {{nickname}}WithContext using context.Background.
{{#notes}}

{{{unescapedNotes}}}
{{/notes}}
{{#vendorExtensions}}
{{#x-acl.0}}

Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
- {{.}}
{{/x-acl}}
{{/vendorExtensions}}

Request can be constructed by NewApi{{operationId}}Request with parameters below.
{{#allParams}}
Expand All @@ -128,7 +136,7 @@ func (c *APIClient) {{nickname}}({{#hasParams}}r {{#structPrefix}}{{&classname}}
}

/*
{{operationId}} {{{summary}}}{{^summary}}Method for {{operationId}}{{/summary}}
{{operationId}}
{{#notes}}

{{{unescapedNotes}}}
Expand Down
8 changes: 4 additions & 4 deletions templates/java/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public class {{classname}} extends ApiClient {

/**
* (asynchronously)
* {{notes}}{{#allParams}}
* {{{notes}}}{{#allParams}}
* @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#vendorExtensions}}{{#x-is-generic}}
* @param innerType The class held by the index, could be your custom class or {@link Object}.{{/x-is-generic}}{{/vendorExtensions}}
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
Expand All @@ -186,7 +186,7 @@ public class {{classname}} extends ApiClient {
{{! This case only sets `requestOptions` as optional }}
/**
* (asynchronously)
* {{notes}}{{#allParams}}
* {{{notes}}}{{#allParams}}
* @param {{paramName}} {{{description}}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#vendorExtensions}}{{#x-is-generic}}
* @param innerType The class held by the index, could be your custom class or {@link Object}.{{/x-is-generic}}{{/vendorExtensions}}
{{> api_javadoc}}
Expand All @@ -198,7 +198,7 @@ public class {{classname}} extends ApiClient {
{{#optionalParams.0}}
/**
* (asynchronously)
* {{notes}}{{#requiredParams}}
* {{{notes}}}{{#requiredParams}}
* @param {{paramName}} {{{description}}} (required){{/requiredParams}}{{#vendorExtensions}}{{#x-is-generic}}
* @param innerType The class held by the index, could be your custom class or {@link Object}.{{/x-is-generic}}{{/vendorExtensions}}
* @param requestOptions The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
Expand All @@ -212,7 +212,7 @@ public class {{classname}} extends ApiClient {
{{#optionalParams.0}}
/**
* (asynchronously)
* {{notes}}{{#requiredParams}}
* {{{notes}}}{{#requiredParams}}
* @param {{paramName}} {{{description}}} (required){{/requiredParams}}{{#vendorExtensions}}{{#x-is-generic}}
* @param innerType The class held by the index, could be your custom class or {@link Object}.{{/x-is-generic}}{{/vendorExtensions}}
{{> api_javadoc}}
Expand Down
5 changes: 1 addition & 4 deletions templates/java/api_javadoc.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
{{#isDeprecated}}
* @deprecated
{{/isDeprecated}}
{{#externalDocs}}
* @see <a href="{{url}}">{{{summary}}} Documentation</a> ({{{description}}})
{{/externalDocs}}
*/
{{#isDeprecated}}
@Deprecated
{{/isDeprecated}}
{{/isDeprecated}}
8 changes: 4 additions & 4 deletions templates/java/oneof_interface.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface {{classname}}{{#vendorExtensions.x-has-child-generic}}<T>{{/ven
{{#composedSchemas.oneOf}}
{{^isModel}}
{{^isEnumRef}}
/** {{classname}} as {{{datatypeWithEnum}}} wrapper. */
// {{classname}} as {{{datatypeWithEnum}}} wrapper.
static {{classname}} of{{#isArray}}{{#lambda.type-to-name}}{{{datatypeWithEnum}}}{{/lambda.type-to-name}}{{/isArray}}({{{datatypeWithEnum}}} value) {
return new {{#lambda.type-to-name}}{{{datatypeWithEnum}}}{{/lambda.type-to-name}}Wrapper(value);
}
Expand All @@ -37,7 +37,7 @@ public interface {{classname}}{{#vendorExtensions.x-has-child-generic}}<T>{{/ven
{{#composedSchemas.oneOf}}
{{^isModel}}
{{^isEnumRef}}
/** {{classname}} as {{{datatypeWithEnum}}} wrapper. */
// {{classname}} as {{{datatypeWithEnum}}} wrapper.
static {{classname}} of({{{datatypeWithEnum}}} value) {
return new {{#lambda.type-to-name}}{{{datatypeWithEnum}}}{{/lambda.type-to-name}}Wrapper(value);
}
Expand All @@ -49,7 +49,7 @@ public interface {{classname}}{{#vendorExtensions.x-has-child-generic}}<T>{{/ven
{{#composedSchemas.oneOf}}
{{^isModel}}
{{^isEnumRef}}
/** {{classname}} as {{{datatypeWithEnum}}} wrapper. */
// {{classname}} as {{{datatypeWithEnum}}} wrapper.
@JsonSerialize(using = {{#lambda.type-to-name}}{{{datatypeWithEnum}}}{{/lambda.type-to-name}}Wrapper.Serializer.class)
class {{#lambda.type-to-name}}{{{datatypeWithEnum}}}{{/lambda.type-to-name}}Wrapper implements {{classname}}{
private final {{{datatypeWithEnum}}} value;
Expand Down Expand Up @@ -125,4 +125,4 @@ public interface {{classname}}{{#vendorExtensions.x-has-child-generic}}<T>{{/ven
{{/isNullable}}
}
}
}
}
12 changes: 6 additions & 6 deletions templates/javascript/clients/client/api/operation/jsdoc.mustache
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
{{#notes}}
* {{{notes}}}
{{/notes}}
{{#summary}}
* @summary {{{summary}}}
{{/summary}}
{{#vendorExtensions}}
* {{{.}}}{{/notes}}{{#vendorExtensions}}{{#x-acl.0}}
*
* Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
* - {{.}}
{{/x-acl}}
{{#x-create-wrapping-object}}
* @param {{nickname}} - The {{nickname}} object.
{{#allParams}}
Expand Down
9 changes: 7 additions & 2 deletions templates/kotlin/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,13 @@ public class {{classname}}(
{{#operation}}

/**
* {{{summary}}}
* {{{notes}}}
* {{{notes}}}{{#vendorExtensions}}{{#x-acl.0}}
*
* Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
* - {{.}}
{{/x-acl}}
{{/vendorExtensions}}
{{#allParams}}
* @param {{{paramName}}} {{{description}}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}
Expand Down
17 changes: 10 additions & 7 deletions templates/php/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,17 @@ use {{invokerPackage}}\Support\Helpers;

{{#operation}}
/**
{{#summary}}
* {{.}}
{{/summary}}
{{#notes}}
* {{{.}}}
*
{{#description}}
* {{.}}
*
{{/description}}
{{/notes}}
{{#vendorExtensions}}
{{#x-acl.0}}
* Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
* - {{.}}
{{/x-acl}}
{{/vendorExtensions}}
{{#allParams}}
* @param {{#isString}}string{{/isString}}{{#isLong}}int{{/isLong}}{{#isInteger}}int{{/isInteger}}{{#isBoolean}}bool{{/isBoolean}}{{^isString}}{{^isLong}}{{^isInteger}}{{^isBoolean}}array{{/isBoolean}}{{/isInteger}}{{/isLong}}{{/isString}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}}
{{#isModel}}
Expand Down
26 changes: 17 additions & 9 deletions templates/python/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ class {{classname}}:

async def {{operationId}}_with_http_info{{>partial_api_args}} -> ApiResponse[str]:
"""
{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}}

{{#isDeprecated}}
(Deprecated) {{operationId}}
{{/isDeprecated}}
{{#notes}}
{{{.}}}
{{/notes}}

{{/notes}}{{#vendorExtensions}}{{#x-acl.0}}
Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
- {{.}}
{{/x-acl}}{{/vendorExtensions}}
{{#allParams}}
:param {{paramName}}:{{#description}} {{{.}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}
:type {{paramName}}: {{dataType}}{{#optional}}, optional{{/optional}}
Expand Down Expand Up @@ -151,12 +155,16 @@ class {{classname}}:

async def {{operationId}}{{>partial_api_args}} -> {{{returnType}}}{{^returnType}}None{{/returnType}}:
"""
{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}}

{{#isDeprecated}}
(Deprecated) {{operationId}}
{{/isDeprecated}}
{{#notes}}
{{{.}}}
{{/notes}}

{{/notes}}{{#vendorExtensions}}{{#x-acl.0}}
Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
- {{.}}
{{/x-acl}}{{/vendorExtensions}}
{{#allParams}}
:param {{paramName}}:{{#description}} {{{.}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}
:type {{paramName}}: {{dataType}}{{#optional}}, optional{{/optional}}
Expand All @@ -169,4 +177,4 @@ class {{classname}}:
return (await self.{{operationId}}_with_http_info({{#allParams}}{{paramName}},{{/allParams}}request_options)).deserialize({{{returnType}}})

{{/operation}}
{{/operations}}
{{/operations}}
22 changes: 16 additions & 6 deletions templates/ruby/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ module {{moduleName}}
end

{{#operation}}
{{#summary}}
# {{.}}
{{/summary}}
{{#notes}}
# {{.}}
{{/notes}}
{{#vendorExtensions}}
{{#x-acl.0}}
#
# Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
# - {{.}}
{{/x-acl}}
{{/vendorExtensions}}
{{#allParams}}
{{#required}}
# @param {{paramName}} [{{{dataType}}}] {{description}} (required)
Expand Down Expand Up @@ -182,12 +187,17 @@ module {{moduleName}}
@api_client.call_api(:{{httpMethod}}, path, new_options)
end

{{#summary}}
# {{{.}}}
{{/summary}}
{{#notes}}
# {{{.}}}
{{/notes}}
{{#vendorExtensions}}
{{#x-acl.0}}
#
# Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
# - {{.}}
{{/x-acl}}
{{/vendorExtensions}}
{{#allParams}}
{{#required}}
# @param {{paramName}} [{{{dataType}}}] {{description}} (required)
Expand Down
8 changes: 8 additions & 0 deletions templates/scala/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ class {{classname}}(
{{#operation}}
/** {{{notes}}}
{{#vendorExtensions}}
{{#x-acl.0}}
*
* Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
* - {{.}}
{{/x-acl}}
{{/vendorExtensions}}
*
{{#allParams}}
{{#description}}
Expand Down
21 changes: 13 additions & 8 deletions templates/swift/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ typealias Client = {{classname}}
{{/allParams}}

/**
{{#summary}}
{{{.}}}
{{/summary}}{{#allParams}}
- parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}}
{{#allParams}}
- parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
{{/allParams}}
- returns: {{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}
*/
{{#isDeprecated}}
Expand All @@ -83,10 +82,16 @@ typealias Client = {{classname}}
}

/**
{{#summary}}
{{{.}}}
{{/summary}}{{#notes}}
{{{.}}}{{/notes}}{{#subresourceOperation}}
{{#notes}}{{{.}}}{{/notes}}
{{#vendorExtensions}}
{{#x-acl.0}}

Required API Key ACLs:{{/x-acl.0}}
{{#x-acl}}
- {{.}}
{{/x-acl}}
{{/vendorExtensions}}
{{#subresourceOperation}}
subresourceOperation: {{.}}{{/subresourceOperation}}{{#defaultResponse}}
defaultResponse: {{.}}{{/defaultResponse}}
{{#hasResponseHeaders}}
Expand Down

0 comments on commit b3d6112

Please sign in to comment.