fidor_schema 0.10.12 → 0.10.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8712dc974b90937b9b8db80454efcd257929375
4
- data.tar.gz: e2a4a5eef4cc3230ba98e1a8ca0652f192f345a6
3
+ metadata.gz: 2d40d9ba64fea8a6c419d1c1ba64ec8f57225c9e
4
+ data.tar.gz: 407f5358049a6d21cdca4fedd1025304ef5f1025
5
5
  SHA512:
6
- metadata.gz: c189af4c4d915354620c205e412e51dabe668965156d1d8f1a71b02c37196652cfa64b6fa6b35ba1063d70e6ad5a8c533ba05024f7cb3872dbddb182e76aeea3
7
- data.tar.gz: fc2d27fdd1aade3c6e923d7184c4d16e01f8c929c378808ad2588432bc9695457cb991864d80f155dad5aeceb2c2bc016ed2ddb457e615259ab85a7c30ffcb84
6
+ metadata.gz: 0753362890e301f069b326c1734d45b4f2ab1230dc1ecfeec3e08c0f53b4a19f307538e306da47f1733a425c76729c8e63e823184dbe3eedb6963523f89ee450
7
+ data.tar.gz: 73b666230abfcaff0a468623994891846ba69a3279141e75ae2bc1bd7b099c11b7a5e572547eeac872da6e72417415465bd2d39155aa22450c4d59ad43f8580a
data/Rakefile CHANGED
@@ -5,24 +5,4 @@ require 'rspec/core/rake_task'
5
5
 
6
6
  desc 'Run specs'
7
7
  RSpec::Core::RakeTask.new
8
- task :default => :spec
9
-
10
-
11
- require 'validator'
12
-
13
-
14
- task :validate_dash do
15
- Validator.run :dash
16
- end
17
-
18
- task :validate_underscore do
19
- Validator.run :underscore
20
- end
21
-
22
- task :validate_jschema do
23
- Validator.run :jschema
24
- end
25
-
26
- task :validate_schema => [:validate_dash, :validate_underscore, :validate_jschema] do
27
-
28
- end
8
+ task :default => :spec
@@ -24,13 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'json_schema_tools', '>=0.6.1'
25
25
  spec.add_development_dependency 'activemodel' # required by above
26
26
  spec.add_development_dependency 'rake'
27
- # schema validation gems, for now all of them. must see which one is the most valid ;-)
28
-
29
- # most downloads on rubygems, last updated feb 2015
30
- spec.add_development_dependency 'json-schema'
31
- # 2nd most downloads on rubygems, last updated March 2015
32
- spec.add_development_dependency 'json_schema'
33
- # pretty new , last udpate sep 2014
34
- spec.add_development_dependency 'jschema'
27
+ spec.add_development_dependency 'json_schema_validator'
35
28
 
36
29
  end
@@ -1,5 +1,5 @@
1
1
  module Fidor
2
2
  class Schema
3
- VERSION = '0.10.12'
3
+ VERSION = '0.10.14'
4
4
  end
5
5
  end
@@ -77,6 +77,18 @@
77
77
  "pattern" : "^[A-Z0-9]{8,11}$",
78
78
  "maxLength" : 11
79
79
  },
80
+ "account" : {
81
+ "description" : "UK Bank's Account Number",
82
+ "type" : "string",
83
+ "maxLength" : 8,
84
+ "pattern" : "^(\\d){7,8}$"
85
+ },
86
+ "sort_code" : {
87
+ "description" : "UK Bank's Sort Code",
88
+ "type" : "string",
89
+ "maxLength" : 6,
90
+ "pattern" : "(\\d{2}-?){2}\\d{2}"
91
+ },
80
92
  "eref" : {
81
93
  "description" : "End-to-end reference.",
82
94
  "type" : "string",
@@ -130,6 +142,8 @@
130
142
  "fee",
131
143
  "fidor_payin",
132
144
  "fidor_payout",
145
+ "fps_payin",
146
+ "fps_payout",
133
147
  "gmt_fee",
134
148
  "gmt_refund",
135
149
  "gmt_payout",
@@ -0,0 +1,135 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "title": "fps_transfer",
5
+ "description": "A transfer initiates a transaction e.g get / send money. If the transfer fails no transaction is created!",
6
+ "required": [
7
+ "account_id",
8
+ "amount",
9
+ "external_uid",
10
+ "remote_account",
11
+ "remote_sort_code"
12
+ ],
13
+ "properties": {
14
+ "id": {
15
+ "$ref": "./base_types/base_types.json#definitions/id"
16
+ },
17
+ "external_uid": {
18
+ "$ref": "./base_types/base_types.json#definitions/external_uid"
19
+ },
20
+ "account_id": {
21
+ "$ref": "./base_types/base_types.json#definitions/account_id"
22
+ },
23
+ "user_id": {
24
+ "$ref": "./base_types/base_types.json#definitions/user_id"
25
+ },
26
+ "transaction_id": {
27
+ "$ref": "./base_types/base_types.json#definitions/transaction_id"
28
+ },
29
+ "subject": {
30
+ "$ref": "./base_types/base_types.json#definitions/subject",
31
+ "maxLength": 140
32
+ },
33
+ "amount": {
34
+ "$ref": "./base_types/base_types.json#definitions/amount"
35
+ },
36
+ "currency": {
37
+ "$ref": "./base_types/base_types.json#definitions/currency",
38
+ "readOnly": true
39
+ },
40
+ "fee": {
41
+ "$ref": "./base_types/base_types.json#definitions/fee",
42
+ "readOnly": true
43
+ },
44
+ "remote_name": {
45
+ "description": "Receiving account holder name",
46
+ "type": "string",
47
+ "maxLength": 70
48
+ },
49
+ "remote_account": {
50
+ "$ref": "../base_types/base_types.json#definitions/account"
51
+ },
52
+ "remote_sort_code": {
53
+ "$ref": "../base_types/base_types.json#definitions/sort_code"
54
+ },
55
+ "state": {
56
+ "description": "State of the transfer. received: Order was accepted by the system | processing: Order is being processed | mobile_tan_sent: awaiting tan entry | expired : mtan entry expired | failure: transfer could not be completed | success: transfer successfully executed",
57
+ "enum": [
58
+ "received",
59
+ "mobile_tan_sent",
60
+ "success",
61
+ "expired",
62
+ "failure"
63
+ ],
64
+ "readOnly": true,
65
+ "type": "string"
66
+ },
67
+ "created_at": {
68
+ "$ref": "./base_types/base_types.json#definitions/created_at"
69
+ },
70
+ "updated_at": {
71
+ "$ref": "./base_types/base_types.json#definitions/updated_at"
72
+ }
73
+ },
74
+ "links": [
75
+ {
76
+ "rel": "self",
77
+ "href": "fps_transfers/{id}"
78
+ },
79
+ {
80
+ "rel": "instances",
81
+ "href": "fps_transfers",
82
+ "properties": {
83
+ "filter[account_ids]": {
84
+ "description": "Find transfers belonging to the given account ids. Single id or multiple ids comma-separated.",
85
+ "type": "string"
86
+ },
87
+ "filter[created_at_from]": {
88
+ "description": "Creation date filter from >= date",
89
+ "format": "date-time",
90
+ "type": "string"
91
+ },
92
+ "filter[created_at_to]": {
93
+ "description": "Creation date filter to <= date",
94
+ "format": "date-time",
95
+ "type": "string"
96
+ },
97
+ "filter[states]": {
98
+ "description": "Filter by single or multiple csv delimited states",
99
+ "enum": [
100
+ "received",
101
+ "mobile_tan_sent",
102
+ "success",
103
+ "expired",
104
+ "failure"
105
+ ],
106
+ "type": "string"
107
+ },
108
+ "page": {
109
+ "title": "Page",
110
+ "description": "In paginated results set the page to look for",
111
+ "type": "integer"
112
+ },
113
+ "per_page": {
114
+ "title": "Per page",
115
+ "description": "Results per page. Default is 10, max is 100",
116
+ "type": "integer"
117
+ },
118
+ "sort": {
119
+ "title": "Sort",
120
+ "enum": [
121
+ "ASC",
122
+ "DESC"
123
+ ],
124
+ "description": "Sort the results in ASC or DESC",
125
+ "type": "string"
126
+ }
127
+ }
128
+ },
129
+ {
130
+ "rel": "create",
131
+ "href": "fps_transfers",
132
+ "method": "POST"
133
+ }
134
+ ]
135
+ }
@@ -21,7 +21,7 @@
21
21
  "links": [
22
22
  {
23
23
  "rel": "push",
24
- "href": "notification/push",
24
+ "href": "notifications/push",
25
25
  "method": "POST"
26
26
  }
27
27
  ]
@@ -23,7 +23,7 @@
23
23
  "links" : [
24
24
  {
25
25
  "rel" : "instances",
26
- "href" : "rate_limits"
26
+ "href" : "rate_limit"
27
27
  }
28
28
  ]
29
- }
29
+ }
@@ -47,6 +47,10 @@
47
47
  {
48
48
  "title": "mobile_topup_details",
49
49
  "$ref" : "./transaction_type_details/mobile_topup_details.json#"
50
+ },
51
+ {
52
+ "title": "fps_details",
53
+ "$ref" : "./transaction_type_details/fps_details.json#"
50
54
  }
51
55
  ]
52
56
  },
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "title": "fps_details",
5
+ "description": "Remote account information available in a Faster Payments transfer",
6
+ "properties": {
7
+ "fps_transfer_id": {
8
+ "description": "Id of transfer if transaction was created by a transfer.",
9
+ "readOnly": true,
10
+ "type": "string"
11
+ },
12
+ "remote_name": {
13
+ "description": "Receiving account holder name",
14
+ "type": "string",
15
+ "maxLength": 70,
16
+ "readOnly": true
17
+ },
18
+ "remote_account": {
19
+ "$ref": "../base_types/base_types.json#definitions/account",
20
+ "readOnly": true
21
+ },
22
+ "remote_sort_code": {
23
+ "$ref": "../base_types/base_types.json#definitions/sort_code",
24
+ "readOnly": true
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type": "object",
4
+ "title": "video_ident",
5
+ "description": "Creates IDnow identifications",
6
+ "properties": {
7
+ "customer_id": {
8
+ "$ref": "./base_types/base_types.json#definitions/account_id"
9
+ }
10
+ },
11
+ "links": [
12
+ {
13
+ "rel": "create",
14
+ "href": "video_idents",
15
+ "method": "POST"
16
+ }
17
+ ]
18
+ }
@@ -9,17 +9,14 @@ describe Fidor::Schema do
9
9
  end
10
10
 
11
11
  context 'read schemata' do
12
-
13
12
  it 'should read all json files' do
14
13
  SchemaTools.schema_path = Fidor::Schema.path
15
14
  SchemaTools::Reader.read_all
16
15
  expect(SchemaTools::Reader.registry).to_not be_empty
17
16
  end
18
-
19
17
  end
20
18
 
21
19
  context 'resolves $refs' do
22
-
23
20
  it 'in single schema' do
24
21
  SchemaTools.schema_path = Fidor::Schema.path
25
22
  schema = SchemaTools::Reader.read('account').to_h
@@ -35,6 +32,15 @@ describe Fidor::Schema do
35
32
  }
36
33
  expect(out).to_not include('$ref')
37
34
  end
35
+ end
38
36
 
37
+ context 'validate schemata' do
38
+ it 'should validate all' do
39
+ schema_path = Fidor::Schema.path
40
+ errors = JsonSchemaValidator.validate_schemas(schema_path)
41
+ errors.each do |name, error|
42
+ expect(error).to be_empty
43
+ end
44
+ end
39
45
  end
40
46
  end
@@ -4,6 +4,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
5
  require 'rspec'
6
6
  require 'json_schema_tools'
7
+ require 'json_schema_validator'
7
8
  require 'fidor_schema'
8
9
 
9
10
  RSpec.configure do |config|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fidor_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.12
4
+ version: 0.10.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Leciejewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-16 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,35 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: json-schema
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: json_schema
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: jschema
98
+ name: json_schema_validator
127
99
  requirement: !ruby/object:Gem::Requirement
128
100
  requirements:
129
101
  - - ">="
@@ -155,12 +127,6 @@ files:
155
127
  - lib/fidor/schema.rb
156
128
  - lib/fidor_schema.rb
157
129
  - lib/fidor_schema_version.rb
158
- - lib/validator.rb
159
- - lib/validator/base.rb
160
- - lib/validator/j_schema.rb
161
- - lib/validator/json-schema.rb
162
- - lib/validator/json_schema.rb
163
- - lib/validator/schema.json
164
130
  - schema/v1.0/account.json
165
131
  - schema/v1.0/account_limit.json
166
132
  - schema/v1.0/bank_check.json
@@ -174,6 +140,7 @@ files:
174
140
  - schema/v1.0/creditor_identity.json
175
141
  - schema/v1.0/customer.json
176
142
  - schema/v1.0/error.json
143
+ - schema/v1.0/fps_transfer.json
177
144
  - schema/v1.0/internal_transfer.json
178
145
  - schema/v1.0/legal.json
179
146
  - schema/v1.0/message.json
@@ -199,6 +166,7 @@ files:
199
166
  - schema/v1.0/transaction.json
200
167
  - schema/v1.0/transaction_type_details/bonus_details.json
201
168
  - schema/v1.0/transaction_type_details/credit_card_details.json
169
+ - schema/v1.0/transaction_type_details/fps_details.json
202
170
  - schema/v1.0/transaction_type_details/gmt_details.json
203
171
  - schema/v1.0/transaction_type_details/internal_transfer_details.json
204
172
  - schema/v1.0/transaction_type_details/mobile_topup_details.json
@@ -206,11 +174,9 @@ files:
206
174
  - schema/v1.0/transaction_type_details/sepa_direct_debit_details.json
207
175
  - schema/v1.0/transfer_approval.json
208
176
  - schema/v1.0/user.json
177
+ - schema/v1.0/video_ident.json
209
178
  - spec/fidor_schema_spec.rb
210
179
  - spec/spec_helper.rb
211
- - spec/validator/j_schema_spec.rb
212
- - spec/validator/json-schema_spec.rb
213
- - spec/validator/json_schema_spec.rb
214
180
  homepage: https://www.fidor.de
215
181
  licenses:
216
182
  - MIT
@@ -238,6 +204,3 @@ summary: BETA Fidor API - JSON Schema
238
204
  test_files:
239
205
  - spec/fidor_schema_spec.rb
240
206
  - spec/spec_helper.rb
241
- - spec/validator/j_schema_spec.rb
242
- - spec/validator/json-schema_spec.rb
243
- - spec/validator/json_schema_spec.rb
@@ -1,4 +0,0 @@
1
- require 'validator/base'
2
- require 'validator/json-schema'
3
- require 'validator/json_schema'
4
- require 'validator/j_schema'
@@ -1,105 +0,0 @@
1
- # This functionality is intended to run the schema, through
2
- # any available Schema Validators for Ruby.
3
- #
4
- # They should be valid according to draft-4 ...
5
- #
6
- # The schema validators currently being considered are:
7
- #
8
- # https://github.com/ruby-json-schema/json-schema
9
- # https://github.com/brandur/json_schema (note the underscore!)
10
- # https://github.com/Soylent/jschema
11
- #
12
- # These are the three currently available ruby validators that
13
- # support draft-4. (According to json-schema.org).
14
- #
15
- # Each has their quirks, we'll try to:
16
- # * use each to validate each fidor schema against the json-schema meta-schema
17
- # * try to load each fidor schema as a schema for validation.
18
- #
19
- require 'pathname'
20
-
21
- module Validator
22
- class Base
23
- # @return [Array<String>] file paths
24
- attr_accessor :files_to_validate
25
-
26
- # Run the given validator with all schema files
27
- def self.run(files)
28
- puts "Running validation with #{name} for #{files.length} schemas"
29
- v = new(files)
30
- v.validate_all
31
- puts v.log_fmt
32
- v
33
- end
34
-
35
- def validate_all
36
- validate_schemas
37
- validate_data
38
- end
39
-
40
- def validate_schemas
41
- files_to_validate.each do |file|
42
- schema = File.read file
43
- log << "validate schema: #{file}"
44
- validate schema
45
- end
46
- end
47
-
48
- def validate_data
49
- files_to_validate.each do |file|
50
- schema = File.read file
51
- log << "validate data against: #{file}"
52
- use_for_validation schema
53
- end
54
- end
55
-
56
-
57
- # Joins the logs before display
58
- def log_fmt
59
- res = []
60
- if errors.length > 0
61
- res << "#{errors.join("\n\n")}"
62
- res << "="*50
63
- res << "#{errors.length} with errors"
64
- end
65
- res << "#{success.uniq.length} Schemas passed"
66
- res.join("\n")
67
- end
68
- # @return [Array<String>] error schemas
69
- def errors
70
- @errors ||= []
71
- end
72
- # @return [Array<String>] test log
73
- def log
74
- @log ||= []
75
- end
76
- # @return [Array<String>] successfull schema titles
77
- def success
78
- @success ||= []
79
- end
80
-
81
- end
82
-
83
- def self.find_all_schema
84
- # asssume we're running from rake and pwd is project root ...
85
- this_dir = File.dirname(__FILE__)
86
- repo_dir = Pathname.new(this_dir+"/../..").cleanpath.to_s
87
-
88
- Dir.glob("#{repo_dir}/schema/**/*.json")
89
- end
90
-
91
-
92
- # @param [Symbol] validator to use
93
- def self.run(validator)
94
- case validator
95
- when :underscore
96
- Json_Schema.run find_all_schema
97
- when :dash
98
- JsonSchema.run find_all_schema
99
- when :jschema
100
- JSchema.run find_all_schema
101
- else
102
- puts "Unknown validator: #{validator}"
103
- end
104
- end
105
- end
@@ -1,34 +0,0 @@
1
- require 'jschema'
2
- module Validator
3
- class JSchema < Base
4
-
5
- def initialize(files_to_validate)
6
- @files_to_validate = files_to_validate
7
- schema_data = File.read("#{File.dirname(__FILE__)}/schema.json")
8
- schema_json = JSON.parse(schema_data)
9
- @meta_schema = ::JSchema.build(schema_json)
10
- end
11
-
12
- def validate(schema)
13
- schema_to_test = JSON.parse(schema)
14
- result = @meta_schema.validate schema_to_test
15
- if !result || result.length == 0
16
- success << schema_to_test['title'] || schema_to_test.keys[0]
17
- else
18
- errors << "Schema validation failed: #{schema_to_test['title']}\n#{result.join("\n")}"
19
- end
20
- end
21
-
22
- def use_for_validation(schema)
23
- schema_to_test = JSON.parse(schema)
24
- begin
25
- ::JSchema.build(schema_to_test)
26
- rescue
27
- errors << "Data validation failed: #{schema_to_test['title']}\n#{$!}"
28
- # puts $!.backtrace
29
- else
30
- success << schema_to_test['title'] || schema_to_test.keys[0]
31
- end
32
- end
33
- end
34
- end
@@ -1,51 +0,0 @@
1
- require 'json-schema'
2
- # https://github.com/ruby-json-schema/json-schema
3
- module Validator
4
- class JsonSchema < Base
5
- def initialize(files_to_validate)
6
- @files_to_validate = files_to_validate
7
- @meta_schema_path = "#{File.dirname(__FILE__)}/schema.json"
8
-
9
- # need to know the base dir of the schema to resolve relative uris.
10
- # see below.
11
- @schemadir = File.dirname(@files_to_validate[0])
12
- end
13
-
14
- # @param [String] schema to test against the meta schema
15
- def validate(schema)
16
- schema_to_test = JSON.parse(schema)
17
- begin
18
- result = JSON::Validator.fully_validate(@meta_schema_path, schema_to_test)
19
- if !result || result.length == 0
20
- success << schema_to_test['title'] || schema_to_test.keys[0]
21
- else
22
- errors << "Schema validation failed: #{schema_to_test['title']}\n#{result.join("\n")}"
23
- end
24
- rescue => e
25
- errors << "Schema validation failed: #{schema_to_test['title']}\n#{e}"
26
- # puts e.backtrace
27
- end
28
- end
29
-
30
- def use_for_validation(schema)
31
- schema_to_test = JSON.parse(schema)
32
-
33
- # json-schema resolves relatives path relative to it's own "."
34
- # not relative to the file containing the reference ...
35
- base_dir = Dir.pwd
36
-
37
- begin
38
- Dir.chdir @schemadir
39
- data = {}
40
- result = JSON::Validator.fully_validate(schema_to_test, data)
41
- if !result || result.length == 0
42
- success << schema_to_test['title']
43
- else
44
- errors << "Data validation failed: #{schema_to_test['title']}\n#{result.join("\n")}"
45
- end
46
- ensure
47
- Dir.chdir base_dir
48
- end
49
- end
50
- end
51
- end
@@ -1,37 +0,0 @@
1
- require 'json_schema'
2
- module Validator
3
- class Json_Schema < Base
4
-
5
- def initialize files_to_validate
6
- @files_to_validate = files_to_validate
7
- schema_data = File.read("#{File.dirname(__FILE__)}/schema.json")
8
- schema_json = JSON.parse(schema_data)
9
- @schema = ::JsonSchema.parse!(schema_json)
10
- @errors, @success = [], []
11
- end
12
-
13
- # @param [String] schema to test against the meta schema
14
- def validate(schema)
15
- schema_to_test = JSON.parse(schema)
16
- begin
17
- @schema.validate! schema_to_test
18
- rescue
19
- errors << "Schema validation failed: #{schema_to_test['title']}\n#{$!}"
20
- else
21
- success << File.basename(schema)
22
- end
23
- end
24
-
25
- def use_for_validation(schema)
26
- schema_to_test = JSON.parse(schema)
27
- begin
28
- ::JsonSchema.parse!(schema_to_test)
29
- rescue
30
- errors << "Data validation failed: #{schema_to_test['title']}\n#{$!}"
31
- else
32
- success << schema_to_test['title']
33
- end
34
- end
35
-
36
- end
37
- end
@@ -1,150 +0,0 @@
1
- {
2
- "id": "http://json-schema.org/draft-04/schema#",
3
- "$schema": "http://json-schema.org/draft-04/schema#",
4
- "description": "Core schema meta-schema",
5
- "definitions": {
6
- "schemaArray": {
7
- "type": "array",
8
- "minItems": 1,
9
- "items": { "$ref": "#" }
10
- },
11
- "positiveInteger": {
12
- "type": "integer",
13
- "minimum": 0
14
- },
15
- "positiveIntegerDefault0": {
16
- "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
17
- },
18
- "simpleTypes": {
19
- "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
20
- },
21
- "stringArray": {
22
- "type": "array",
23
- "items": { "type": "string" },
24
- "minItems": 1,
25
- "uniqueItems": true
26
- }
27
- },
28
- "type": "object",
29
- "properties": {
30
- "id": {
31
- "type": "string",
32
- "format": "uri"
33
- },
34
- "$schema": {
35
- "type": "string",
36
- "format": "uri"
37
- },
38
- "title": {
39
- "type": "string"
40
- },
41
- "description": {
42
- "type": "string"
43
- },
44
- "default": {},
45
- "multipleOf": {
46
- "type": "number",
47
- "minimum": 0,
48
- "exclusiveMinimum": true
49
- },
50
- "maximum": {
51
- "type": "number"
52
- },
53
- "exclusiveMaximum": {
54
- "type": "boolean",
55
- "default": false
56
- },
57
- "minimum": {
58
- "type": "number"
59
- },
60
- "exclusiveMinimum": {
61
- "type": "boolean",
62
- "default": false
63
- },
64
- "maxLength": { "$ref": "#/definitions/positiveInteger" },
65
- "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
66
- "pattern": {
67
- "type": "string",
68
- "format": "regex"
69
- },
70
- "additionalItems": {
71
- "anyOf": [
72
- { "type": "boolean" },
73
- { "$ref": "#" }
74
- ],
75
- "default": {}
76
- },
77
- "items": {
78
- "anyOf": [
79
- { "$ref": "#" },
80
- { "$ref": "#/definitions/schemaArray" }
81
- ],
82
- "default": {}
83
- },
84
- "maxItems": { "$ref": "#/definitions/positiveInteger" },
85
- "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
86
- "uniqueItems": {
87
- "type": "boolean",
88
- "default": false
89
- },
90
- "maxProperties": { "$ref": "#/definitions/positiveInteger" },
91
- "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
92
- "required": { "$ref": "#/definitions/stringArray" },
93
- "additionalProperties": {
94
- "anyOf": [
95
- { "type": "boolean" },
96
- { "$ref": "#" }
97
- ],
98
- "default": {}
99
- },
100
- "definitions": {
101
- "type": "object",
102
- "additionalProperties": { "$ref": "#" },
103
- "default": {}
104
- },
105
- "properties": {
106
- "type": "object",
107
- "additionalProperties": { "$ref": "#" },
108
- "default": {}
109
- },
110
- "patternProperties": {
111
- "type": "object",
112
- "additionalProperties": { "$ref": "#" },
113
- "default": {}
114
- },
115
- "dependencies": {
116
- "type": "object",
117
- "additionalProperties": {
118
- "anyOf": [
119
- { "$ref": "#" },
120
- { "$ref": "#/definitions/stringArray" }
121
- ]
122
- }
123
- },
124
- "enum": {
125
- "type": "array",
126
- "minItems": 1,
127
- "uniqueItems": true
128
- },
129
- "type": {
130
- "anyOf": [
131
- { "$ref": "#/definitions/simpleTypes" },
132
- {
133
- "type": "array",
134
- "items": { "$ref": "#/definitions/simpleTypes" },
135
- "minItems": 1,
136
- "uniqueItems": true
137
- }
138
- ]
139
- },
140
- "allOf": { "$ref": "#/definitions/schemaArray" },
141
- "anyOf": { "$ref": "#/definitions/schemaArray" },
142
- "oneOf": { "$ref": "#/definitions/schemaArray" },
143
- "not": { "$ref": "#" }
144
- },
145
- "dependencies": {
146
- "exclusiveMaximum": [ "maximum" ],
147
- "exclusiveMinimum": [ "minimum" ]
148
- },
149
- "default": {}
150
- }
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
- require 'validator'
3
-
4
- describe Validator::JSchema do
5
- it 'validates schemas against the meta schema' do
6
- path = Fidor::Schema.path
7
- files = Dir.glob("#{path}/**/*.json")
8
- v = Validator::JSchema.new files
9
- v.validate_schemas
10
- expect(v.log[0]).to include('validate schema')
11
- expect(v.errors).to be_empty
12
- end
13
-
14
- it 'validates schemas against blank data' do
15
- path = Fidor::Schema.path
16
- files = Dir.glob("#{path}/**/*.json")
17
- v = Validator::JSchema.new files
18
- v.validate_data
19
- expect(v.log[0]).to include('validate data')
20
- # expect(v.errors).to be_empty
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
- require 'validator'
3
-
4
- describe Validator::JsonSchema do
5
- it 'validates schemas against the meta schema' do
6
- path = Fidor::Schema.path
7
- files = Dir.glob("#{path}/**/*.json")
8
- v = Validator::JsonSchema.new files
9
- v.validate_schemas
10
- expect(v.log[0]).to include('validate schema')
11
- expect(v.errors).to be_empty
12
- end
13
-
14
- it 'validates schemas against blank data' do
15
- path = Fidor::Schema.path
16
- files = Dir.glob("#{path}/**/*.json")
17
- v = Validator::JsonSchema.new files
18
- v.validate_data
19
- expect(v.log[0]).to include('validate data')
20
- # expect(v.errors).to be_empty
21
- end
22
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
- require 'validator'
3
-
4
- describe Validator::Json_Schema do
5
- it 'validates schemas against the meta schema' do
6
- path = Fidor::Schema.path
7
- files = Dir.glob("#{path}/**/*.json")
8
- v = Validator::Json_Schema.new files
9
- v.validate_schemas
10
- expect(v.log[0]).to include('validate schema')
11
- expect(v.errors).to be_empty
12
- end
13
- end