Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Convert to new URL scheme. #73

Merged
merged 1 commit into from Feb 18, 2015
Merged

Convert to new URL scheme. #73

merged 1 commit into from Feb 18, 2015

Conversation

yupinghu
Copy link
Contributor

Closes #59.

@yupinghu
Copy link
Contributor Author

This is only the first version. At minimum, the docs and examples need to be fixed to match the new url scheme. Also, I want to add some query string validation.

}
var errorString = 'Invalid realtime action: ' + req.params.action;
req.log.error(errorString);
return next(new restify.InternalError(errorString));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a BadRequestError(400) might be more appropriate here.

// `/request` handles request/response services. There is one operation on these services, namely
// "get me some data". In some sense this ought to be a GET but because the request data is fairly
// large we use a POST.
server.post('/request',
requestHandler.onRequest);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Since this can be joined with the previous line, I would join them together. However, I understand why it it is aligned on its own line because of the statements that follow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's why I left it, but now that I've added comments, I think this doesn't need to align with the following section, so I'll join 'em.

@@ -191,11 +192,23 @@ export function onRequest(req: Interface.IOurRequest,
return next(new restify.InternalError('Error not find blpSession.'));
}

// Validate the query parameters
Copy link
Contributor

Choose a reason for hiding this comment

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

I will advocate moving these checks into an util middleware

@yupinghu
Copy link
Contributor Author

I rebased from bloomberg/develop to pick up more examples before fixing the examples, so that's why the whole "added some commits" thing happened.

@@ -0,0 +1,24 @@
// Type definitions for adding validator to restify
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should put this typing file alongside with the express-validator since it is not a restify-validator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main thing is that I want it to be a separate file (so that we can grab updates to express-validator.d.ts without thinking too hard), but if what you're suggesting is to put it in the same directory, I'm ok with that. Suggestions for names? express-to-restify-validator? :)

@ericvw
Copy link
Contributor

ericvw commented Feb 17, 2015

lgtm - please squash and ensure that the commit has an appropriate summary line and body message that describes at a high-level the changes being landed. Thanks!

requestHandler.onSubscribe);
server.post('/unsubscribe',

// `/realtime` handles subscription services. There are two things you can do with subscriptions:
Copy link
Contributor

Choose a reason for hiding this comment

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

s/realtime/subscription

The paths now reflect the operation type (i.e.
request/response or subscription), and any additional info
is in the query params or body.

Details of how the URLs changed:

- Subscribe, unsubscribe, and poll are now one path, and
  we distinguish between them based on POST vs. GET and
  query params.
- Requests use query params rather than having everything
  in the path.
- /request query params now match the BLPAPI values exactly
  rather than omitting the "Request" at the end of the type.

This change also adds a request validator that is used for
the new query params, but which also can be used for any
future additions to what's in the request.

Closes #59.
@yupinghu
Copy link
Contributor Author

Amended yet again! :)

@ericvw
Copy link
Contributor

ericvw commented Feb 18, 2015

lgtm. @ericlu88?

@ericlu88
Copy link
Contributor

LGTM. I will merge.

ericlu88 added a commit that referenced this pull request Feb 18, 2015
@ericlu88 ericlu88 merged commit 71dbb85 into bloomberg:develop Feb 18, 2015
@yupinghu yupinghu deleted the urlscheme branch February 18, 2015 01:25
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.

Lock-in URL scheme for the HTTP API
3 participants