zeripath/java-gitea-api

UserAPI.userCreateToken doesn't return token

slonopotamus opened this issue · 19 comments

Ugh. I'll take a look. I knew that there was something manual I had to do to the swagger JSON.

I've uploaded a fixed release 1.14.0 right now - this should work on all 1.14.x versions of Gitea.

I'll pop a PR on to Gitea to fix this more permanently.

@slonopotamus do you need me to release a fixed 1.13.x?

Yes, please, I can't upgrade due to this bug.

Err... If you released 1.14, then it's fine, no need for additional release.

Cool. OK 1.14.0 has been released.

I somewhat forgot about this thing and now tried to upgrade to newer java-gitea-api again.

The problem is: yes, userCreateToken now returns an AccessToken object. But. AccessToken only has name field: https://github.com/zeripath/java-gitea-api/blob/master/src/main/java/io/gitea/model/AccessToken.java#L32-L33 It doesn't have token itself. So while I can create tokens, I have no idea what token was created and thus can't pass it to API.

P.S. Also note that with modern Swagger schema (1.16.0+dev-56-gb9a0e3323 from https://try.gitea.io/swagger.v1.json) userCreateToken again generates with void return type.

Note that back in older days, userCreateToken has a working signature: AccessToken userCreateToken(String username, AccessTokenName accessTokenName). It accepted just token name and returned a full object that had sha1 among other fields.

ugh sorry about this!

Probably need to reapply a99fa0c each time.

Maybe we should report it upstream (Gitea)? I'm not an expert in Swagger, so don't actually understand why it can't properly generate userCreateToken signature.

OK I think this should now be fixed.

In terms of opening an issue in Gitea - I'll just open a PR.

For the record: I successfully managed to update to 1.14.0-1: git-as-svn/git-as-svn#438

Cool I'll close this. Sorry for missing the problem originally.

This is broken again in 1.15.0: https://github.com/bozaro/git-as-svn/runs/3396683858#step:5:60
Do we need to apply newer Swagger schema from Gitea?

Ah. I think this breakage might be because of a slight change of name and a consequent API change rather than the code being broken.

Oh, looks like I didn't drink enough coffee yet and though that was the same problem. No worries, class rename is easy to fix.

Sorry for the unannounced breaking change though.