Skip to content

Commit e9f8b7b

Browse files
committed
Allow additionalProperties in jsonapi schema
1 parent 9c36245 commit e9f8b7b

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

lib/jsonapi_parameters/jsonapi_schema.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"$ref": "#/definitions/jsonapi"
5151
}
5252
},
53-
"additionalProperties": false
53+
"additionalProperties": true
5454
},
5555
"failure": {
5656
"type": "object",
@@ -75,7 +75,7 @@
7575
"$ref": "#/definitions/links"
7676
}
7777
},
78-
"additionalProperties": false
78+
"additionalProperties": true
7979
},
8080
"info": {
8181
"type": "object",
@@ -93,7 +93,7 @@
9393
"$ref": "#/definitions/jsonapi"
9494
}
9595
},
96-
"additionalProperties": false
96+
"additionalProperties": true
9797
},
9898

9999
"meta": {
@@ -148,7 +148,7 @@
148148
"$ref": "#/definitions/meta"
149149
}
150150
},
151-
"additionalProperties": false
151+
"additionalProperties": true
152152
},
153153
"relationshipLinks": {
154154
"description": "A resource object **MAY** contain references to other resource objects (\"relationships\"). Relationships may be to-one or to-many. Relationships can be specified by including a member in a resource's links object.",
@@ -213,7 +213,7 @@
213213
{"required": ["type"]}
214214
]
215215
},
216-
"additionalProperties": false
216+
"additionalProperties": true
217217
},
218218

219219
"relationships": {
@@ -251,10 +251,10 @@
251251
{"required": ["type"]}
252252
]
253253
},
254-
"additionalProperties": false
254+
"additionalProperties": true
255255
}
256256
},
257-
"additionalProperties": false
257+
"additionalProperties": true
258258
},
259259
"relationshipToOne": {
260260
"description": "References to other resource objects in a to-one (\"relationship\"). Relationships can be specified by including a member in a resource's links object.",
@@ -297,7 +297,7 @@
297297
"$ref": "#/definitions/meta"
298298
}
299299
},
300-
"additionalProperties": false
300+
"additionalProperties": true
301301
},
302302
"pagination": {
303303
"type": "object",
@@ -344,7 +344,7 @@
344344
"$ref": "#/definitions/meta"
345345
}
346346
},
347-
"additionalProperties": false
347+
"additionalProperties": true
348348
},
349349

350350
"error": {
@@ -390,7 +390,7 @@
390390
"$ref": "#/definitions/meta"
391391
}
392392
},
393-
"additionalProperties": false
393+
"additionalProperties": true
394394
}
395395
}
396396
}

spec/lib/jsonapi_parameters/validator_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,23 @@ class Translator
9191
expect { validator.validate! }.to raise_error(ActiveModel::ValidationError)
9292
end
9393
end
94+
95+
describe 'Rails specific parameters' do
96+
it 'does not yield validation error on :controller, :action, :commit' do
97+
rails_specific_params = [:controller, :action, :commit]
98+
payload = { controller: 'examples_controller', action: 'create', commit: 'Sign up' }
99+
validator = described_class.new(payload)
100+
101+
expect { validator.validate! }.to raise_error(ActiveModel::ValidationError)
102+
103+
begin
104+
validator.validate!
105+
rescue ActiveModel::ValidationError => err
106+
rails_specific_params.each do |param|
107+
expect(err.message).not_to include("Payload path '/#{param}'")
108+
end
109+
end
110+
end
111+
end
94112
end
95113
end

0 commit comments

Comments
 (0)