model_driven_api 3.1.5 → 3.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/info_controller.rb +9 -7
- data/lib/model_driven_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a72bb6cfea6d9f8e0fd4fff0643ee5f73c4c4434532092bd428c7b048c5f9b0
|
4
|
+
data.tar.gz: 51c3691214427e0aaa6111cf00a9b476fdb4c91861ba1819a227ea859f924a2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af0ddbc93b40f315b170630facacb7357022880e560502c83f4e2f2e5ac4342ffb5eaece4be1e1e591d5f0fa6b0a447b1e49ecbd6f9bf2975ee15c2a4b5c8743
|
7
|
+
data.tar.gz: f6318805dc382e2ce28494a74174d01bd53fb12749151a6ea5b21d4ea610dd23a9a4ac8c3dce09ff241c21202f8c3291694056917024781df012f39ac8e25460
|
@@ -84,12 +84,14 @@ class Api::V2::InfoController < Api::V2::ApplicationController
|
|
84
84
|
method_key.type.to_s
|
85
85
|
end
|
86
86
|
|
87
|
-
def create_properties_from_model(model, dsl)
|
87
|
+
def create_properties_from_model(model, dsl, remove_reserved = false)
|
88
88
|
JSON.parse(model.new.to_json(dsl)).keys.map do |k|
|
89
|
-
# Rails.logger.debug "###################### Model #{model.model_name.human rescue ""} Key #{k}"
|
90
89
|
type = compute_type(model, k)
|
91
|
-
|
92
|
-
|
90
|
+
|
91
|
+
# Remove fields that cannot be created or updated
|
92
|
+
if remove_reserved && %w( id created_at updated_at lock_version).include?(k.to_s)
|
93
|
+
nil
|
94
|
+
elsif type == "method"
|
93
95
|
[k, { "type": "object", "additionalProperties": true }]
|
94
96
|
elsif type == "date"
|
95
97
|
[k, { "type": "string", "format": "date" }]
|
@@ -468,7 +470,7 @@ class Api::V2::InfoController < Api::V2::ApplicationController
|
|
468
470
|
"properties": {
|
469
471
|
"#{model.singularize}": {
|
470
472
|
"type": "object",
|
471
|
-
"properties": create_properties_from_model(d, {})
|
473
|
+
"properties": create_properties_from_model(d, {}, true)
|
472
474
|
}
|
473
475
|
}
|
474
476
|
}
|
@@ -611,7 +613,7 @@ class Api::V2::InfoController < Api::V2::ApplicationController
|
|
611
613
|
"properties": {
|
612
614
|
"#{model.singularize}": {
|
613
615
|
"type": "object",
|
614
|
-
"properties": create_properties_from_model(d, {})
|
616
|
+
"properties": create_properties_from_model(d, {}, true)
|
615
617
|
}
|
616
618
|
}
|
617
619
|
}
|
@@ -660,7 +662,7 @@ class Api::V2::InfoController < Api::V2::ApplicationController
|
|
660
662
|
"properties": {
|
661
663
|
"#{model.singularize}": {
|
662
664
|
"type": "object",
|
663
|
-
"properties": create_properties_from_model(d, {})
|
665
|
+
"properties": create_properties_from_model(d, {}, true)
|
664
666
|
}
|
665
667
|
}
|
666
668
|
}
|