Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spaces endpoint doesn't honour the name query parameter #7347

Closed
1 task done
slewis74 opened this issue Feb 2, 2022 · 4 comments
Closed
1 task done

Spaces endpoint doesn't honour the name query parameter #7347

slewis74 opened this issue Feb 2, 2022 · 4 comments
Assignees
Labels
kind/bug This issue represents a verified problem we are committed to solving

Comments

@slewis74
Copy link

slewis74 commented Feb 2, 2022

Team

  • I've assigned a team label to this issue

Severity

None blocking, has shown up in things like the Terraform provider where engineers have assumed this is a valid query parameter

Version

2021.2

Latest Version

I could reproduce the problem in the latest build

What happened?

The root document exposes the following template for the Spaces endpoint

/api/spaces{/id}{?name,skip,ids,take,partialName}

However the name parameter is not applied. Providing a value for it results in all spaces being returned.

Given the parameter list, the expected behaviour would be for it to be doing an exact name match with that parameter. This filtering not working was a root cause of this issue in the Terraform provider.

Reproduction

Create 2 spaces with unique names.
Using a browser or Postman or tool of choice hit /api/spaces?name=oneOfYourNames and the json will contain the data for both spaces.

Error and Stacktrace

No response

More Information

No response

Workaround

Use partialName and check the result set yourself for the exact match you need.

@slewis74 slewis74 added kind/bug This issue represents a verified problem we are committed to solving state/triage labels Feb 2, 2022
@johnsimons
Copy link

Possible related to #7321

@paulegradie
Copy link

I've reviewed the original Index responder / descriptor and it appears that the exact name filter was never implemented for these endpoint types. Furthermore, the old spec (whcih I think probably comes from the SpaceRoute.cs Template) doesn't match what the actual Index route provides (only partialName is available):

        public string Template => Route("spaces{/id}{?name,skip,ids,take,partialName}");
        public string Index => Route("spaces{?skip,take,ids,partialName}");

That is what will have probably led to the incorrect links collections being returned as well as the old swagger (which I think was incorrect).

This isn't related to #7321 (that was an actual bug I introduced 😓 ).

@slewis74 Filtering on the name is new functionality - so we can consider closing this issue. If we need exact name filtering, we can certainly add that to the API - its a pretty small bit of work 👍

@slewis74
Copy link
Author

slewis74 commented Feb 2, 2022

I don't think we actually need to support exact name filtering, but if we don't then we should remove name from the template so we aren't misrepresenting what the API supports.

@Octobob
Copy link
Member

Octobob commented Apr 11, 2022

🎉 The fix for this issue has been released in:

Release stream Release
2022.1 2022.1.1062
2022.2+ all releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This issue represents a verified problem we are committed to solving
Projects
None yet
Development

No branches or pull requests

4 participants