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

Add support for multi-get #42

Closed
alexanderdean opened this issue Jul 16, 2014 · 13 comments
Closed

Add support for multi-get #42

alexanderdean opened this issue Jul 16, 2014 · 13 comments
Assignees
Labels
Milestone

Comments

@alexanderdean
Copy link
Member

This is an interesting one.

There are Iglu users who want to fetch schemas from Iglu in the browser. In the absence of an iglu-javascript-client, they are handrolling this support for now.

Their requirement on Iglu server is an interesting one: they will not be allowed to do multiple AJAX requests, one per schema, so instead would like a multi-get. This is where we would come up with a syntax for requesting multiple schemas at a time, and then the response would likely be something like this:

[
  {
    "key": "iglu:xxx/xxx/xxx/xxx",
    "schema": { ... }
  },
  {
    "key": "iglu:xxx/xxx/xxx/xxx",
    "schema": { ... }
  },
  ...
]

Then the Iglu user can cache all of those schemas in LocalStorage.

@BenFradet:

  • Do these requirements make sense to you?
  • Any ideas on the syntax for the multi-GET request?
  • Any changes/suggestions on the syntax for the multi-GET response?
  • Shall we treat this as a separate feature or related to the catalog functionality you are working on?
@alexanderdean
Copy link
Member Author

One suggestion is to treat this as part of the catalog, and with the catalog you have the option of just returning keys, or returning keys and bodies. Make sense Ben? Good idea?

@BenFradet
Copy link
Contributor

Imo, this is a normal evolution of the api and I had given some thought to it.

In my mind the url format would be comma-separated like so:

  • vendor/name1,name2/format/version
  • vendor/name/format1,format2/version
  • vendor/name/format/version1,version2

This is the format used by the api I wrote a wrapper for, so this seems to be pretty standard.

Consequently, this would be a bit different from the catalog, but the on/off switch for getting the whole thing or just the keys is a good idea as well.

@alexanderdean
Copy link
Member Author

Makes sense Ben. Just to confirm, would we support completely orthogonal schemas too:

  • vendor1/name1/format1/version1,vendor2/name2/format2/version2

This would seem to be a requirement

@BenFradet
Copy link
Contributor

This would be doable but this seems to be a bit convoluted.
I think there are two things to keep in mind: adding features and our api "neatness".
Then it just depends which route we take.

Then again maybe there is better approach url-wise to this feature but I can't think of one right now.

@alexanderdean
Copy link
Member Author

Hmm yeah. Actually my suggestion wouldn't work with the comma syntax, we would need another character to indicate a list versus a tree:

  • vendor1/name1/format1/version1;vendor2/name2/format2/version2;...
  • vendor1,vendor2/name/format/version

Separately, this would be a powerful thing to support:

  • vendor/name/format/partial-version

e.g.

  • com.acme/click/jsonschema/1-
  • com.acme/click/jsonschema/1-10-
  • com.acme/click/jsonschema/1-10-1

Not sure about the trailing hyphens

@BenFradet BenFradet added this to the Version 0.3.0 milestone Jul 17, 2014
@BenFradet
Copy link
Contributor

This is mostly done.
Now you're able to query like so:

/api/schemas/vendor/name1,name2/format/version
/api/schemas/vendor/name/format1,format2/version
/api/schemas/vendor/name/format/version1,version2

Or in a catalog way:

/api/schemas/vendor/name1,name2
/api/schemas/vendor/name/format1,format2

The combination of everything is also supported:

/api/schemas/vendor/name1,name2/format1,format2/version1,version2

The following cases still need to be supported:

  • /api/schemas/vendor1/name1/format1/version1;vendor2/name2/format2/version2
  • /api/schemas/vendor/name/format/partialVersion

@alexanderdean
Copy link
Member Author

Great work Ben!

@BenFradet
Copy link
Contributor

One thing I was wondering about regarding multi get for vendor like this one:

/api/schemas/vendor1,vendor2

If the owner making the request doesn't own one of those vendors do we send back a 401 or only the schemas he does own?

@BenFradet
Copy link
Contributor

Added support for vendor-based multi get like:

/api/schemas/vendor1,vendor2

and

/api/schemas/vendor1,vendor2/name/format/version

I chose to send back a 401 if you do not own every vendor requested for now.

@alexanderdean
Copy link
Member Author

Agree, I think a failure "outranks" a success, and so a 401 should be returned.

@BenFradet
Copy link
Contributor

Multi get for full paths are now supported:

/api/schemas/vendor1/name1/format1/version1,vendor2/name2/format2/version2

Regarding multi get for partial version like:

/api/schemas/vendor/name/format/1-0

I dont have a clean way of doing it yet.

@BenFradet
Copy link
Contributor

#57 spin off for partial version multi get.

@BenFradet BenFradet added the done label Aug 15, 2014
@BenFradet BenFradet modified the milestones: Release 3, Release 2 Aug 19, 2014
@BenFradet
Copy link
Contributor

Done in r2, closing.

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

No branches or pull requests

2 participants