Skip to content

Commit 207b362

Browse files
committed
fix(content_serdes): don't use uriVariables for validating
This currently a workaround that requires a proper reimplementation.
1 parent d3d2919 commit 207b362

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/src/core/content_serdes.dart

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,19 @@ class ContentSerdes {
140140
}
141141

142142
void _validateValue(Object? value, DataSchema? dataSchema) {
143-
final dataSchemaJson = dataSchema?.rawJson;
144-
if (dataSchemaJson == null) {
143+
// TODO(JKRhb): The process of validating values according to a dataschema
144+
// needs to be reworked.
145+
const filteredKeys = ['uriVariables'];
146+
147+
final filteredDataSchemaJson = dataSchema?.rawJson?.entries
148+
.where((element) => !filteredKeys.contains(element.key));
149+
if (filteredDataSchemaJson == null) {
145150
return;
146151
}
147-
final schema =
148-
JsonSchema.create(dataSchemaJson, schemaVersion: SchemaVersion.draft7);
152+
final schema = JsonSchema.create(
153+
Map.fromEntries(filteredDataSchemaJson),
154+
schemaVersion: SchemaVersion.draft7,
155+
);
149156
if (!schema.validate(value).isValid) {
150157
throw ContentSerdesException('JSON Schema validation failed.');
151158
}

0 commit comments

Comments
 (0)