model_driven_api 3.1.11 → 3.1.13
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 +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: b823fbfec58e3d2ed3fcfab93a4d1efbf71216d7f812f219a11f2f71842df4f5
|
4
|
+
data.tar.gz: f991ce102699d8b91e85ea996520bed2b1693a13b533a0971fed3f899b53fa44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fc75f3100b4021899d76b77c52210418ae0f832f97732d0edb8c53a037130394f025469f99d1bfba5943a3073c2d14b26858725d3828bcd44855e84804ad330
|
7
|
+
data.tar.gz: bf00ba029b9f15f73465ee1ab9aa59cffc6296f8b45392defd4d7b330498c2c4cae0c89007bbffc0114a95dc0a97cefc7643f56c42494f2c37fdd8c72f33ffbf
|
@@ -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.13
|
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-
|
11
|
+
date: 2024-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_backend_commons
|