Skip to content

Instantly share code, notes, and snippets.

@Ryuno-Ki
Created August 8, 2018 14:07
Show Gist options
  • Save Ryuno-Ki/670c744356e26e607277abbe4f3c9676 to your computer and use it in GitHub Desktop.
Save Ryuno-Ki/670c744356e26e607277abbe4f3c9676 to your computer and use it in GitHub Desktop.
Adobe Analytics API v1.4 with cycle dependency

Adobe Analytics API v1.4 with cycle dependency

The following gist describes a detected cycle dependency in the v1.4 of Adobe Analytics API. See public.json for inspection.

Here the pyswagger package was used. However, the problem occurs also with a python client generated via Swagger Editor.

Steps to reproduce

  1. Prepare a virtualenv venv using Python 3.5 and make sure, you have pip installed.
  2. source venv/bin/activate
  3. pip install -r requirements.txt 3.1 pip install python-client/ if you generated the code via Swagger Editor
  4. python app.py

Expected behaviour

The log message, that the app is running.

Actual behaviour

See pasted output.txt

Additional information

Looking into the code, there is a cycle dependency between report_description_search and report_description_searches:

# Line 19 in swagger_client.models.report_description_searches.py
from swagger_client.models.report_description_search import ReportDescriptionSearch  # noqa: F401,E501
# Line 20 in swagger_client.models.report_description_search.py
from swagger_client.models.report_description_searches import ReportDescriptionSearches  # noqa: F401,E501

This makes it impossible to consume the app with a Python client. Looking at the output.txt there could be more cycle dependencies like this.

from pprint import pprint
from pyswagger import App
SWAGGER_FILE_URL = "https://adobedocs.github.io/analytics-1.4-apis/public.json"
try:
app = App.create(SWAGGER_FILE_URL)
print('App is running')
except Exception as e:
pprint("Failed with exception %s" % e)
python src/app/app.py
('Failed with exception Cycles detected in Schema Object: '
"[['https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/segment_container', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/segment_rule_array', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/segment_rule', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/segment_container'], "
"['https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/reportDescriptionSearch', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/reportDescriptionSearches', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/reportDescriptionSearch'], "
"['https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/calc_metric_definition', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/calc_metric_definition_array', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/calc_metric_definition'], "
"['https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/calc_metric_definition', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/calc_metric_definition'], "
"['https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/reportData', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/reportDataList', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/reportData'], "
"['https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/classification_item', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/classification_item_array', "
"'https://adobedocs.github.io/analytics-1.4-apis/public.json#/definitions/classification_item']]")
python-dotenv==0.9.1
pylint==2.1.1
pyswagger==0.8.40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment