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

refactor to conform to json-api document standard #296

Open
elrayle opened this issue Nov 22, 2019 · 1 comment
Open

refactor to conform to json-api document standard #296

elrayle opened this issue Nov 22, 2019 · 1 comment

Comments

@elrayle
Copy link
Contributor

elrayle commented Nov 22, 2019

Description

It was suggested that QA be refactored to conform to the json-api document standard.

Rationale

Samvera community is committed to using industry standards when available.

Before and After changes

The json-api format would change the current format used for QA.

Search Results

BEFORE

[ { id: 1, label: "example title" } ]

AFTER

{
  data: [ { id: 1, label: "example title" } ]
}

For linked data module with optional performance data and header response

BEFORE

{ 
  performance_data: { ... }
  response_header: {
    start_record: 31          # the number of the first record returned
    requested_records: 10     # the number of records requested (aka page size)
    retrieved_records: 10     # the actual number of records returned in this request
    total_records: 85         # the total number of matches for this search request
  }
  results: [ { uri: "http://example.com/1", id: 1, label: "example title" } ]
}

AFTER

{ 
  meta: { performance_data: { ... } }
  links: { 
    pagination: {
      first: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=21&page[limit]=10
      last: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=81&page[limit]=10
      prev: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=11&page[limit]=10
      next: https://example.app.com/qa/search/linked_data/agrovoc_ld4l_cache?q=milk&page[offset]=31&page[limit]=10
    }
  }
  data: [ { uri: "http://example.com/1", id: 1, label: "example title" } ]
}

Missing from this is the total count of records. More exploration is required to determine the best location to include this information.

Fetch/Show results

BEFORE

# results for a single term -- format varies by authority

AFTER

{
  data: # results for a single term -- format varies by authority
}
@jrochkind
Copy link
Contributor

This would be a backwards-incompat change for current users of qa.

Maybe a transition period, where the current responses are still available at the current paths, backwards-compatibly, but there's another path where the json-api responses could be retrieved from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Status: Backlog
Development

No branches or pull requests

2 participants