Versions API - Add `details` key to API
What / Why
The details
key was added to the Versions record quite a bit ago: https://gitlab.com/gitlab-services/version-gitlab-com/-/merge_requests/689 but wasn't added to the Versions API. This change simply adds the field to the entity and valid params of the API.
Video Demo
Creating Versions | Edit/Deleting Versions |
---|---|
Creating_Records | Editing_Records |
How to Test
Important: To test there is a bit of preliminary setup you will need to do. I visualize this in the video demo above
- Have a way to send POST requests with a JSON body. I used Postman w/ Postman Desktop Agent to fire
localhost
requests. - A
private_token
to pass in the query of the request (this is likely not how we should do this in production, but works for verifying the API locally)- I used the Rails Console (
rails c
) and then this methodUser.first.private_token
- I used the Rails Console (
Testing
- Follow all the important setup steps above
- Get your private token
User.first.private_token
- Send a HTTP POST with the following information
path: localhost:3000/api/v1/versions
query_param: ?private_token=PRIVATE_TOKEN
body: { "version": "8.0.0", "security_release_type": "not_vulnerable", "details": "Testing" }
- Check UI and ensure version was created correctly
- Grab the ID of the version
- Send a HTTP PUT with the following information (note the different key
vulnerability_type
)path: localhost:3000/api/v1/versions/ID
query_param: ?private_token=PRIVATE_TOKEN
body: { "vulnerability_type": "non_critical", "details": "Testing UPDATE" }
- Check UI and ensure version was updated correctly
- Send a HTTP DELETE with the following information
path: localhost:3000/api/v1/versions/ID
query_param: ?private_token=PRIVATE_TOKEN
- Ensure version is properly deleted