Open erikwrede opened 1 year ago
Mirroring seems to be much faster, but only works by patching the __class__
attribute to get gql-core's isinstance
checks to work:
#[pymethods]
impl OperationDefinitionNode {
#[getter(__class__)]
pub fn __class__(&self, py: Python<'_>) -> PyResult<PyObject> {
let field_node = py.import("graphql.language.ast")?.getattr("OperationDefinitionNode")?;
Ok(field_node.into())
}
}
After parsing and validation in apollo-rs, we want to convert the AST back to the python format so we don't have to parse the query again to build the pyhton execution context. The conversion should happen as fast as possible to reduce overhead.
Test the following two variants: