diff --git a/openapi/preprocess_spec.py b/openapi/preprocess_spec.py index a0e70bd..5d63a62 100644 --- a/openapi/preprocess_spec.py +++ b/openapi/preprocess_spec.py @@ -96,10 +96,10 @@ def remove_watch_operations(op, parent, operation_ids): def strip_tags_from_operation_id(operation, _): operation_id = operation['operationId'] - for t in operation['tags']: - operation_id = operation_id.replace(_to_camel_case(t), '') - operation['operationId'] = operation_id - + 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: @@ -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)