Actually, one more note about the EvidenceRelationship schema. I have further updated the serializer to return two different relationships in a response:
@extend_schema_field(serializers.ChoiceField(choices=EvidenceRelationship.choices))
def get_expert_consensus_relationship(self, obj: Evidence) -> EvidenceRelationship:
return self.get_consensus(obj, expert=True)
@extend_schema_field(serializers.ChoiceField(choices=EvidenceRelationship.choices))
def get_community_consensus_relationship(self, obj: Evidence) -> EvidenceRelationship:
return self.get_consensus(obj, expert=False)
This does work, but it's generating two separate enum types in the spec:
ExpertConsensusRelationshipEnum:
enum:
- PROVES
- SUPPORTS
- UNRELATED
- INCONCLUSIVE
- DISPUTES
- DISPROVES
- SPLIT
type: string
CommunityConsensusRelationshipEnum:
enum:
- PROVES
- SUPPORTS
- UNRELATED
- INCONCLUSIVE
- DISPUTES
- DISPROVES
- SPLIT
type: string
Is there any way to tell drf-spectacular that these are the same enum?
Originally posted by @KunstDerFuge in #68 (comment)
Actually, one more note about the EvidenceRelationship schema. I have further updated the serializer to return two different relationships in a response:
This does work, but it's generating two separate enum types in the spec:
Is there any way to tell drf-spectacular that these are the same enum?
Originally posted by @KunstDerFuge in #68 (comment)