Skip to content
This repository has been archived by the owner on Dec 22, 2022. It is now read-only.

Pds api 110: unify the behavior of response building #80

Merged
merged 11 commits into from
Nov 18, 2021
Merged

Conversation

al-niessner
Copy link
Contributor

@al-niessner al-niessner commented Nov 1, 2021

🗒️ Summary

Brief summary of changes if not sufficiently described by commit messages.

⚙️ Test Data and/or Report

One of the following should be included here:

  • Reference to regression test included in code (preferred wherever reasonable)
  • Attach test data here + outputs of tests

♻️ Related Issues

Al Niessner added 5 commits October 14, 2021 09:24
Basically scrapped what was there and reqbuilt it all using a visitor pattern that will hopefully consolidate changes that fix all endpoints instead of so much cut-n-past. There is still a lot of boilerplate thata may be able to be worked out with more effort.
@al-niessner al-niessner requested a review from a team as a code owner November 1, 2021 22:17
@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl @jordanpadams @tdddblog

Its finally in place. Needs testing which I will get to Wednesday probably. Let me know if you want to review it in the breakout tomorrow.

Al Niessner added 3 commits November 4, 2021 16:04
Had to add "accept: application/json to the verify scripts. This moved them formward but have some odd results like the query language changed without updating the test. Other items are still failing and will need to track them down one by one but the problems are no longer in the verify scripts.

Added some missed functinality in the product handler.

Cleaned up some logic in the RequestAndResponseContext that does the bulk of the work for mixing and matching the various application type requests. Added a new error to account for when valid information was given (lidvid) but nothing was found despite that.
The looking up a lidvid from lid required a touch more fine tuning to verify that it found the whole lidvid matches the given to accound for partial lidvids that are more than a lid but less than a full lidvid.

Had to also clean up a List<String>.toArray() that was causing a segfault. Turning a list to [] syntax is not so easy to understand.
@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl @tdddblog @jordanpadams

All the tests, not query language related, work now. You can get either PDS-4 (pds4+json) format or our favorite format (json). You can add new output styles simply by adding to the table RequestAndResponseContext.formatters.

The work of making the product and adding them all to the endpoints. THe work of adding a serializer is a touch more complicated.
Copy link
Member

@tloubrieu-jpl tloubrieu-jpl left a comment

Choose a reason for hiding this comment

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

Hi @al-niessner ,

I am getting null pointer exception with the following requests:

curl --location --request GET 'http://localhost:8080/collections?limit=10'
--header 'Accept: application/json'

and

curl --location --request GET 'http://localhost:8080/products?only-summary=True'
--header 'Accept: application/json'

I am using pds-api-javalib branch swaggerhub-pds_federated_api-pds-api-110-4

Copy link
Member

@jordanpadams jordanpadams left a comment

Choose a reason for hiding this comment

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

@al-niessner in the API spec, shouldn't this:

        application/csv+text:
           schema:
            $ref: '#/components/schemas/wyriwygProduct'

be this?

        text/csv:
           schema:
            $ref: '#/components/schemas/wyriwygProduct'

also I'm guessing wyriwygProduct is just a placeholder for those other inwork response formats?

@al-niessner
Copy link
Contributor Author

al-niessner commented Nov 12, 2021 via email

@al-niessner
Copy link
Contributor Author

al-niessner commented Nov 12, 2021 via email

@tloubrieu-jpl
Copy link
Member

Hi @al-niessner , do you use a specific branch for the csv development ? If not you should branch off of this branch pds-api-110 to create a new branch for the CSV development so that this pds-api-110 stays stable for the tests.

Thanks

@al-niessner
Copy link
Contributor Author

al-niessner commented Nov 12, 2021 via email

@al-niessner
Copy link
Contributor Author

Hi @al-niessner ,

I am getting null pointer exception with the following requests:

curl --location --request GET 'http://localhost:8080/collections?limit=10' --header 'Accept: application/json'

and

curl --location --request GET 'http://localhost:8080/products?only-summary=True' --header 'Accept: application/json'

I am using pds-api-javalib branch swaggerhub-pds_federated_api-pds-api-110-4

@tloubrieu-jpl

This is not due to my changes. The input coming in from the curl makes q null. The search request builder is unmodified so the problem may be inherited from the main branch.

First, I added these two log lines:

        	log.debug("the input query string: " + String.valueOf(q));
        	log.debug("the context query string: " + String.valueOf(context.getQueryString()));

and produce this result:

2021-11-15 18:32:23.258 DEBUG 54 --- [0.3-8080-exec-1] g.n.p.a.e.c.MyProductsApiBareController  : the input query string: null
2021-11-15 18:32:23.258 DEBUG 54 --- [0.3-8080-exec-1] g.n.p.a.e.c.MyProductsApiBareController  : the context query string: null

Second, I went back to the main branch to test it. It works fine because somewhere it is translating the null to "". Going to update for that and see if it works.

@tloubrieu-jpl
Copy link
Member

Thanks @al-niessner

The blank query had to use the preset which got lost. Also put the conversion of the names back in place.
@al-niessner
Copy link
Contributor Author

@tloubrieu-jpl

Fixed up the curl. Please try again or continue with review.

Accidentally made it so only the minimal set was returned if fields are left blank. Added a min/max list of fields where min must be a subset of max and empty is a full set without having to define all that may be in elastic search. This min/max approach fixes the blank fields and adds constraints so that pds+ formats will only  every reeturn the allowable keys and nothing else. These are simple to change in the future as well by modifying just the min/max arrays.
Copy link
Member

@tloubrieu-jpl tloubrieu-jpl left a comment

Choose a reason for hiding this comment

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

Good to go, no much time to look at the details but that worked with my tests

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants