Skip to content

Go generate should validate and fix all documentation URLs #1476

Closed
@gmlewis

Description

@gmlewis

Here's a wild and wacky idea. that is certainly non-trivial to get right and not for the faint-of-heart nor is it good for someone who wants to get quick brownie points for contributing to an open source project. 😄 Edit: I decided to take it on myself.

After merging #1475, it dawned on me that URLs occasionally change in the GitHub v3 API documentation, and it would be amazing and beautiful if go generate ./... could go through and not only validate that all the URLs are correct (including the fragment identifier), but also fix them when they are not.

A URL is deemed correct only when it truly matches the endpoint in question (which is the difficult part of solving this issue, especially when "fixing" a broken one).

For example, this repo consistently (for the most part) generates a URL for the corresponding API endpoint, then shortly afterward makes an HTTP request using a particular "method" such as GET, PATCH, POST, PUT, and DELETE. I envision this tool to find the URL path and associated method, and then use this information to find the correct full URL in the GitHub v3 API documentation.

In my experience from maintaining and enhancing the Google Go API auto-generator, I'm betting that this tool may require the use of a whitelist and/or blacklist for overriding exceptional cases that would otherwise be challenging to determine.

I'm throwing out this issue for discussion or in case someone feels like they are up for a challenge and is as excited as I am about solving this issue. I have an idea how I would solve it, but will refrain for awhile and see if anyone else wants to take this on first. If nobody picks it up, I'll assign it to myself and work on it. Edit: I decided to take it on myself.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions