You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: DeSerializeRequest throws NotSupportedException for an unrecognised @type #400
I have verified that I am running the latest version of the SysML2.NET
I have searched open and closed issues to ensure it has not already been reported
Description
When a request body carries an @type that the request family does not define (e.g. "BranchRequest" instead of "Branch"), DeSerializer.DeSerializeRequest<T> / DeSerializeRequestAsync<T> throws NotSupportedException from RequestDeSerializationProvider.Provide:
System.NotSupportedException: The BranchRequest is not supported by the RequestDeSerializationProvider.
at SysML2.NET.Serializer.Json.PSM.RequestDeSerializationProvider.Provide(String typeName)
at SysML2.NET.Serializer.Json.PSM.PsmDeSerializationDispatcher.ReadRequest(...)
at SysML2.NET.Serializer.Json.DeSerializer.ReadFamilyObject[T](...)
Other malformed payloads surface differently: a missing @type gives a SerializationException, an @type of another request type than T gives a JsonException, and invalid JSON gives a JsonException / InvalidOperationException.
NotSupportedException usually signals "valid input the library cannot handle", so callers that map exceptions to responses (e.g. 400 for malformed input, 501 for unsupported features) misreport a client error. None of these exceptions is documented on IDeSerializer.
Expected: an unrecognised @type in an untrusted payload is reported as malformed input, consistently with the other cases — preferably a JsonException naming the unknown discriminator — and the exceptions are documented with <exception> tags on IDeSerializer. The same applies to the response family (ResponseDeSerializationProvider).
Activity
Fix #400
Fix #400 (#402)