           throw new Error "Invalid Swagger file (not a valid JSON)"
           
         if swaggerCollection
+          
           # Create a PawGroup
           pawRootGroup = context.createRequestGroup swaggerCollection.info.title
-      
-          # Add Swagger requests in root
-          if pawRootGroup
-            
-              for own path, request of swaggerCollection.paths
-                    
-                  # Create a Paw request
-                  pawRequest = @createPawRequest context, swaggerCollection, path, request
           
-                  # Add request to root group
-                  pawRootGroup.appendChild pawRequest
+          # Add Swagger groups
+          for own swaggerRequestPathName, swaggerRequestPathValue of swaggerCollection.paths
+    
+            pawGroup = @createPawGroup context, swaggerCollection, swaggerRequestPathName, swaggerRequestPathValue
+
+            # Add group to root
+            pawRootGroup.appendChild pawGroup
       
           return true
     

          #     pawRequest.multipartBody = bodyObject
          # 
          
          break # Should have only one key
        
        return pawRequest
    
    @importString = (context, string) ->
    
        # Parse JSON collection

SwaggerImporter = ->

    # Create Paw requests from a Postman Request (object)
    @createPawRequest = (context, swaggerCollection, swaggerRequestPath, swaggerRequestMethod, swaggerRequestValue) ->

        if swaggerRequestValue.summary
          swaggerRequestTitle = swaggerRequestValue.summary
        else
          swaggerRequestTitle = swaggerRequestPath
          
        swaggerRequestUrl = swaggerCollection.schemes[0] + '://' + swaggerCollection.host + swaggerCollection.basePath + swaggerRequestPath
        swaggerRequestMethod = swaggerRequestMethod.toUpperCase()
          
        # Create Paw request
        pawRequest = context.createRequest swaggerRequestTitle, swaggerRequestMethod, swaggerRequestUrl
        
        for index, swaggerRequestParamValue of swaggerRequestValue.parameters
          
          # Add Headers
          if swaggerRequestParamValue.in == 'header'
            pawRequest.setHeader swaggerRequestParamValue.name, "value"
          
          # # Set raw body
          # if postmanRequest["dataMode"] == "raw"
          #     contentType = pawRequest.getHeaderByName "Content-Type"
