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

Can't delete paths anymore #897

Closed
reuvenharrison opened this issue Jan 24, 2024 · 2 comments · Fixed by #899
Closed

Can't delete paths anymore #897

reuvenharrison opened this issue Jan 24, 2024 · 2 comments · Fixed by #899

Comments

@reuvenharrison
Copy link
Contributor

Hi,
Before #882 I could delete a path like this:

func filterPathsByExtensionInternal(paths *openapi3.Paths, r *regexp.Regexp) {
	for path, pathItem := range paths.Map() {
		for extension := range pathItem.Extensions {
			if r.MatchString(extension) {
				delete(paths.Map(), path)
				break
			}
		}
	}
}

After the PR, Map() returns a copy rather than the original paths map which makes it impossible to delete paths.
I suggest to add a Delete function in maps.sh similar to the Set function.
I'm happy to create the PR if this makes sense.

@fenollp
Copy link
Collaborator

fenollp commented Jan 24, 2024

Ah sorry about that. I did mean Map() to return a copy (in preparation of the orderedmaps PR).
You're right the solution here is as you describe.

Please send a PR :)

@tcdsv
Copy link
Contributor

tcdsv commented Jan 28, 2024

Hello @fenollp
I opened a PR for this issue
Thanks

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 a pull request may close this issue.

3 participants