Skip to content
Open
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
4 changes: 2 additions & 2 deletions .generator/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ def undo_operations():
@given(parsers.parse('an instance of "{name}" API'))
def api(context, api_version, specs, name):
"""Return an API instance."""
assert name in {tag["name"].replace(" ", "") for tag in specs[api_version]["tags"]}
raw_tag = next(t["name"] for t in specs[api_version]["tags"] if t["name"].replace(" ", "") == name)
sanitized_name = name.replace("-", "")
context["api_instance"] = {"name": sanitized_name}
context["api_instance"] = {"name": sanitized_name, "raw_tag": raw_tag}


@given(parsers.parse('operation "{name}" enabled'))
Expand Down
2 changes: 1 addition & 1 deletion .generator/src/generator/templates/apis.j2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{%- for api in apis %}
{%- set classname = api|class_name %}
from {{ package }}.{{ version }}.api.{{ classname|safe_snake_case }} import {{ classname }}
from {{ package }}.{{ version }}.api.{{ api|safe_snake_case }}_api import {{ classname }}
{%- endfor %}


Expand Down
2 changes: 1 addition & 1 deletion .generator/src/generator/templates/example.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from {{ package }} import {{ values|sort|join(', ') }}
{%- endfor %}
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.{{ version }}.api.{{ context.api_instance.name|safe_snake_case }}_api import {{ context.api_instance.name }}Api
from datadog_api_client.{{ version }}.api.{{ context.api_instance.raw_tag|safe_snake_case }}_api import {{ context.api_instance.name }}Api
{%- for package in imports|sort %}
from {{ package }} import {{ imports[package]|sort|join(', ') }}
{%- endfor %}
Expand Down
Loading