fidor_schema 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c70cf2ea5dbdd0925dd6992e7ef0b69a824a3522
4
- data.tar.gz: c7db35bfb94e8d72179dbddb2710b09967e9d759
3
+ metadata.gz: 0dc90399a45af5d7e7693f2c26959e48fd8aa0ef
4
+ data.tar.gz: 7c5111f209fb28d926e626ea95ebb8388198d6fe
5
5
  SHA512:
6
- metadata.gz: 592a28a6cae12192d239746525fbf03c906357e97171001c204f8b5ec3a54f77c87e1716974907a05ca411246a5eb7d538bb303d9b2ec4bb82d8c8a5f9267b3d
7
- data.tar.gz: f41347686daf3a9bd3dd06736e51fe9175036072a1e6028cfa3b0ece585b5b3443fa81c8085b52405f6d044b6d8521bbc18ac1dc0e65c8351ee0f0ddf0b38bf2
6
+ metadata.gz: ee7c5bd7ca3a0cdd713fb6a8e232f6e8e0bf366c059423a1589098dd03addd521e1141f5a1e2295c5d2a17f7ba3e128edf010b79d0b79bb9d5ae8418bed5e71b
7
+ data.tar.gz: cb9a1f3f86c275efef8b3329bfeb45093d238cb47aa2c34965679154eef71ed6000784023b9788cd48eba387fe8e38b0f007029481db6c42996a347a70e9bbd3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  A more detailed view of the changes can be found in the [commit messages](https://github.com/fidor/fidor_schema/commits/)
4
4
 
5
+ ##2015-02
6
+
7
+ * SepaMandates filter by multiple references and ibans
8
+ * move required markup into 'required' array on top-level of an object
9
+ * change date field format to 'date-time' since date-only values are also valid in terms of http://tools.ietf.org/html/rfc3339#section-5.6
10
+
5
11
  ##2014-12
6
12
 
7
13
  * be explicit for number fields, now defined as integers
data/Gemfile CHANGED
@@ -1,2 +1,5 @@
1
1
  source 'https://rubygems.org'
2
- gemspec
2
+ gem 'json-schema'
3
+ gem 'json_schema'
4
+ gem 'jschema'
5
+ gemspec
data/Rakefile CHANGED
@@ -6,3 +6,23 @@ require 'rspec/core/rake_task'
6
6
  desc 'Run specs'
7
7
  RSpec::Core::RakeTask.new
8
8
  task :default => :spec
9
+
10
+
11
+ require 'validate/validate'
12
+
13
+
14
+ task :validate_dash do
15
+ Fidor::SchemaValidation.main :dash
16
+ end
17
+
18
+ task :validate_underscore do
19
+ Fidor::SchemaValidation.main :underscore
20
+ end
21
+
22
+ task :validate_jschema do
23
+ Fidor::SchemaValidation.main :jschema
24
+ end
25
+
26
+ task :validate_schema => [:validate_dash, :validate_underscore, :validate_jschema] do
27
+
28
+ end
@@ -1,5 +1,5 @@
1
1
  module Fidor
2
2
  class Schema
3
- VERSION='0.4.3'
3
+ VERSION='0.5.0'
4
4
  end
5
5
  end
@@ -0,0 +1,150 @@
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
+ }
@@ -0,0 +1,184 @@
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
+ require 'json-schema'
21
+ require 'json_schema'
22
+ require 'jschema'
23
+
24
+ module Fidor
25
+ module SchemaValidation
26
+
27
+ class Validator # Base
28
+ def validate_all
29
+ @files_to_validate.each do |file|
30
+ schema = File.read file
31
+ puts "\nvalidating: #{file}"
32
+ validate schema
33
+ puts "\nusing #{file} for validation."
34
+ use_for_validation schema
35
+ end
36
+ end
37
+ end
38
+
39
+ # https://github.com/ruby-json-schema/json-schema
40
+ class JsonDashSchemaValidator < Validator
41
+ def initialize files_to_validate
42
+ @files_to_validate = files_to_validate
43
+ @meta_schema_fn = "#{File.dirname(__FILE__)}/schema.json"
44
+
45
+ # need to know the base dir of the schema to resolve relative uris.
46
+ # see below.
47
+ @schemadir = File.dirname(@files_to_validate[0])
48
+
49
+ validate_all
50
+ end # init
51
+
52
+ def validate schema
53
+ begin
54
+ results = JSON::Validator.fully_validate(@meta_schema_fn, schema)
55
+ if !results || results.length == 0
56
+ puts "Passed!"
57
+ else
58
+ puts "Failed!"
59
+ puts results
60
+ end
61
+ rescue
62
+ puts "Failed! Error..."
63
+ puts $!
64
+ puts $!.backtrace
65
+ end
66
+ end
67
+
68
+ def use_for_validation schema
69
+ # json-schema resolves relatives path relative to it's own "."
70
+ # not relative to the file containing the reference ...
71
+ baseDirectory = Dir.pwd
72
+
73
+ begin
74
+ Dir.chdir @schemadir
75
+ data = {}
76
+ results = JSON::Validator.fully_validate(schema, data)
77
+ if !results || results.length == 0
78
+ puts "Passed!"
79
+ else
80
+ puts "Failed!"
81
+ puts results
82
+ end
83
+ ensure
84
+ Dir.chdir baseDirectory
85
+ end
86
+ end
87
+ end
88
+
89
+ class JsonUnderscoreSchemaValidator < Validator
90
+ def initialize files_to_validate
91
+ @files_to_validate = files_to_validate
92
+ schema_data = File.read("#{File.dirname(__FILE__)}/schema.json")
93
+ schema_json = JSON.parse(schema_data)
94
+ @schema = JsonSchema.parse!(schema_json)
95
+ validate_all
96
+ end
97
+
98
+ def validate schema
99
+ begin
100
+ schema_to_test = JSON.parse(schema)
101
+ @schema.validate! schema_to_test
102
+ puts "Passed validation against meta-schema!"
103
+ JsonSchema.parse!(schema_to_test)
104
+ rescue
105
+ puts $!
106
+ puts "Failed!"
107
+ else
108
+ puts "Passed!"
109
+ end
110
+ end
111
+ def use_for_validation schema
112
+ begin
113
+ schema_to_test = JSON.parse(schema)
114
+ JsonSchema.parse!(schema_to_test)
115
+ rescue
116
+ puts $!
117
+ puts "Failed"
118
+ else
119
+ puts "Passed!"
120
+ end
121
+ end
122
+ end
123
+
124
+ class JSchemaValidator < Validator
125
+ def initialize files_to_validate
126
+ @files_to_validate = files_to_validate
127
+ schema_data = File.read("#{File.dirname(__FILE__)}/schema.json")
128
+ schema_json = JSON.parse(schema_data)
129
+ @schema = JSchema.build(schema_json)
130
+ validate_all
131
+ end
132
+ def validate schema
133
+ schema_to_test = JSON.parse(schema)
134
+ results = @schema.validate schema_to_test
135
+ if !results || results.length == 0
136
+ puts "Passed!"
137
+ else
138
+ puts "Failed!"
139
+ puts results
140
+ end
141
+ end
142
+ def use_for_validation schema
143
+ schema_to_test = JSON.parse(schema)
144
+ begin
145
+ JSchema.build(schema_to_test)
146
+ rescue
147
+ puts "Failed!"
148
+ puts $!
149
+ # puts $!.backtrace
150
+ else
151
+ puts "Passed!"
152
+ end
153
+ end
154
+ end
155
+
156
+ def self.find_all_schema
157
+ # asssume we're running from rake and
158
+ # pwd is project root ...
159
+ this_dir = File.dirname(__FILE__)
160
+ repo_dir = Pathname.new(this_dir+"/../..").cleanpath.to_s
161
+
162
+ Dir.glob("#{repo_dir}/schema/*/*.json")
163
+ end
164
+
165
+
166
+ def self.main validator
167
+ case validator
168
+ when :underscore
169
+ puts "Running validation with JSON_Schema"
170
+ JsonUnderscoreSchemaValidator.new find_all_schema
171
+ when :dash
172
+ puts "Running validation with JSON-Schema"
173
+ JsonDashSchemaValidator.new find_all_schema
174
+ when :jschema
175
+ puts "Running validation with JSchema"
176
+ JSchemaValidator.new find_all_schema
177
+ else
178
+ puts "Unknown validator: #{validator}"
179
+ end
180
+
181
+ end
182
+ end
183
+ end
184
+
@@ -50,8 +50,7 @@
50
50
  },
51
51
  "external_uid" : {
52
52
  "description" : "Unique ID of the creator of the transaction. In case a uid is reused for a transaction, it is not executed, this mechanism can be used to prevent double bookings in case of network failure or similar event where transaction status is unknown",
53
- "type" : "string",
54
- "required" : true
53
+ "type" : "string"
55
54
  },
56
55
  "iban" : {
57
56
  "description" : "IBAN",
@@ -5,6 +5,7 @@
5
5
  "title" : "Batch Direct Debit",
6
6
  "name" : "batch_direct_debit",
7
7
  "description" : "PREVIEW: A direct debit batch contains multiple direct debits which are processed asynchronously.",
8
+ "required" : ["account_id", "external_uid"],
8
9
  "properties" : {
9
10
  "id" : {
10
11
  "$ref" : "./base_types/base_types.json#definitions/id"
@@ -13,8 +14,7 @@
13
14
  "$ref" : "./base_types/base_types.json#definitions/external_uid"
14
15
  },
15
16
  "account_id" : {
16
- "$ref" : "./base_types/base_types.json#definitions/account_id",
17
- "required" : true
17
+ "$ref" : "./base_types/base_types.json#definitions/account_id"
18
18
  },
19
19
  "user_id" : {
20
20
  "$ref" : "./base_types/base_types.json#definitions/user_id"
@@ -22,7 +22,6 @@
22
22
  "sepa_direct_debits" : {
23
23
  "description" : "The direct_debits to process.",
24
24
  "type" : "array",
25
- "required" : false,
26
25
  "items" : {
27
26
  "type" : "object",
28
27
  "properties" : {
@@ -94,12 +93,12 @@
94
93
  "properties" : {
95
94
  "filter[created_at_from]" : {
96
95
  "title" : "Creation date filter from >= date",
97
- "format" : "date",
96
+ "format" : "date-time",
98
97
  "type" : "string"
99
98
  },
100
99
  "filter[created_at_to]" : {
101
100
  "title" : "Creation date filter to <= date",
102
- "format" : "date",
101
+ "format" : "date-time",
103
102
  "type" : "string"
104
103
  },
105
104
  "filter[states]" : {
@@ -5,6 +5,7 @@
5
5
  "title" : "Batch Transfer",
6
6
  "name" : "batch_transfer",
7
7
  "description" : "PREVIEW: A transfer batch contains multiple transfers which are processed asynchronously.",
8
+ "required" : ["account_id", "external_uid"],
8
9
  "properties" : {
9
10
  "id" : {
10
11
  "$ref" : "./base_types/base_types.json#definitions/id"
@@ -13,8 +14,7 @@
13
14
  "$ref" : "./base_types/base_types.json#definitions/external_uid"
14
15
  },
15
16
  "account_id" : {
16
- "$ref" : "./base_types/base_types.json#definitions/account_id",
17
- "required" : true
17
+ "$ref" : "./base_types/base_types.json#definitions/account_id"
18
18
  },
19
19
  "user_id" : {
20
20
  "$ref" : "./base_types/base_types.json#definitions/user_id"
@@ -128,17 +128,17 @@
128
128
  "properties" : {
129
129
  "filter[account_ids]" : {
130
130
  "title" : "Find transfers belonging to the given account ids. Single id or multiple ids comma-separated.",
131
- "format" : "date",
131
+ "format" : "date-time",
132
132
  "type" : "string"
133
133
  },
134
134
  "filter[created_at_from]" : {
135
135
  "title" : "Creation date filter from >= date",
136
- "format" : "date",
136
+ "format" : "date-time",
137
137
  "type" : "string"
138
138
  },
139
139
  "filter[created_at_to]" : {
140
140
  "title" : "Creation date filter to <= date",
141
- "format" : "date",
141
+ "format" : "date-time",
142
142
  "type" : "string"
143
143
  },
144
144
  "filter[states]" : {
@@ -3,26 +3,24 @@
3
3
  "title" : "Customer",
4
4
  "name" : "customer",
5
5
  "description" : "",
6
+ "required" : ["email", "first_name", "last_name", "gender", "title", "nick"],
6
7
  "properties" : {
7
8
  "id" : {
8
9
  "$ref" : "./base_types/base_types.json#definitions/id"
9
10
  },
10
11
  "email" : {
11
12
  "$ref" : "./base_types/base_types.json#definitions/email",
12
- "required" : true,
13
13
  "readonly" : true
14
14
  },
15
15
  "first_name" : {
16
16
  "description" : "The given name of the customer",
17
17
  "type" : "string",
18
- "required" : true,
19
18
  "maxLength" : 30,
20
19
  "readonly" : true
21
20
  },
22
21
  "last_name" : {
23
22
  "description" : "The family name of the customer",
24
23
  "type" : "string",
25
- "required" : true,
26
24
  "maxLength" : 30,
27
25
  "readonly" : true
28
26
  },
@@ -33,20 +31,17 @@
33
31
  "f"
34
32
  ],
35
33
  "type" : "string",
36
- "required" : true,
37
34
  "readonly" : true
38
35
  },
39
36
  "title" : {
40
37
  "description" : "Salutation e.g Mr. or Ms./Mrs.",
41
38
  "type" : "string",
42
- "required" : true,
43
39
  "maxLength" : 30,
44
40
  "readonly" : true
45
41
  },
46
42
  "nick" : {
47
43
  "description" : "Nickname used in community.",
48
44
  "type" : "string",
49
- "required" : true,
50
45
  "maxLength" : 40,
51
46
  "minLength" : 2,
52
47
  "readonly" : true
@@ -114,7 +109,7 @@
114
109
  "birthday" : {
115
110
  "description" : "Date of birth",
116
111
  "type" : "string",
117
- "format" : "date",
112
+ "format" : "date-time",
118
113
  "readonly" : true
119
114
  },
120
115
  "creditor_identifier" : {
@@ -181,7 +176,7 @@
181
176
  },
182
177
  "id_card_valid_until" : {
183
178
  "description" : "Expiration date of id card",
184
- "format" : "date",
179
+ "format" : "date-time",
185
180
  "type" : "string",
186
181
  "readonly" : true
187
182
  },
@@ -3,36 +3,33 @@
3
3
  "title" : "Error",
4
4
  "name" : "error",
5
5
  "description" : "A standard error object",
6
+ "required" : ["message", "code", "errors"],
6
7
  "properties" : {
7
8
  "message" : {
8
9
  "description" : "a human readable representation of the error",
9
- "required" : true,
10
10
  "type" : "string",
11
11
  "readonly" : true
12
12
  },
13
13
  "code" : {
14
14
  "description" : "a numeric code identifying the error",
15
- "required" : false,
16
15
  "type" : "integer",
17
16
  "readonly" : true
18
17
  },
19
18
  "errors" : {
20
19
  "description" : "error details, if applicable",
21
- "required" : false,
22
20
  "type" : "array",
23
21
  "items" : {
24
22
  "type" : "object",
23
+ "required" : ["field", "message"],
25
24
  "properties" : {
26
25
  "field" : {
27
26
  "description" : "identifies the field that caused this error",
28
27
  "type" : "string",
29
- "required" : false,
30
28
  "readonly" : true
31
29
  },
32
30
  "message" : {
33
31
  "description" : "provide more information about the cause of this error",
34
32
  "type" : "string",
35
- "required" : false,
36
33
  "readonly" : true
37
34
  }
38
35
  }
@@ -3,6 +3,7 @@
3
3
  "title" : "Internal Transfer",
4
4
  "name" : "internal_transfer",
5
5
  "description" : "A transfer initiates a transaction e.g get / send money. If the transfer fails no transaction is created!",
6
+ "required" : ["account_id", "receiver", "amount", "external_uid"],
6
7
  "properties" : {
7
8
  "id" : {
8
9
  "$ref" : "./base_types/base_types.json#definitions/id"
@@ -12,8 +13,7 @@
12
13
  },
13
14
  "account_id" : {
14
15
  "description" : "Sending account.",
15
- "$ref" : "./base_types/base_types.json#definitions/account_id",
16
- "required" : true
16
+ "$ref" : "./base_types/base_types.json#definitions/account_id"
17
17
  },
18
18
  "user_id" : {
19
19
  "$ref" : "./base_types/base_types.json#definitions/user_id"
@@ -23,7 +23,6 @@
23
23
  },
24
24
  "receiver" : {
25
25
  "description" : "The transaction's receiver can be defined as a numerical fidor account id, a twitter name, an email or a phone number.",
26
- "required" : true,
27
26
  "oneOf" : [
28
27
  {
29
28
  "$ref" : "./base_types/base_types.json#definitions/account_id"
@@ -40,8 +39,7 @@
40
39
  ]
41
40
  },
42
41
  "amount" : {
43
- "$ref" : "./base_types/base_types.json#definitions/amount",
44
- "required" : true
42
+ "$ref" : "./base_types/base_types.json#definitions/amount"
45
43
  },
46
44
  "currency" : {
47
45
  "$ref" : "./base_types/base_types.json#definitions/currency",
@@ -84,17 +82,17 @@
84
82
  "properties" : {
85
83
  "filter[account_ids]" : {
86
84
  "title" : "Find internal transfers belonging to the given account ids. Single id or multiple ids comma-separated.",
87
- "format" : "date",
85
+ "format" : "date-time",
88
86
  "type" : "string"
89
87
  },
90
88
  "filter[created_at_from]" : {
91
89
  "title" : "Creation date filter from >= date",
92
- "format" : "date",
90
+ "format" : "date-time",
93
91
  "type" : "string"
94
92
  },
95
93
  "filter[created_at_to]" : {
96
94
  "title" : "Creation date filter to <= date",
97
- "format" : "date",
95
+ "format" : "date-time",
98
96
  "type" : "string"
99
97
  },
100
98
  "filter[states]" : {
@@ -3,6 +3,7 @@
3
3
  "title" : "Sepa Credit Transfer",
4
4
  "name" : "sepa_credit_transfer",
5
5
  "description" : "A transfer initiates a transaction e.g get / send money. If the transfer fails no transaction is created!",
6
+ "required" : ["account_id", "amount", "external_uid"],
6
7
  "properties" : {
7
8
  "id" : {
8
9
  "$ref" : "./base_types/base_types.json#definitions/id"
@@ -11,8 +12,7 @@
11
12
  "$ref" : "./base_types/base_types.json#definitions/external_uid"
12
13
  },
13
14
  "account_id" : {
14
- "$ref" : "./base_types/base_types.json#definitions/account_id",
15
- "required" : true
15
+ "$ref" : "./base_types/base_types.json#definitions/account_id"
16
16
  },
17
17
  "user_id" : {
18
18
  "$ref" : "./base_types/base_types.json#definitions/user_id"
@@ -25,8 +25,7 @@
25
25
  "maxLength" : 140
26
26
  },
27
27
  "amount" : {
28
- "$ref" : "./base_types/base_types.json#definitions/amount",
29
- "required" : true
28
+ "$ref" : "./base_types/base_types.json#definitions/amount"
30
29
  },
31
30
  "currency" : {
32
31
  "$ref" : "./base_types/base_types.json#definitions/currency",
@@ -72,22 +71,22 @@
72
71
  "href" : "sepa_credit_transfers",
73
72
  "properties" : {
74
73
  "filter[account_ids]" : {
75
- "title" : "Find transfers belonging to the given account ids. Single id or multiple ids comma-separated.",
76
- "format" : "date",
74
+ "description" : "Find transfers belonging to the given account ids. Single id or multiple ids comma-separated.",
75
+ "format" : "date-time",
77
76
  "type" : "string"
78
77
  },
79
78
  "filter[created_at_from]" : {
80
- "title" : "Creation date filter from >= date",
81
- "format" : "date",
79
+ "description" : "Creation date filter from >= date",
80
+ "format" : "date-time",
82
81
  "type" : "string"
83
82
  },
84
83
  "filter[created_at_to]" : {
85
- "title" : "Creation date filter to <= date",
86
- "format" : "date",
84
+ "description" : "Creation date filter to <= date",
85
+ "format" : "date-time",
87
86
  "type" : "string"
88
87
  },
89
88
  "filter[states]" : {
90
- "title" : "Filter by single or multiple csv delimited states",
89
+ "description" : "Filter by single or multiple csv delimited states",
91
90
  "enum" : [
92
91
  "received",
93
92
  "mobile_tan_sent",
@@ -3,6 +3,7 @@
3
3
  "title" : "Sepa Direct Debit",
4
4
  "name" : "sepa_direct_debit",
5
5
  "description" : "A direct debit can only be performed with a valid sepa mandate, authorizing access to the debtor's account.",
6
+ "required" : ["account_id", "mandate_id", "amount", "collection_date", "external_uid"],
6
7
  "properties" : {
7
8
  "id" : {
8
9
  "$ref" : "./base_types/base_types.json#definitions/id"
@@ -11,16 +12,14 @@
11
12
  "$ref" : "./base_types/base_types.json#definitions/external_uid"
12
13
  },
13
14
  "account_id" : {
14
- "$ref" : "./base_types/base_types.json#definitions/account_id",
15
- "required" : true
15
+ "$ref" : "./base_types/base_types.json#definitions/account_id"
16
16
  },
17
17
  "user_id" : {
18
18
  "$ref" : "./base_types/base_types.json#definitions/user_id"
19
19
  },
20
20
  "mandate_id" : {
21
21
  "description" : "The sepa mandate used by the debit",
22
- "type" : "string",
23
- "required" : true
22
+ "type" : "string"
24
23
  },
25
24
  "creditor_identifier" : {
26
25
  "description" : "Creditor Identifier",
@@ -28,8 +27,7 @@
28
27
  "readonly" : true
29
28
  },
30
29
  "amount" : {
31
- "$ref" : "./base_types/base_types.json#definitions/amount",
32
- "required" : true
30
+ "$ref" : "./base_types/base_types.json#definitions/amount"
33
31
  },
34
32
  "currency" : {
35
33
  "$ref" : "./base_types/base_types.json#definitions/currency",
@@ -44,8 +42,7 @@
44
42
  },
45
43
  "collection_date" : {
46
44
  "description" : "Requested date for the debit to be withdrawn from the foreign account.",
47
- "format" : "date",
48
- "required" : true,
45
+ "format" : "date-time",
49
46
  "type" : "string"
50
47
  },
51
48
  "state" : {
@@ -77,17 +74,17 @@
77
74
  "properties" : {
78
75
  "filter[account_ids]" : {
79
76
  "title" : "Find direct debits belonging to the given account ids. Single id or multiple ids comma-separated.",
80
- "format" : "date",
77
+ "format" : "date-time",
81
78
  "type" : "string"
82
79
  },
83
80
  "filter[created_at_from]" : {
84
81
  "title" : "Creation date filter from >= date",
85
- "format" : "date",
82
+ "format" : "date-time",
86
83
  "type" : "string"
87
84
  },
88
85
  "filter[created_at_to]" : {
89
86
  "title" : "Creation date filter to <= date",
90
- "format" : "date",
87
+ "format" : "date-time",
91
88
  "type" : "string"
92
89
  },
93
90
  "filter[states]" : {
@@ -3,18 +3,19 @@
3
3
  "title" : "Sepa Mandate",
4
4
  "name" : "sepa_mandate",
5
5
  "description" : "A mandate object authorizing debits from an account.",
6
+ "required" : ["external_uid", "customer_id", "mandate_reference", "remote_title", "remote_name", "remote_email",
7
+ "remote_address_line1", "remote_address_line2", "remote_country", "remote_iban", "remote_bic",
8
+ "signature_date" ],
6
9
  "properties" : {
7
10
  "id" : {
8
11
  "$ref" : "./base_types/base_types.json#definitions/id"
9
12
  },
10
13
  "external_uid" : {
11
- "$ref" : "./base_types/base_types.json#definitions/external_uid",
12
- "required" : true
14
+ "$ref" : "./base_types/base_types.json#definitions/external_uid"
13
15
  },
14
16
  "customer_id" : {
15
17
  "description" : "Customer for which this mandate is valid.",
16
- "type" : "string",
17
- "required" : true
18
+ "type" : "string"
18
19
  },
19
20
  "user_id" : {
20
21
  "$ref" : "./base_types/base_types.json#definitions/user_id"
@@ -22,7 +23,6 @@
22
23
  "mandate_reference" : {
23
24
  "description" : "Unique reference of the mandate.",
24
25
  "type" : "string",
25
- "required" : true,
26
26
  "maxLength" : 35
27
27
  },
28
28
  "sequence" : {
@@ -46,46 +46,38 @@
46
46
  "remote_title" : {
47
47
  "description" : "Title of the debtor e.g Dr. Prof.",
48
48
  "type" : "string",
49
- "required" : true,
50
49
  "maxLength" : 35
51
50
  },
52
51
  "remote_name" : {
53
52
  "description" : "Full name of debtor",
54
53
  "type" : "string",
55
- "required" : true,
56
54
  "maxLength" : 70
57
55
  },
58
56
  "remote_email" : {
59
57
  "description" : "Debtor's email",
60
58
  "type" : "string",
61
- "required" : true,
62
59
  "maxLength" : 70
63
60
  },
64
61
  "remote_address_line1" : {
65
62
  "description" : "Address street.",
66
63
  "type" : "string",
67
- "required" : true,
68
64
  "maxLength" : 35
69
65
  },
70
66
  "remote_address_line2" : {
71
67
  "description" : "ZIP and City",
72
68
  "type" : "string",
73
- "required" : true,
74
69
  "maxLength" : 70
75
70
  },
76
71
  "remote_country" : {
77
72
  "description" : "2 digit country code, ISO 3166",
78
73
  "type" : "string",
79
- "required" : true,
80
74
  "maxLength" : 2
81
75
  },
82
76
  "remote_iban" : {
83
- "$ref" : "./base_types/base_types.json#definitions/iban",
84
- "required" : true
77
+ "$ref" : "./base_types/base_types.json#definitions/iban"
85
78
  },
86
79
  "remote_bic" : {
87
- "$ref" : "./base_types/base_types.json#definitions/bic",
88
- "required" : true
80
+ "$ref" : "./base_types/base_types.json#definitions/bic"
89
81
  },
90
82
  "remote_ultimate_name" : {
91
83
  "description" : "Ultimate name",
@@ -99,14 +91,19 @@
99
91
  },
100
92
  "signature_date" : {
101
93
  "description" : "Date the mandate was signed of by the debtor.",
102
- "format" : "date",
103
- "required" : true,
94
+ "format" : "date-time",
104
95
  "type" : "string"
105
96
  },
106
97
  "valid_from_date" : {
107
98
  "description" : "Date the mandate started to be valid.",
108
- "format" : "date",
99
+ "format" : "date-time",
109
100
  "type" : "string"
101
+ },
102
+ "created_at" : {
103
+ "$ref" : "./base_types/base_types.json#definitions/created_at"
104
+ },
105
+ "updated_at" : {
106
+ "$ref" : "./base_types/base_types.json#definitions/updated_at"
110
107
  }
111
108
  },
112
109
  "links" : [
@@ -118,14 +115,14 @@
118
115
  "rel" : "instances",
119
116
  "href" : "sepa_mandates",
120
117
  "properties" : {
121
- "filter[mandate_reference]" : {
118
+ "filter[mandate_references]" : {
122
119
  "title" : "Search",
123
- "description" : "Search by mandate reference",
120
+ "description" : "Search by mandate reference, add multiple comma separated",
124
121
  "type" : "string"
125
122
  },
126
- "filter[remote_iban]" : {
123
+ "filter[remote_ibans]" : {
127
124
  "title" : "Search",
128
- "description" : "Search by remote iban",
125
+ "description" : "Search by remote iban, add multiple comma separated",
129
126
  "type" : "string"
130
127
  },
131
128
  "page" : {
@@ -61,13 +61,13 @@
61
61
  },
62
62
  "booking_date" : {
63
63
  "description" : "Date the transaction was booked. ISO 8601 Date",
64
- "format" : "date",
64
+ "format" : "date-time",
65
65
  "readonly" : true,
66
66
  "type" : "string"
67
67
  },
68
68
  "value_date" : {
69
69
  "description" : "Date the amount was credited to the account. ISO 8601 Date",
70
- "format" : "date",
70
+ "format" : "date-time",
71
71
  "readonly" : true,
72
72
  "type" : "string"
73
73
  },
@@ -99,7 +99,7 @@
99
99
  "properties" : {
100
100
  "filter[account_ids]" : {
101
101
  "title" : "Find transactions belonging to the given account ids. Single id or multiple ids comma-separated.",
102
- "format" : "date",
102
+ "format" : "date-time",
103
103
  "type" : "string"
104
104
  },
105
105
  "filter[id_from]" : {
@@ -114,12 +114,12 @@
114
114
  },
115
115
  "filter[booking_date_from]" : {
116
116
  "title" : "Date filter from >= date. ISO 8601 Date",
117
- "format" : "date",
117
+ "format" : "date-time",
118
118
  "type" : "string"
119
119
  },
120
120
  "filter[booking_date_to]" : {
121
121
  "title" : "Date filter to <= date. ISO 8601 Date",
122
- "format" : "date",
122
+ "format" : "date-time",
123
123
  "type" : "string"
124
124
  },
125
125
  "filter[transaction_types]" : {
@@ -3,13 +3,13 @@
3
3
  "title" : "User",
4
4
  "name" : "user",
5
5
  "description" : "",
6
+ "required" : ["email"],
6
7
  "properties" : {
7
8
  "id" : {
8
9
  "$ref" : "./base_types/base_types.json#definitions/id"
9
10
  },
10
11
  "email" : {
11
12
  "$ref" : "./base_types/base_types.json#definitions/email",
12
- "required" : true,
13
13
  "readonly" : true
14
14
  },
15
15
  "last_sign_in_at" : {
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.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Leciejewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-23 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -111,6 +111,8 @@ files:
111
111
  - lib/fidor/schema.rb
112
112
  - lib/fidor_schema.rb
113
113
  - lib/fidor_schema_version.rb
114
+ - lib/validate/schema.json
115
+ - lib/validate/validate.rb
114
116
  - schema/v1.0/account.json
115
117
  - schema/v1.0/base_types/base_types.json
116
118
  - schema/v1.0/base_types/lists.json