grpc-node icon indicating copy to clipboard operation
grpc-node copied to clipboard

ServerWritableStreamImpl::end breach the SOLID

Open shatilov-diman opened this issue 4 years ago • 3 comments

It look code at below link is breach Barbara Liskov's substitution principle: https://github.com/grpc/grpc-node/blob/db39ba245c3872e3b5d57a296d744cce63e23bf2/packages/grpc-js/src/server-call.ts#L234

It overrides behaviour of method 'end' https://nodejs.org/api/stream.html#writableendchunk-encoding-callback

shatilov-diman avatar Nov 24 '21 14:11 shatilov-diman

I do not believe it violates that principle. The argument is optional, so that method can be used without the argument as though it is the superclass method. If that does not address your concern can you be more specific about what violation you see?

murgatroid99 avatar Nov 24 '21 16:11 murgatroid99

Unfortunately I've used it with argument like it described here: https://nodejs.org/api/stream.html#writableendchunk-encoding-callback

And I've spent an hour and went through code of grpc-js before I've realized that the method contract was changed and there is no any notes about it in the documentation: https://grpc.github.io/grpc/node/

shatilov-diman avatar Nov 25 '21 18:11 shatilov-diman

You're right, it does override those other arguments.

murgatroid99 avatar Nov 25 '21 19:11 murgatroid99