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

Swagger Documentation for /v1/api-token Endpoints #29742

Closed
Tracked by #28600
gavriella-dotcms opened this issue Aug 23, 2024 · 4 comments · Fixed by #29783 or #30265
Closed
Tracked by #28600

Swagger Documentation for /v1/api-token Endpoints #29742

gavriella-dotcms opened this issue Aug 23, 2024 · 4 comments · Fixed by #29783 or #30265

Comments

@gavriella-dotcms
Copy link
Contributor

Parent Issue

28600

Task

Add Swagger documentation to api-token endpoints.

Proposed Objective

Documentation

Proposed Priority

Priority 3 - Average

Acceptance Criteria

Add endpoints should contain the following information in playground:

  • Tags
  • Descriptions
  • Parameters
  • Request bodies
  • Example values if necessary
  • Return schema

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

Endpoints being documented:

  • /v1/apitoken
  • /v1/apitoken/{tokenId}
  • /v1/apitoken/{tokenId}/jwt
  • /v1/apitoken/{tokenId}/revoke
  • /v1/apitoken/{userId}/tokens
  • /v1/apitoken/remote
  • /v1/apitoken/users/{userid}/revoke
  • /v1/apitoken/users/revoke
@gavriella-dotcms gavriella-dotcms self-assigned this Aug 23, 2024
@gavriella-dotcms gavriella-dotcms linked a pull request Aug 26, 2024 that will close this issue
3 tasks
@gavriella-dotcms gavriella-dotcms moved this from New to In Progress in dotCMS - Product Planning Sep 5, 2024
@nollymar nollymar moved this from In Progress to In Review in dotCMS - Product Planning Sep 12, 2024
@nollymar nollymar linked a pull request Sep 12, 2024 that will close this issue
3 tasks
@nollymar nollymar removed the Triage label Sep 12, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 23, 2024
### Proposed Changes
* Adding documentation to api-token endpoints

Refs: #29742 

### Checklist
- [ ] Tests
- [ ] Translations
- [ ] Security Implications Contemplated (add notes if applicable)

### Additional Info
** any additional useful context or info **

### Screenshots
Original             |  Updated
:-------------------------:|:-------------------------:
** original screenshot **  |  ** updated screenshot **

---------

Co-authored-by: Nollymar Longa <[email protected]>
Co-authored-by: nollymarlonga <[email protected]>
@github-project-automation github-project-automation bot moved this from In Review to Internal QA in dotCMS - Product Planning Sep 23, 2024
@nollymar nollymar reopened this Sep 24, 2024
@github-project-automation github-project-automation bot moved this from Internal QA to Current Sprint Backlog in dotCMS - Product Planning Sep 24, 2024
@nollymar nollymar moved this from Current Sprint Backlog to Internal QA in dotCMS - Product Planning Sep 24, 2024
@valentinogiardino valentinogiardino self-assigned this Sep 24, 2024
@nollymar nollymar moved this from Internal QA to Next 1-3 Sprints in dotCMS - Product Planning Sep 24, 2024
@valentinogiardino
Copy link
Contributor

IQA FAILED

Tested on trunk_477606b

You can view the detailed findings here: Document.

In summary, I found inconsistencies between the response descriptions and the actual outputs returned by the endpoints. There are also some typos and discrepancies in the parameter names.

I couldn't test the POST request as it returns a 400 error. This might be due to an issue with the body I'm passing, but I haven't identified the exact problem. The PUT /api/v1/apitoken/remote request also failed, returning a 500 error with the following message:

"message": "Index 251 out of bounds for length 65"

@jdcmsd
Copy link
Contributor

jdcmsd commented Sep 24, 2024

Good comments in that doc. I'll do a review as well as soon as I can. That said, that /remote endpoint's out-of-bounds error likely points to a value mismatch of some sort; Gavriella was getting it while using dummy values (like "expirationSeconds": "0") but it went away with appropriate values in a push-publishing enabled environment, such as this:

https://github.com/dotCMS/core/tree/master/docker/docker-compose-examples/push-publish

For example, I was able to succeed with the following data payload from the (8081) sender environment:

{
  "token": {
    "network": "0.0.0.0/0",
    "expirationSeconds": "100",
    "claims": {
      "label": "Push Publish"
    }
  },
  "remote": {
    "host": "dotcms-receiver.local",
    "port": "8082",
    "protocol": "http"
  },
  "auth": {
    "login": "[email protected]",
    "password": "YWRtaW4="
  }
}

@valentinogiardino valentinogiardino removed their assignment Sep 24, 2024
@jdcmsd jdcmsd linked a pull request Oct 4, 2024 that will close this issue
3 tasks
@jdcmsd jdcmsd assigned nollymar and valentinogiardino and unassigned jdcmsd Oct 4, 2024
@valentinogiardino valentinogiardino moved this from Next 1-3 Sprints to In Review in dotCMS - Product Planning Oct 7, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 7, 2024
This addresses everything raised in [this IQA
doc](https://docs.google.com/document/d/1_z7j9sRbIlZv-aIjj1eBlOY8TU014cTCDsej6W6MF-A/edit),
and then further issues I found while working on that initial batch. I
won't go point by point on this in the bullets below, because it's quite
a lot and I've completely lost track of them all. But I'll list the
biggest ones I can remember.

### Proposed Changes
* All concerns in document addressed
* Both forms edited
* ApiTokenForm got a couple of `@Hidden` annotations for unnecessary
props
* RemoteApiTokenForm had a bunch of variables renamed so error messages
make more sense if a key property is omitted.
* Both user-based revocation endpoints have been `@Hidden`, as neither
of them appears to work.
* (Also found another unrelated bug in the API token UI; separate issue
forthcoming. )
* EDIT: #30268 is the issue, and it
turns out not to be unrelated at all. Removing unnecessary `@Consumes`
annotations fixes it, so the current PR will resolve it. Shoutout to
@valentinogiardino for his sharp eye!
* Various text fixes
* Various schema fixes
* Various response example fixes
* Several endpoint descriptions corrected
* Various request body description and/or example fixes
* Tag adjustment



### Checklist
- [ ] Tests
- [ ] Translations
- [ ] Security Implications Contemplated (add notes if applicable)
@github-project-automation github-project-automation bot moved this from In Review to Internal QA in dotCMS - Product Planning Oct 7, 2024
@github-project-automation github-project-automation bot moved this from Internal QA to Current Sprint Backlog in dotCMS - Product Planning Oct 7, 2024
@valentinogiardino valentinogiardino moved this from Current Sprint Backlog to Internal QA in dotCMS - Product Planning Oct 7, 2024
@valentinogiardino
Copy link
Contributor

IQA PASSED

Tested on trunk_7d5223d
All inconsistencies identified in the previous IQA have been resolved.

@bryanboza
Copy link
Contributor

Fixed, tested in the last trunk and now the doc looks ok

@jdcmsd jdcmsd added the LTS: Needs Backport Ticket that will be added to LTS label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
5 participants