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

DEV-991 Rights API: Return Standard Results Structure #3

Merged
merged 9 commits into from
Dec 12, 2023

Conversation

moseshll
Copy link
Contributor

@moseshll moseshll commented Dec 4, 2023

  • Add RightsAPI::Result with basic count and pagination fields, as well as data array.
    • Not clear that result[:message] is of use here yet because we don't parse query parameters.
    • Leaving it as a placeholder for possible error messages if we want to do something beyond return 404/500.
  • Prevent clutter and repetition by introducing Schema class to account for ht_rights quirks.
    • Major redesign of query.rb as a class.
    • All tables are now treated the same as rights_* in that SELECT is invoked more directly.
    • Previously RightsDatabase methods were used to simulate datasets. (RightsDatabase will be going away.)
    • Tables have a default sort order.
  • Enable Sequel logging when running as web service.
  • Remove "usage" landing page that looked like crap in JSON and was not worth the upkeep.
  • Did not expand the tests since DEV-992 is imminent and there is enough churn as is.

- Add `RightsAPI::Result` with basic count and pagination fields, as well as `data` array.
  - Not clear that `message` is of use here yet because we don't parse query parameters (yet).
- Prevent clutter and repetition by introducing `Schema` class to account for `ht_rights` quirks.
  - Major redesign of `query.rb` as a class.
  - All tables are now treated the same as `rights_*` in that `SELECT` is invoked.
  - Previously `RightsDatabase` methods were faked up as datasets.
  - Tables have a default sort order.
- Enable Sequel logging when running as web service.
- Remove "usage" landing page that looked like crap in JSON and was not worth the upkeep.
- Did not expand the tests since DEV-992 is imminent and there is enough churn as is.
@moseshll
Copy link
Contributor Author

moseshll commented Dec 4, 2023

Note to self: update README

@moseshll moseshll marked this pull request as draft December 4, 2023 20:33
@moseshll moseshll marked this pull request as ready for review December 4, 2023 21:53
@moseshll moseshll requested a review from aelkiss December 6, 2023 16:00
Copy link
Member

@aelkiss aelkiss left a comment

Choose a reason for hiding this comment

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

Overall I think this makes sense; however, I would like to see some sense in the tests of what the expected format of the data returned is - right now for example it's not clear to me if a query to /v1/rights/:id would return the symbolic names for the attribute & value (which is what I would sort of expect from an API) or if it would return the numeric value (if it's just serializing rows directly from the database) -- I guess e.g. https://github.com/hathitrust/rights_api/blob/51cf84810a1738bc6a348615d00d895a931976e0/lib/rights_api/schema/rights_schema.rb is the abstraction on top of the database layer, and I think it would be good if that had a test

spec/rights_api_spec.rb Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
lib/rights_api/services.rb Outdated Show resolved Hide resolved
spec/rights_api_spec.rb Outdated Show resolved Hide resolved
@moseshll moseshll merged commit 0f06240 into main Dec 12, 2023
1 check passed
@moseshll moseshll deleted the DEV-991_standard_result_struct branch December 12, 2023 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants