go-github-mock icon indicating copy to clipboard operation
go-github-mock copied to clipboard

make GetReposContentsByOwnerByRepoByPath path optional

Open szesch opened this issue 10 months ago • 3 comments

The Github docs for getting repository content state

Gets the contents of a file or directory in a repository. Specify the file path or directory with the path parameter. If you omit the path parameter, you will receive the contents of the repository's root directory.

The docs are incorrect and mark the path as required. This PR makes the path optional.

szesch avatar Apr 18 '25 17:04 szesch

@szesch Thanks for the contribution!

Something that will play a role here is that the endpointspattern.go file is actually auto generated so we can't directly modify it.

There are a few other endpoints like this where the default regular expression is not quite correct. To modify it, you can look here for an example. You'll see that it intercepts the generation and allows us to define a different expression like you did.

After creating a new expression you can then run the gen.go so regenerate all endpoints with their new definitions.

Give it a go and I'm happy to review your change and get it merged.

migueleliasweb avatar Apr 18 '25 22:04 migueleliasweb

@trumant and @szesch Are we good to close this PR since https://github.com/migueleliasweb/go-github-mock/pull/82 was merged?

migueleliasweb avatar May 04 '25 00:05 migueleliasweb

Need to re-test my use case but will do so in the next 48 hours and let you know

trumant avatar May 04 '25 01:05 trumant

Let me know if this becomes a problem. Closing for now.

migueleliasweb avatar Jun 26 '25 11:06 migueleliasweb