-
Notifications
You must be signed in to change notification settings - Fork 3
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
As a n00b paginator, there might be an off-by-1 error in the limit
parameter
#73
As a n00b paginator, there might be an off-by-1 error in the limit
parameter
#73
Comments
@tloubrieu-jpl What is the trick to match an endpoint in the registry code? Looking entry point(s) for the two given examples. No log messages present a crumb trail which has been my method so far. |
Hi @al-niessner that is a bit intricate indeed. Each of the controller (e.g. MyBundleApiController) implemented an interface (BundleApi). The interface is generated by the swagger definition of the API and defines the method <-> api end-point relationships. The easiest way to get this information is to Command-click in Eclipse, on macos (go to the declaration of the interface, for example BundleAPI, not sure how it goes on Linux). Although the source are not attached to the project, the interface prototype information is displayed, for example: ''' The bold part gives you the method <--> api end-point relationship. Feel free to add the logs in the implementation, that looks like a good practice to me. Eventually, we will make the logs consistent so that they can be used to make stats on the usage of the API so this is something we will need not only to make developers more comfortable. Thanks |
Couple of items:
|
Hi Al,
For the bundlesApi object you will be able to generate the source from this repo https://github.com/NASA-PDS/pds-api-javalib
The readme says how to generate the source. You don’t need to do the deploy part.
mvn clean install
The source will be target/generated-sources.
I need to work on having the sources preserved for stable version. The standard ci/cd process of PDS should do it I just need to make that work on this repository. However the source you will generate are up to date with what you use in registry-api-service.
Thanks,
Thomas
From: al-niessner ***@***.***>
Reply-To: NASA-PDS/pds-api ***@***.***>
Date: Thursday, April 29, 2021 at 12:55 PM
To: NASA-PDS/pds-api ***@***.***>
Cc: "Loubrieu, Thomas G (US 398F)" ***@***.***>, Mention ***@***.***>
Subject: [EXTERNAL] Re: [NASA-PDS/pds-api] As a n00b paginator, there might be an off-by-1 error in the `limit` parameter (#73)
@tloubrieu-jpl<https://urldefense.us/v3/__https:/github.com/tloubrieu-jpl__;!!PvBDto6Hs4WbVuu7!dUsrWUgWMSPe1wIFQzF-jJYxJgSvvxVYdCMBVEqppV7lM4gTPjsCuVQXRn1mTll0e3Q9R6mcGBc$>
Couple of items:
1. Where do I find the source for BundlesApi? When I open it in Eclipse no source is found.
2. I added log messages to all methods in MyBundlesApiController and no output. Deleted target and did a mvn clean install. Still no messages. When try wildcard it works just find and get all logging including changes to check that updates are coming through.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://urldefense.us/v3/__https:/github.com/NASA-PDS/pds-api/issues/73*issuecomment-829554040__;Iw!!PvBDto6Hs4WbVuu7!dUsrWUgWMSPe1wIFQzF-jJYxJgSvvxVYdCMBVEqppV7lM4gTPjsCuVQXRn1mTll0e3Q9G-WbzVI$>, or unsubscribe<https://urldefense.us/v3/__https:/github.com/notifications/unsubscribe-auth/AORLCUEDE7RQ4CRT7HTEITLTLG2RZANCNFSM4273YTNA__;!!PvBDto6Hs4WbVuu7!dUsrWUgWMSPe1wIFQzF-jJYxJgSvvxVYdCMBVEqppV7lM4gTPjsCuVQXRn1mTll0e3Q91-LUA2U$>.
|
🐛 Describe the bug
The API at https://pds-gamma.jpl.nasa.gov/api/ has pagination features that include a start index and a limit described as "maximum number of matching results returned, for pagination". This is also reflected in the Swagger definition and the draft specification document.
For the
/collections/{lidvid}/products
endpoint, this is the case. But for the/bundles/{lidvid}/collections
it returns 1 more than the limit.📜 To Reproduce
Run
curl --silent --header 'Accept: application/json' 'https://pds-gamma.jpl.nasa.gov/api/collections/urn%3Anasa%3Apds%3Ainsight_documents%3Adocument_hp3rad%3A%3A8.0/products?start=0&limit=0&fields=ops%3AData_File_Info.ops%3Amd5_checksum&only-summary=false' | json_pp
and note that the limit is 0 and 0 results are returned indata
✅.limit=1
gives 1,limit=2
gives 2.But compare that with
curl --silent --header 'Accept: application/json' 'https://pds-gamma.jpl.nasa.gov/api/bundles/urn%3Anasa%3Apds%3Ainsight_documents%3A%3A2.0/collections?start=0&limit=0&fields=ops%3AData_File_Info.ops%3Amd5_checksum&only-summary=false' | json_pp
and note that the limit is 0 but 1 result is thedata
is returned ❌.limit=1
gives 2,limit=2
gives 3, etc.limit=-1
gives 0!🕵️ Expected behavior
Consistency in
limit
between endpoints.📚 Version of Software Used
[ base url: /api/ , api version: 0.0.1 ]
🖥 System Info
** 🦄 Applicable requirements**
The text was updated successfully, but these errors were encountered: