Skip to content

Commit 2f0cfd4

Browse files
api-clients-generation-pipeline[bot]skarimoci.datadog-api-spec
authored
Add support for documenting auth bearer token (#2610)
* disable bearer auth * Regenerate client from commit 7a9d0200 of spec repo --------- Co-authored-by: Sherzod Karimov <sherzod.karimov@datadoghq.com> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com> Co-authored-by: skarimo <40482491+skarimo@users.noreply.github.com>
1 parent 2048608 commit 2f0cfd4

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-12-10 21:05:03.161482",
8-
"spec_repo_commit": "1c4c91d4"
7+
"regenerated": "2024-12-11 14:25:08.994300",
8+
"spec_repo_commit": "7a9d0200"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-12-10 21:05:03.180223",
13-
"spec_repo_commit": "1c4c91d4"
12+
"regenerated": "2024-12-11 14:25:09.012979",
13+
"spec_repo_commit": "7a9d0200"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23427,6 +23427,12 @@ components:
2342723427
type: apiKey
2342823428
x-auth-id-alias: appKeyAuth
2342923429
x-env-name: DD_APP_KEY
23430+
bearerAuth:
23431+
in: header
23432+
name: Authorization
23433+
scheme: bearer
23434+
type: http
23435+
x-env-name: DD_BEARER_TOKEN
2343023436
info:
2343123437
contact:
2343223438
email: support@datadoghq.com

.generator/schemas/v2/openapi.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27751,6 +27751,12 @@ components:
2775127751
name: DD-APPLICATION-KEY
2775227752
type: apiKey
2775327753
x-env-name: DD_APP_KEY
27754+
bearerAuth:
27755+
in: header
27756+
name: Authorization
27757+
scheme: bearer
27758+
type: http
27759+
x-env-name: DD_BEARER_TOKEN
2775427760
info:
2775527761
contact:
2775627762
email: support@datadoghq.com

.generator/src/generator/templates/ApiClient.j2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,16 +261,19 @@ public class ApiClient {
261261
authentications = new HashMap<String, Authentication>();
262262
Authentication auth = null;
263263
{%- for name, schema in specs.v2.components.securitySchemes.items() %}
264+
{%- if schema.type == "oauth2" %}
264265
if (authMap != null) {
265266
auth = authMap.get("{{ name }}");
266267
}
267-
{%- if schema.type == "oauth2" %}
268268
if (auth instanceof OAuth) {
269269
authentications.put("{{ name }}", auth);
270270
} else {
271271
authentications.put("{{ name }}", new OAuth(basePath, "{{ schema.flows.authorizationCode.tokenUrl }}"));
272272
}
273-
{%- else %}
273+
{%- elif schema.type == "apiKey" %}
274+
if (authMap != null) {
275+
auth = authMap.get("{{ name }}");
276+
}
274277
if (auth instanceof {{ schema.type|upperfirst ~ "Auth" }}) {
275278
authentications.put("{{ name }}", auth);
276279
} else {

0 commit comments

Comments
 (0)