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
class PythonServerOperationErrorGenerator(
private val model: Model,
private val symbolProvider: RustSymbolProvider,
private val operation: OperationShape,
- ) : ServerOperationErrorGenerator(model, symbolProvider, symbolProvider.toSymbol(operation), listOf()) {-+ ) {
private val operationIndex = OperationIndex.of(model)
private val errors = operationIndex.getErrors(operation)
Each time we change ServerOperationErrorGenerator we now need to remember to mirror the same changes on PythonServerOperationErrorGenerator which is a rather fragile process and quite likely to be missed.
Unfortunately, we cannot simply extend from ServerOperationErrorGenerator as its render method is not open. How can we make PythonServerOperationErrorGenerator extend from ServerOperationErrorGenerator on a way we could override the required behavior for the Python and TypeScript cases?
The text was updated successfully, but these errors were encountered:
crisidev
changed the title
Restore PythonServerOperationErrorGenerator extending from ServerOperationErrorGenerator
[Python] Restore PythonServerOperationErrorGenerator extending from ServerOperationErrorGenerator
Mar 23, 2023
I think we should make ServerOperationErrorGenerator configurable like we do with the things in codegen-core, and break away from the inheritance to override mentality.
I am of the opposite opinion here. We want to be able to piggy back on as much code as we can from the Rust server implementation for Python and other languages and inheritance seems to me to be filling this gap perfectly.
One thing to consider here is that we don't always need to extend the Rust generators to TypeScript/Python generators if we're leaving the Rust code intact and just adding code. Instead we can extend the shape visitor so that we call extra, completely separate, generators.
As part of the #2336 refactor,
PythonServerOperationErrorGenerator
no longer extends/inherits fromServerOperationErrorGenerator
:Each time we change
ServerOperationErrorGenerator
we now need to remember to mirror the same changes onPythonServerOperationErrorGenerator
which is a rather fragile process and quite likely to be missed.Unfortunately, we cannot simply extend from
ServerOperationErrorGenerator
as itsrender
method is notopen
. How can we makePythonServerOperationErrorGenerator
extend fromServerOperationErrorGenerator
on a way we could override the required behavior for the Python and TypeScript cases?The text was updated successfully, but these errors were encountered: