Merge pull request #36 from noironetworks/noironetworks

Fix crashes on Python 2.7+ and when an operation is missing the "tags" key
This commit is contained in:
Brendan Burns
2017-11-30 18:36:47 -08:00
committed by GitHub

View File

@@ -96,11 +96,11 @@ def remove_watch_operations(op, parent, operation_ids):
def strip_tags_from_operation_id(operation, _):
operation_id = operation['operationId']
if 'tags' in operation:
for t in operation['tags']:
operation_id = operation_id.replace(_to_camel_case(t), '')
operation['operationId'] = operation_id
def add_custom_objects_spec(spec):
with open(CUSTOM_OBJECTS_SPEC_PATH, 'r') as custom_objects_spec_file:
custom_objects_spec = json.loads(custom_objects_spec_file.read())
@@ -123,7 +123,7 @@ def process_swagger(spec, client_language):
apply_func_to_spec_operations(
spec, remove_watch_operations, operation_ids)
except PreprocessingException as e:
print(e.message)
print(e)
remove_model_prefixes(spec)