forest_admin_datasource_toolkit 1.48.0 → 1.49.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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d75a547751178f13b79ca426a8f6ae0a6a9d782e913e2ee7c28448006e72901a
|
|
4
|
+
data.tar.gz: 561bae64042144f2112475b80269f572be36883131c88c6ce1ef0c3941637758
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bb16d85b29ca818f0d7c7146a2f5555218c9275299f6a5e6fbba3d6b82dc3e70c130cac75e2256d85dce34e3cda7b33f4fd40f3121e0e35564809e21dc01898f
|
|
7
|
+
data.tar.gz: dc9ff811041bf06d064b1275603e9ba1e8feef5305ebb215504c778d8573f5210687abe43d0ddbff105b18fb14055a0eefe56c6e7163987d449f49f53c324d5d
|
|
@@ -56,10 +56,11 @@ module ForestAdminDatasourceToolkit
|
|
|
56
56
|
field.origin_key == relation_field.foreign_key
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
+
# ValidationError: an unknown field comes from the request, so it is a 400, not a 500.
|
|
59
60
|
def self.get_field_schema(collection, field_name)
|
|
60
61
|
fields = collection.schema[:fields]
|
|
61
62
|
unless field_name.include?(':')
|
|
62
|
-
raise
|
|
63
|
+
raise ValidationError, "Column not found #{collection.name}.#{field_name}" unless fields.key?(field_name)
|
|
63
64
|
|
|
64
65
|
return fields[field_name]
|
|
65
66
|
end
|
|
@@ -67,10 +68,11 @@ module ForestAdminDatasourceToolkit
|
|
|
67
68
|
association_name = field_name.split(':')[0]
|
|
68
69
|
relation_schema = fields[association_name]
|
|
69
70
|
|
|
70
|
-
raise
|
|
71
|
+
raise ValidationError, "Relation not found #{collection.name}.#{association_name}" unless relation_schema
|
|
71
72
|
|
|
72
73
|
if relation_schema.type != 'ManyToOne' && relation_schema.type != 'OneToOne'
|
|
73
|
-
raise
|
|
74
|
+
raise ValidationError,
|
|
75
|
+
"Unexpected field type #{relation_schema.type}: #{collection.name}.#{association_name}"
|
|
74
76
|
end
|
|
75
77
|
|
|
76
78
|
get_field_schema(
|