How can I handle a null value in composite federation key?

A composite key is used for the Lesson type in order to pass a lessonPlanId value from service A to service B where service B will use the lessonPlanId to construct and then inject the lessonPlan property into the Lesson type. The problem is that sometimes lessonPlanId is null which casues an error. Ideally in such a case service B would return null for the lessonPlan property (Some annotations below are from spkr)

Service A has a class with @GraphQLType(name = "Lesson") with @Key(fields = "id lessonPlanId") and it is responsible for most Lesson properties.

@GraphQLType(name = "Lesson")
@Key(fields = "id lessonPlanId")
public class LessonExternal extends Lesson {
    @GraphQLNonNull
    public Long getId() {
        return super.getId();
    }

    public Long getLessonPlanId() {
        return Optional.ofNullable(super.getLessonPlanId()).orElse(-1L);
    }
}

Service B has a class with @Extends and @GraphQLType(name = "Lesson") with @Key(fields = "id lessonPlanId") and it injects a property lessonPlan into the Lesson type.

@GraphQLType(name = "Lesson")
@WithResolverBuilder(BeanResolverBuilder.class)
@Getter
@Setter
@ToString
@Extends
@Key(fields = "id lessonPlanId")
@AllArgsConstructor
@NoArgsConstructor
public class LessonExternal {
    @External
    @GraphQLNonNull
    private Long id = -1L;

    @External
    private Long lessonPlanId = -1L;
}

@GraphQLApi
public class GQLImpl {
@GraphQLQuery(name = "lessonPlan", description = "The lesson plan for a lesson")
    public LessonPlan getLessonPlan(@GraphQLContext LessonExternal lessonExternal,
            @GraphQLEnvironment ResolutionEnvironment env) {
        return service.getLessonPlanById(lessonExternal.getLessonPlanId();
    }
}

The key field lessonPlanId is only included in the key because service B needs that value to get the LessonPlan value. The id field of the key is sufficient to uniquely identify the Lesson entity.

The query plan gets the Lesson properties including lessonPlanId from service A and then gets the lessonPlan property from service B.

The problem is that sometimes lessonPlanId is null. Ideally in such a case service B would return null** for the lessonPlan property, but I have not been able to figure out how to handle that case without getting a federation error like Errors: Error: Field "lessonPlanId" was not found in response.

As a work around, Service A is setting lessonPlanId to -1 as a flag value when the actual value is null, and service B returns null if the lessonPlanId value is equal to the flag value of -1. Is there a way allow one of the key fields to be null? Or only use the id field as a key but somehow pass the lessonPlanId from service A to service B? I would like to avoid the hack of using a flag value in the place of the null value.

I am using Apollo Federation version 1 but would consider solutions that use version 2.