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

Small cleanups #64

Merged
merged 5 commits into from
Feb 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@
object-curly-spacing: [2, "never"]
quotes: [2, "single", "avoid-escape"]
radix: 2
space-after-keywords: [2, "always"]
keyword-spacing: [2, {"after": true}]
space-before-blocks: [2, "always"]
space-before-function-paren: [2, "always"]
space-in-parens: [2, "never"]
spaced-comment: [2, "always"]
strict: [2, "global"]
valid-jsdoc: [2, {"requireReturn": false, "prefer": {"return": "returns"}}]
wrap-iife: 2

globals:
Promise: true
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ npm install sway --save

## Documentation

The documentation for this project can be found here: https://github.com/apigee-127/sway/blob/master/docs/README.md
Of course, if you just want a quick link to the API documentation, that would be here: https://github.com/apigee-127/sway/blob/master/docs/API.md
The documentation for this project can be found here: [/docs/README](/docs/README.md)

Of course, if you just want a quick link to the API documentation, that would be here:[/docs/API.md](/docs/API.md)

## Contributing

Expand Down
7 changes: 0 additions & 7 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ var mocker = require('json-schema-faker');
var ZSchema = require('z-schema');

var collectionFormats = [undefined, 'csv', 'multi', 'pipes', 'ssv', 'tsv'];
var draft04Json = require('./validation/json-schema-draft-04.json');
var draft04Url = 'http://json-schema.org/draft-04/schema';
var jsonMocker = createJSONMocker();
var jsonSchemaValidator = createJSONValidator();
// https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#parameter-object
Expand Down Expand Up @@ -80,9 +78,6 @@ function createJSONValidator () {
reportPathAsArray: true
});

// Add the draft-04 spec
validator.setRemoteReference(draft04Url, draft04Json);

// Add the custom validators
_.each(formatValidators, function (handler, name) {
ZSchema.registerFormat(name, handler);
Expand Down Expand Up @@ -356,8 +351,6 @@ module.exports.removeCirculars = function (obj) {
walk([], obj, []);
}

module.exports.supportedHttpMethods = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'];

/**
* Validates the provided value against the JSON Schema by name or value.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/types/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
'use strict';

var _ = require('lodash');
var helpers = require('../helpers');
var JsonRefs = require('json-refs');
var Operation = require('./operation');
var Parameter = require('./parameter');
var pathToRegexp = require('path-to-regexp');
var supportedHttpMethods = require('swagger-methods');

/**
* The Path object.
Expand Down Expand Up @@ -100,7 +100,7 @@ function Path (api, path, definition, definitionFullyResolved, pathToDefinition)
this.operationObjects = _.reduce(definitionFullyResolved, function (operations, operationDef, method) {
var oPath = pathToDefinition.concat(method);

if (helpers.supportedHttpMethods.indexOf(method) > -1) {
if (supportedHttpMethods.indexOf(method) > -1) {
operations.push(new Operation(that, method, _.get(api.definitionRemotesResolved, oPath), operationDef, oPath));
}

Expand Down
150 changes: 0 additions & 150 deletions lib/validation/json-schema-draft-04.json

This file was deleted.

Loading