Skip to content

Commit

Permalink
Merge pull request Azure#25 from pareshverma91/ChangingRemoteReferenc…
Browse files Browse the repository at this point in the history
…eToLocal

Using local JsonSchemaDraft4 specification in test.
  • Loading branch information
arthurwms authored Nov 22, 2016
2 parents 3592e4c + 5fe1b35 commit 1b56a05
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ util = require('util');
var extensionSwaggerSchemaUrl = "https://raw.githubusercontent.com/Azure/autorest/master/schema/swagger-extensions.json";
var swaggerSchemaUrl = "http://json.schemastore.org/swagger-2.0";
var swaggerSchemaAltUrl = "http://swagger.io/v2/schema.json";
var schemaUrl = "http://json-schema.org/draft-04/schema";
// z-schema package has the JsonSchemaDraftV4 specification and uses it if a remote resolver for draftv4 url is not provided.
var swaggerSchema;
var extensionSwaggerSchema;
var schema4;

var globPath = path.join(__dirname, '../', '/**/swagger/*.json');
var swaggers = _(glob.sync(globPath));
Expand All @@ -35,12 +34,9 @@ describe('Azure Swagger Schema Validation', function() {
before(function(done) {
request({url: extensionSwaggerSchemaUrl, json:true}, function (error, response, extensionSwaggerSchemaBody) {
request({url: swaggerSchemaAltUrl, json:true}, function (error, response, swaggerSchemaBody) {
request({url: schemaUrl, json:true}, function (error, response, schemaBody) {
extensionSwaggerSchema = extensionSwaggerSchemaBody;
swaggerSchema = swaggerSchemaBody;
schema4 = schemaBody;
done();
});
extensionSwaggerSchema = extensionSwaggerSchemaBody;
swaggerSchema = swaggerSchemaBody;
done();
});
});
});
Expand All @@ -56,7 +52,6 @@ describe('Azure Swagger Schema Validation', function() {
done();
}
var validator = new z();
validator.setRemoteReference(schemaUrl, schema4);
validator.setRemoteReference(swaggerSchemaUrl, swaggerSchema);
var valid = validator.validate(JSON.parse(stripBOM(data)), extensionSwaggerSchema);
if (!valid) {
Expand Down

0 comments on commit 1b56a05

Please sign in to comment.