code: def process_enums(swagger_definitions: dict) -> typing.Dict[int, str]:
      """
      Process enums from swagger definitions. In OpenAPI spec v2 generated
      by  protoc-gen-openapi enums are not linked to a definition and are inlined.
      Here we preprocess them so that they can  be linked to a definition.
      """
      enums = {}
      for name, schema in swagger_definitions.items():
          if "enum" in schema:
              members = schema["enum"]
              if enums.get(json.dumps(members)) is not None:
                  print(
                      "ambiguous enum parameter:",
                      name,
                      members,
                      file=sys.stderr,
                  )
              enums[json.dumps(members)] = name
      return enums
  
imports: import json
  import logging
  import sys
  import typing
  from dataclasses import dataclass, field
  import typing_extensions
label_desc: Use image node_id 2 for calling a global function with example usage: process_enums(swagger_definitions) and returns: enums