Currently in Dart client I have put a condition th...
# contributions
h
Currently in Dart client I have put a condition that there must be at least one field.
k
Technically empty field set in schema should not be allowed, but I won't be surprised if the API does not enforce that now. But don't you think that enforcement is better done at the API level?
h
I tried creating an empty schema, this is what was returned
Copy code
{
  "message": "The `fields` value should be an array of objects containing `name`, `type` and optionally, `facet` properties."
}
k
Glad to know that it works! 😅
I mean, the validation!
h
yeah
But don't you think that enforcement is better done at the API level?
The error messages I've defined take the context of client into consideration. ex,
Ensure Schema.name is set
v/s `Parameter
name
must be a non-empty string.` https://github.com/typesense/typesense-dart/blob/master/lib/src/models/schema.dart#L20 imo, it's better this way.