Juergen Eger commited on
Commit
520d656
·
1 Parent(s): 97708fa

openapi template resources with more than 1 path parameter is not supported #267 - fixing ruff findings

Browse files
Files changed (1) hide show
  1. src/fastmcp/server/openapi.py +5 -3
src/fastmcp/server/openapi.py CHANGED
@@ -289,12 +289,14 @@ class OpenAPIResource(Resource):
289
  # Reverse sorting from creation order (traversal is backwards)
290
  param_matches.sort(reverse=True)
291
  # Number of sent parameters is number of parts -1 (assuming first part is resource identifier)
292
- expected_param_count = len(parts) -1
293
  # Map parameters from the end of the URI to the parameters in the path
294
  # Last parameter in URI (parts[-1]) maps to last parameter in path, and so on
295
  for i, param_name in enumerate(param_matches):
296
- if i < expected_param_count: # Ensure we don't use resource identifier as parameter
297
- param_value = parts[-1-i] # Get values from the end of parts
 
 
298
  path_params[param_name] = param_value
299
 
300
  # Replace path parameters with their values
 
289
  # Reverse sorting from creation order (traversal is backwards)
290
  param_matches.sort(reverse=True)
291
  # Number of sent parameters is number of parts -1 (assuming first part is resource identifier)
292
+ expected_param_count = len(parts) - 1
293
  # Map parameters from the end of the URI to the parameters in the path
294
  # Last parameter in URI (parts[-1]) maps to last parameter in path, and so on
295
  for i, param_name in enumerate(param_matches):
296
+ # Ensure we don't use resource identifier as parameter
297
+ if i < expected_param_count:
298
+ # Get values from the end of parts
299
+ param_value = parts[-1-i]
300
  path_params[param_name] = param_value
301
 
302
  # Replace path parameters with their values