Skip to content

Commit 589e403

Browse files
committed
add note about secret into readme
1 parent cf00799 commit 589e403

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

dlt_openapi/renderer/default/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def run(self, openapi: OpenapiParser, dry: bool = False) -> None:
5454
class_name=lambda x: misc.ClassName(x, ""),
5555
package_name=self.package_name,
5656
project_name=self.config.project_name,
57+
credentials=self.openapi.detected_global_security_scheme,
5758
)
5859

5960
if dry:
@@ -113,9 +114,7 @@ def _build_dlt_config(self) -> None:
113114
secrets_template = self.env.get_template("dlt_secrets.toml.j2")
114115
secrets_path = config_dir / "secrets.toml"
115116
secrets_path.write_text(
116-
secrets_template.render(
117-
credentials=self.openapi.detected_global_security_scheme,
118-
),
117+
secrets_template.render(),
119118
encoding=FILE_ENCODING,
120119
)
121120

@@ -132,7 +131,6 @@ def _render_source(self) -> str:
132131
source_name=self.source_name,
133132
endpoint_collection=self.openapi.endpoints,
134133
imports=[],
135-
credentials=self.openapi.detected_global_security_scheme,
136134
global_paginator_config=(
137135
self.openapi.detected_global_pagination.paginator_config
138136
if self.openapi.detected_global_pagination

dlt_openapi/renderer/default/templates/README.md.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Created with [dlt-openapi](https://github.com/dlt-hub/dlt-openapi) v. {{version}
66
* https://github.com/dlt-hub/dlt
77
* https://github.com/dlt-hub/dlt-openapi
88

9+
{% if credentials %}
10+
## Credentials
11+
This API uses {{ credentials.type }} authentication. Please fill in the required variable {{ credentials.detected_secret_name }} in your
12+
secrets.toml.
13+
{% endif %}
14+
915
## Available resources
1016
{% for endpoint in endpoint_collection.all_endpoints_to_render %}
1117
* {{ endpoint.detected_resource_name }}

0 commit comments

Comments
 (0)