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

Feature: Last Modified Filter Parameter #249

Merged
merged 12 commits into from
Jun 28, 2024

Conversation

Jdubrick
Copy link
Contributor

Please specify the area for this PR

What does does this PR do / why we need it:
This PR adds an additional filter parameter for stacks/samples on the GET /v2index endpoint.

Changes made include:

  • Addition of last_modified.json and lastModified field to test data
  • Updated unit tests for proper filtering based on the lastModified parameter
  • Logic for creation of index.json to contain lastModified field based off of the last_modified.json created through registry build
  • Update to generator schema to reflect new field
  • Update to generator index_main.json to ensure last modified field is added correctly

Which issue(s) this PR fixes:

fixes devfile/api#1327

PR acceptance criteria:

  • Test Coverage
    • Are your changes sufficiently tested, and are any applicable test cases added or updated to cover your changes?

Documentation (WIP)

How to test changes / Special notes to the reviewer:
FYI to reviewers: The linked issue has notes for GET /index and GET /v2index. The script that generates last_modified.json that was merged here currently creates this file based on the updated Schema used in v2index where there is a Versions field that contains []Version. For the /index we would need to adjust the script to add the lastModified field to the entire stack as a whole and not just the individual stack versions.

  • Go tests should pass for index/generator and index/server
  • To test locally you can spin up the registry and perform the following:
    1. GET /v2index?lastModified=2024-04-29 to see more than 1 stack that has this date
    2. GET /v2index?lastModified=2024-04-29&name=<name> to filter even further
    3. GET /v2index/all, GET /v2index/stack GET/v2index/sample to observe the new field added in the response as well

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 24, 2024
Copy link
Contributor

@thepetk thepetk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added some comments.

Tried to test the registry viewer against the new devfile-index-base image. I've noticed that some stacks were not visible with the current index. Not sure if there'll be any impact on the current changes and the viewer:

image

index/generator/library/library.go Outdated Show resolved Hide resolved
index/generator/schema/schema.go Show resolved Hide resolved
index/generator/library/library.go Outdated Show resolved Hide resolved
index/server/pkg/server/endpoint.go Outdated Show resolved Hide resolved
@Jdubrick
Copy link
Contributor Author

I've added some comments.

Tried to test the registry viewer against the new devfile-index-base image. I've noticed that some stacks were not visible with the current index. Not sure if there'll be any impact on the current changes and the viewer:

image

Hmm that's interesting, it shouldn't be affecting the default index that is being returned at all. Are you running it with the test data? If so then it is displaying properly as far as I can tell from the screenshot: https://github.com/Jdubrick/registry-support/tree/main/tests/registry

@thepetk
Copy link
Contributor

thepetk commented Jun 25, 2024

I've added some comments.
Tried to test the registry viewer against the new devfile-index-base image. I've noticed that some stacks were not visible with the current index. Not sure if there'll be any impact on the current changes and the viewer:
image

Hmm that's interesting, it shouldn't be affecting the default index that is being returned at all. Are you running it with the test data? If so then it is displaying properly as far as I can tell from the screenshot: https://github.com/Jdubrick/registry-support/tree/main/tests/registry

Oh yes, makes sense my bad. I didn't notice your fork has less stacks :)

Jdubrick added 3 commits June 25, 2024 13:52
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
@Jdubrick Jdubrick requested a review from thepetk June 26, 2024 16:47
index/generator/library/library.go Show resolved Hide resolved
index/server/pkg/server/endpoint.go Outdated Show resolved Hide resolved
index/generator/schema/schema.go Show resolved Hide resolved
Signed-off-by: Jordan Dubrick <[email protected]>
@Jdubrick Jdubrick requested a review from thepetk June 27, 2024 14:58
Copy link
Contributor

@thepetk thepetk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm and after merging this PR I think we should create & prioritize an issue so the non-versioned stacks can also have the lastModified field with accurate data :)

Very nice feature!

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 27, 2024
Copy link

openshift-ci bot commented Jun 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Jdubrick, thepetk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Jdubrick
Copy link
Contributor Author

/lgtm and after merging this PR I think we should create & prioritize an issue so the non-versioned stacks can also have the lastModified field with accurate data :)

Very nice feature!

Thanks Fanis! FYI I opened devfile/api#1607 and will work on it once refined

@Jdubrick Jdubrick merged commit 3fec1a2 into devfile:main Jun 28, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

REST API lastModified query parameter for requesting filtered index schemas
2 participants