SimpleIdServer icon indicating copy to clipboard operation
SimpleIdServer copied to clipboard

Should PatchOperationParameterConverter have an implementation for WriteJson method?

Open omelianlevkovych opened this issue 2 years ago • 4 comments

We have PatchOperationParameterConverter which is used for example in PatchOperationParameter for Patch requests. There is no implementation for the WriteJson method in the PatchOperationParameterConverter. Does it make sense to call the default writer from base JsonConverter or at least throw NotImplementedException?

Because if we want to log the request we will always miss the operation data and it could be not obvious why this is actually happening.

Something similar to this:

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
    writer.WriteValue(value.ToString());
}

omelianlevkovych avatar Jul 19 '23 14:07 omelianlevkovych

First thank you for reporting this issue :) It will be fixed for the next release !

KR,

SID

simpleidserver avatar Jul 19 '23 19:07 simpleidserver

I would like to contribute and create PR if it is possible.

omelianlevkovych avatar Jul 19 '23 20:07 omelianlevkovych

I would be pleased if you could contribute to the project :)

Instead of overriding the WriteJson method, you can make the following changes:

  • Remove the WriteJson procedure.
  • Override the property CanWrite like this: public override bool CanWrite => false.

The same problem exists in the class RepresentationParameterConverter, and you can apply the same changes :)

Please feel free to create a pull request on the branch release/4.0.2.

simpleidserver avatar Jul 19 '23 21:07 simpleidserver

The issue should be fixed in the branch release/4.0.2 :) Changeset : https://github.com/simpleidserver/SimpleIdServer/commit/2ebe23e2d1071881f519920033e132dce1f280e6

simpleidserver avatar Jul 25 '23 19:07 simpleidserver