Skip to content

Commit

Permalink
Fix gql ser/deser
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbey committed Nov 27, 2024
1 parent 8c91ca4 commit 8654e91
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@

package org.finos.legend.engine.language.graphQL.grammar.integration;

import java.util.List;
import org.eclipse.collections.api.block.function.Function0;
import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.impl.factory.Maps;
import org.finos.legend.engine.protocol.graphQL.metamodel.Document;
import org.finos.legend.engine.protocol.graphQL.metamodel.ExecutableDocument;
import org.finos.legend.engine.protocol.pure.v1.extension.ProtocolSubTypeInfo;
import org.finos.legend.engine.protocol.pure.v1.extension.PureProtocolExtension;

import java.util.Map;
Expand All @@ -29,6 +34,18 @@ public MutableList<String> group()
return org.eclipse.collections.impl.factory.Lists.mutable.with("Query", "GraphQL");
}

@Override
public List<Function0<List<ProtocolSubTypeInfo<?>>>> getExtraProtocolSubTypeInfoCollectors()
{
// during classinstance ser/deser, jackson is not adding the _type of the value
// this leads to deser exceptions
return Lists.fixedSize.with(() -> Lists.fixedSize.with(
ProtocolSubTypeInfo.newBuilder(Document.class)
.withDefaultSubType(ExecutableDocument.class)
.build()
));
}

@Override
public Map<String, Class> getExtraClassInstanceTypeMappings()
{
Expand Down

0 comments on commit 8654e91

Please sign in to comment.