Add swagger-restify-mw #13672

Merged
merged 3 commits into from Jan 2, 2017

Projects

None yet

3 participants

@micmro
Contributor
micmro commented Jan 2, 2017

Please fill in this template.

  • Make your PR against the master branch.
  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run tsc without errors.
  • Run npm run lint package-name if a tslint.json is present.

Select one of these and delete the others:

If adding a new definition:

  • The package does not provide its own types, and you can not add them.
  • If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
  • Create it with npm run new-package package-name, not by basing it on an existing project.

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: add explicit typings for restify (see source) and tests to swagger-node-runner.
  • Increase the version number in the header if appropriate.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "../tslint.json" }.

If removing a declaration:

  • If a package was never on DefinitelyTyped, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.)
  • Delete the package's directory.
  • Add it to notNeededPackages.json.
@dt-bot
Member
dt-bot commented Jan 2, 2017

swagger-node-runner/index.d.ts

to author (@micmro). Could you review this PR?
👍 or 👎?

Checklist

  • pass the Travis CI test?

swagger-restify-mw/index.d.ts

Checklist

@micmro
Contributor
micmro commented Jan 2, 2017

👍

+
+let app = restify.createServer();
+SwaggerNodeRunner.create(config, function(err, runner) {
+// SwaggerRestify.create(config, function(err, swaggerRestify) {
@DanielRosenwasser
DanielRosenwasser Jan 2, 2017 Collaborator

Can you remove this line?

@micmro
micmro Jan 2, 2017 Contributor

Oups - removed now.

@DanielRosenwasser
Collaborator

Is there any specific reason that the middleware needs to be exposed from swagger-node-runner rather than swagger-node-mw itself? Is it simply a convenience thing?

@micmro
Contributor
micmro commented Jan 2, 2017 edited

Yes swagger-restify-mw is just a light convenience wrapper around swagger-node-runner.
You can check the (very small) source here: https://github.com/apigee-127/swagger-restify/blob/master/lib/index.js.
Sorry read the question wrong - you mean the re-export? Yes, I thought it's more convenient. Is this an anti-pattern? I have used the same api-interface for swagger-hapi and swagger-express-mw - can change it though.

+
+ // if (swaggerRestify.runner.swagger.paths['/hello']) {
+ // console.log('try this:\ncurl http://127.0.0.1:' + port + '/hello?name=Scott');
+ // }
@DanielRosenwasser
DanielRosenwasser Jan 2, 2017 Collaborator

Can we also just get rid of this line as well since it's not being used?

@DanielRosenwasser DanielRosenwasser merged commit 7a1a842 into DefinitelyTyped:master Jan 2, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@DanielRosenwasser
Collaborator

Thanks!

@micmro micmro deleted the micmro:swagger-restify-mw branch Jan 2, 2017
@DanielRosenwasser
Collaborator
DanielRosenwasser commented Jan 2, 2017 edited

To answer your question - no I don't think re-exporting is a problem. Don't sweat it. Thanks for the PR!

@micmro
Contributor
micmro commented Jan 2, 2017

Great, thanks! And happy new year!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment