Skip to content

Conversation

califlower
Copy link
Contributor

@califlower califlower commented Aug 27, 2025

Theoretically fixes #379

I think the expectation in that issue is wrong

For both the specs above we should get 3 parameters when calling GetAllParametersFromOperations and drilling into the parameters within the operation

The openapi 3.0.3 Spec says

A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters.

The example posted in my mind should return 2 in both scenarios not 3, while logging the error as you do for some of the other operations. But up for debate. I'm not really 100% sure which direction to go. A case could be made that a dupe param should hard fail, since we wouldn't know which one to pick

Resolves issue where parameters with same name but different 'in' types
were counted inconsistently based on their order in the specification.
The bug caused duplicate parameter entries when checking existing parameters.

- Extract duplicate detection logic to hasDuplicateInType helper function
- Fix loop logic that was adding parameters multiple times
- Add test case to verify consistent parameter counting regardless of order
Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.67%. Comparing base (3c96307) to head (fc0c19a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #462   +/-   ##
=======================================
  Coverage   99.67%   99.67%           
=======================================
  Files         169      169           
  Lines       24604    24606    +2     
=======================================
+ Hits        24525    24527    +2     
  Misses         74       74           
  Partials        5        5           
Flag Coverage Δ
unittests 99.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@califlower califlower closed this Aug 27, 2025
@califlower califlower reopened this Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetAllParametersFromOperations returns incorrect number of parameters
1 participant