model_driven_api 3.1.11 → 3.1.12
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 +4 -4
- data/app/controllers/api/v2/info_controller.rb +2 -2
- data/lib/model_driven_api/version.rb +1 -1
- data/lib/non_crud_endpoints.rb +5 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d01d90d7ec2ea3620ce94fe7343c78b4a410b1a36be50727eee2eeeeaeef4c2
|
4
|
+
data.tar.gz: 5dfdd6800dba34d112febcdfc2e292f6c3b499fe8dcb886c24a8506baeb0b9a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a00471f793e5cd7a829ddfedd4c2e947c63a7ecc727900f4b41bf4e6bb336aa19a2fcf504ecd81b3e2b861882924573a94e548592b8e0aae294e070db6a4177
|
7
|
+
data.tar.gz: bb79bf086d32464868aa24ee9508f5f9f14be291bab9ffadd5d7c307ebb3ab83eb7554804db505312464a1aefdd6afbab45a8ada6d3585813a5ec273d2f1ce7b
|
@@ -139,7 +139,7 @@ class Api::V2::InfoController < Api::V2::ApplicationController
|
|
139
139
|
"post": {
|
140
140
|
"summary": "Authenticate",
|
141
141
|
"tags": ["Authentication"],
|
142
|
-
"description": "Authenticate the user and return a JWT token in the header and the current user as body",
|
142
|
+
"description": "Authenticate the user and return a JWT token in the header and the current user as body.",
|
143
143
|
"security": [
|
144
144
|
"basicAuth": []
|
145
145
|
],
|
@@ -414,7 +414,7 @@ class Api::V2::InfoController < Api::V2::ApplicationController
|
|
414
414
|
"/info/swagger": {
|
415
415
|
"get": {
|
416
416
|
"summary": "Swagger",
|
417
|
-
"description": "Returns the Swagger",
|
417
|
+
"description": "Returns the self generated Swagger for all the models in the App.",
|
418
418
|
"tags": ["Info"],
|
419
419
|
"responses": {
|
420
420
|
"200": {
|
data/lib/non_crud_endpoints.rb
CHANGED
@@ -16,22 +16,11 @@ class NonCrudEndpoints
|
|
16
16
|
def validate_request(params)
|
17
17
|
# If there is no definition, return
|
18
18
|
return if @definition.blank?
|
19
|
-
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
# raise EndpointValidationError, "The verb \"#{params[:request_verb].presence || "No Verb Provided"}\" is not present in #{definition.keys.join(", ")}." if definition.keys.exclude? params[:request_verb]
|
25
|
-
# # Raise an exception if the verb is put or post and the body keys in definition are not all present as params keys, both params and definition[:body] can have nested objects
|
26
|
-
# raise EndpointValidationError, "The request body does not match the definition: in #{params[:request_verb]} requests all of the params must be present in definition. The body definition is #{definition[:body]}." if params[:request_verb] != "GET" && (body_mandatory_keys & params.keys) != body_mandatory_keys
|
27
|
-
# # Raise an exception if the verb is put or post and the body keys in definition are not all present as params keys, both params and definition[:body] can have nested objects
|
28
|
-
# raise EndpointValidationError, "The request query does not match the definition. The query definition is: #{definition[:query]}." if (query_mandatory_keys & params.keys) != query_mandatory_keys
|
29
|
-
# # Rais if the type of the param is not the same as the definition
|
30
|
-
# definition[:body].each do |k, v|
|
31
|
-
# next if params[k].nil?
|
32
|
-
# computed_type = get_type(params[k])
|
33
|
-
# raise EndpointValidationError, "The type of the param #{k} is not the same as the definition. The definition is #{v[:type]} and the param is #{computed_type}." if v[:type] != computed_type
|
34
|
-
# end
|
19
|
+
|
20
|
+
# Raise a ValidationError if the request does not match the definition of the verbs expected in the @definition hash
|
21
|
+
#raise EndpointValidationError, "The verb \"#{params[:request_verb].presence || "No Verb Provided"}\" is not present in #{@definition.keys.join(", ")}." if @definition.keys.exclude? params[:request_verb]
|
22
|
+
# Assuming @definition follows the openapi schema, we can check the request body and query parameters are correct
|
23
|
+
|
35
24
|
end
|
36
25
|
|
37
26
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: model_driven_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03
|
11
|
+
date: 2024-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_backend_commons
|