mirror of
https://github.com/actions/setup-java.git
synced 2025-04-20 09:56:46 +00:00
Fix.
This commit is contained in:
parent
596a6da241
commit
c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions
6
node_modules/json-schema-traverse/spec/.eslintrc.yml
generated
vendored
Normal file
6
node_modules/json-schema-traverse/spec/.eslintrc.yml
generated
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
parserOptions:
|
||||
ecmaVersion: 6
|
||||
globals:
|
||||
beforeEach: false
|
||||
describe: false
|
||||
it: false
|
125
node_modules/json-schema-traverse/spec/fixtures/schema.js
generated
vendored
Normal file
125
node_modules/json-schema-traverse/spec/fixtures/schema.js
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
|||
'use strict';
|
||||
|
||||
var schema = {
|
||||
additionalItems: subschema('additionalItems'),
|
||||
items: subschema('items'),
|
||||
contains: subschema('contains'),
|
||||
additionalProperties: subschema('additionalProperties'),
|
||||
propertyNames: subschema('propertyNames'),
|
||||
not: subschema('not'),
|
||||
allOf: [
|
||||
subschema('allOf_0'),
|
||||
subschema('allOf_1'),
|
||||
{
|
||||
items: [
|
||||
subschema('items_0'),
|
||||
subschema('items_1'),
|
||||
]
|
||||
}
|
||||
],
|
||||
anyOf: [
|
||||
subschema('anyOf_0'),
|
||||
subschema('anyOf_1'),
|
||||
],
|
||||
oneOf: [
|
||||
subschema('oneOf_0'),
|
||||
subschema('oneOf_1'),
|
||||
],
|
||||
definitions: {
|
||||
foo: subschema('definitions_foo'),
|
||||
bar: subschema('definitions_bar'),
|
||||
},
|
||||
properties: {
|
||||
foo: subschema('properties_foo'),
|
||||
bar: subschema('properties_bar'),
|
||||
},
|
||||
patternProperties: {
|
||||
foo: subschema('patternProperties_foo'),
|
||||
bar: subschema('patternProperties_bar'),
|
||||
},
|
||||
dependencies: {
|
||||
foo: subschema('dependencies_foo'),
|
||||
bar: subschema('dependencies_bar'),
|
||||
},
|
||||
required: ['foo', 'bar']
|
||||
};
|
||||
|
||||
|
||||
function subschema(keyword) {
|
||||
var sch = {
|
||||
properties: {},
|
||||
additionalProperties: false,
|
||||
additionalItems: false,
|
||||
anyOf: [
|
||||
{format: 'email'},
|
||||
{format: 'hostname'}
|
||||
]
|
||||
};
|
||||
sch.properties['foo_' + keyword] = {title: 'foo'};
|
||||
sch.properties['bar_' + keyword] = {title: 'bar'};
|
||||
return sch;
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
schema: schema,
|
||||
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
expectedCalls: [[schema, '', schema, undefined, undefined, undefined, undefined]]
|
||||
.concat(expectedCalls('additionalItems'))
|
||||
.concat(expectedCalls('items'))
|
||||
.concat(expectedCalls('contains'))
|
||||
.concat(expectedCalls('additionalProperties'))
|
||||
.concat(expectedCalls('propertyNames'))
|
||||
.concat(expectedCalls('not'))
|
||||
.concat(expectedCallsChild('allOf', 0))
|
||||
.concat(expectedCallsChild('allOf', 1))
|
||||
.concat([
|
||||
[schema.allOf[2], '/allOf/2', schema, '', 'allOf', schema, 2],
|
||||
[schema.allOf[2].items[0], '/allOf/2/items/0', schema, '/allOf/2', 'items', schema.allOf[2], 0],
|
||||
[schema.allOf[2].items[0].properties.foo_items_0, '/allOf/2/items/0/properties/foo_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'foo_items_0'],
|
||||
[schema.allOf[2].items[0].properties.bar_items_0, '/allOf/2/items/0/properties/bar_items_0', schema, '/allOf/2/items/0', 'properties', schema.allOf[2].items[0], 'bar_items_0'],
|
||||
[schema.allOf[2].items[0].anyOf[0], '/allOf/2/items/0/anyOf/0', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 0],
|
||||
[schema.allOf[2].items[0].anyOf[1], '/allOf/2/items/0/anyOf/1', schema, '/allOf/2/items/0', 'anyOf', schema.allOf[2].items[0], 1],
|
||||
|
||||
[schema.allOf[2].items[1], '/allOf/2/items/1', schema, '/allOf/2', 'items', schema.allOf[2], 1],
|
||||
[schema.allOf[2].items[1].properties.foo_items_1, '/allOf/2/items/1/properties/foo_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'foo_items_1'],
|
||||
[schema.allOf[2].items[1].properties.bar_items_1, '/allOf/2/items/1/properties/bar_items_1', schema, '/allOf/2/items/1', 'properties', schema.allOf[2].items[1], 'bar_items_1'],
|
||||
[schema.allOf[2].items[1].anyOf[0], '/allOf/2/items/1/anyOf/0', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 0],
|
||||
[schema.allOf[2].items[1].anyOf[1], '/allOf/2/items/1/anyOf/1', schema, '/allOf/2/items/1', 'anyOf', schema.allOf[2].items[1], 1]
|
||||
])
|
||||
.concat(expectedCallsChild('anyOf', 0))
|
||||
.concat(expectedCallsChild('anyOf', 1))
|
||||
.concat(expectedCallsChild('oneOf', 0))
|
||||
.concat(expectedCallsChild('oneOf', 1))
|
||||
.concat(expectedCallsChild('definitions', 'foo'))
|
||||
.concat(expectedCallsChild('definitions', 'bar'))
|
||||
.concat(expectedCallsChild('properties', 'foo'))
|
||||
.concat(expectedCallsChild('properties', 'bar'))
|
||||
.concat(expectedCallsChild('patternProperties', 'foo'))
|
||||
.concat(expectedCallsChild('patternProperties', 'bar'))
|
||||
.concat(expectedCallsChild('dependencies', 'foo'))
|
||||
.concat(expectedCallsChild('dependencies', 'bar'))
|
||||
};
|
||||
|
||||
|
||||
function expectedCalls(keyword) {
|
||||
return [
|
||||
[schema[keyword], `/${keyword}`, schema, '', keyword, schema, undefined],
|
||||
[schema[keyword].properties[`foo_${keyword}`], `/${keyword}/properties/foo_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `foo_${keyword}`],
|
||||
[schema[keyword].properties[`bar_${keyword}`], `/${keyword}/properties/bar_${keyword}`, schema, `/${keyword}`, 'properties', schema[keyword], `bar_${keyword}`],
|
||||
[schema[keyword].anyOf[0], `/${keyword}/anyOf/0`, schema, `/${keyword}`, 'anyOf', schema[keyword], 0],
|
||||
[schema[keyword].anyOf[1], `/${keyword}/anyOf/1`, schema, `/${keyword}`, 'anyOf', schema[keyword], 1]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function expectedCallsChild(keyword, i) {
|
||||
return [
|
||||
[schema[keyword][i], `/${keyword}/${i}`, schema, '', keyword, schema, i],
|
||||
[schema[keyword][i].properties[`foo_${keyword}_${i}`], `/${keyword}/${i}/properties/foo_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `foo_${keyword}_${i}`],
|
||||
[schema[keyword][i].properties[`bar_${keyword}_${i}`], `/${keyword}/${i}/properties/bar_${keyword}_${i}`, schema, `/${keyword}/${i}`, 'properties', schema[keyword][i], `bar_${keyword}_${i}`],
|
||||
[schema[keyword][i].anyOf[0], `/${keyword}/${i}/anyOf/0`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 0],
|
||||
[schema[keyword][i].anyOf[1], `/${keyword}/${i}/anyOf/1`, schema, `/${keyword}/${i}`, 'anyOf', schema[keyword][i], 1]
|
||||
];
|
||||
}
|
171
node_modules/json-schema-traverse/spec/index.spec.js
generated
vendored
Normal file
171
node_modules/json-schema-traverse/spec/index.spec.js
generated
vendored
Normal file
|
@ -0,0 +1,171 @@
|
|||
'use strict';
|
||||
|
||||
var traverse = require('../index');
|
||||
var assert = require('assert');
|
||||
|
||||
describe('json-schema-traverse', function() {
|
||||
var calls;
|
||||
|
||||
beforeEach(function() {
|
||||
calls = [];
|
||||
});
|
||||
|
||||
it('should traverse all keywords containing schemas recursively', function() {
|
||||
var schema = require('./fixtures/schema').schema;
|
||||
var expectedCalls = require('./fixtures/schema').expectedCalls;
|
||||
|
||||
traverse(schema, {cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
describe('Legacy v0.3.1 API', function() {
|
||||
it('should traverse all keywords containing schemas recursively', function() {
|
||||
var schema = require('./fixtures/schema').schema;
|
||||
var expectedCalls = require('./fixtures/schema').expectedCalls;
|
||||
|
||||
traverse(schema, callback);
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
it('should work when an options object is provided', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var schema = require('./fixtures/schema').schema;
|
||||
var expectedCalls = require('./fixtures/schema').expectedCalls;
|
||||
|
||||
traverse(schema, {}, callback);
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('allKeys option', function() {
|
||||
var schema = {
|
||||
someObject: {
|
||||
minimum: 1,
|
||||
maximum: 2
|
||||
}
|
||||
};
|
||||
|
||||
it('should traverse objects with allKeys: true option', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
[schema.someObject, '/someObject', schema, '', 'someObject', schema, undefined]
|
||||
];
|
||||
|
||||
traverse(schema, {allKeys: true, cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
|
||||
it('should NOT traverse objects with allKeys: false option', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema, '', schema, undefined, undefined, undefined, undefined]
|
||||
];
|
||||
|
||||
traverse(schema, {allKeys: false, cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
|
||||
it('should NOT traverse objects without allKeys option', function() {
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema, '', schema, undefined, undefined, undefined, undefined]
|
||||
];
|
||||
|
||||
traverse(schema, {cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
|
||||
it('should NOT travers objects in standard keywords which value is not a schema', function() {
|
||||
var schema2 = {
|
||||
const: {foo: 'bar'},
|
||||
enum: ['a', 'b'],
|
||||
required: ['foo'],
|
||||
another: {
|
||||
|
||||
},
|
||||
patternProperties: {}, // will not traverse - no properties
|
||||
dependencies: true, // will not traverse - invalid
|
||||
properties: {
|
||||
smaller: {
|
||||
type: 'number'
|
||||
},
|
||||
larger: {
|
||||
type: 'number',
|
||||
minimum: {$data: '1/smaller'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
|
||||
var expectedCalls = [
|
||||
[schema2, '', schema2, undefined, undefined, undefined, undefined],
|
||||
[schema2.another, '/another', schema2, '', 'another', schema2, undefined],
|
||||
[schema2.properties.smaller, '/properties/smaller', schema2, '', 'properties', schema2, 'smaller'],
|
||||
[schema2.properties.larger, '/properties/larger', schema2, '', 'properties', schema2, 'larger'],
|
||||
];
|
||||
|
||||
traverse(schema2, {allKeys: true, cb: callback});
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
});
|
||||
|
||||
describe('pre and post', function() {
|
||||
var schema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
name: {type: 'string'},
|
||||
age: {type: 'number'}
|
||||
}
|
||||
};
|
||||
|
||||
it('should traverse schema in pre-order', function() {
|
||||
traverse(schema, {cb: {pre}});
|
||||
var expectedCalls = [
|
||||
['pre', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
];
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
it('should traverse schema in post-order', function() {
|
||||
traverse(schema, {cb: {post}});
|
||||
var expectedCalls = [
|
||||
['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
['post', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
];
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
|
||||
it('should traverse schema in pre- and post-order at the same time', function() {
|
||||
traverse(schema, {cb: {pre, post}});
|
||||
var expectedCalls = [
|
||||
['pre', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
|
||||
['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
|
||||
['post', schema, '', schema, undefined, undefined, undefined, undefined],
|
||||
];
|
||||
assert.deepStrictEqual(calls, expectedCalls);
|
||||
});
|
||||
});
|
||||
|
||||
function callback() {
|
||||
calls.push(Array.prototype.slice.call(arguments));
|
||||
}
|
||||
|
||||
function pre() {
|
||||
calls.push(['pre'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
|
||||
function post() {
|
||||
calls.push(['post'].concat(Array.prototype.slice.call(arguments)));
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue