@@ -229,7 +229,7 @@ class RfcMetadataSerializer(serializers.ModelSerializer):
229229 status = RfcStatusSerializer (source = "*" )
230230 authors = serializers .SerializerMethodField ()
231231 group = GroupSerializer ()
232- area = AreaSerializer ( source = "group.area" , required = False )
232+ area = serializers . SerializerMethodField ( )
233233 stream = StreamNameSerializer ()
234234 ad = AreaDirectorSerializer (read_only = True , allow_null = True )
235235 group_list_email = serializers .EmailField (source = "group.list_email" , read_only = True )
@@ -287,6 +287,23 @@ def get_authors(self, doc: Document):
287287 many = True ,
288288 ).data
289289
290+ @extend_schema_field (AreaSerializer (required = False ))
291+ def get_area (self , doc : Document ):
292+ """Get area for the RFC
293+
294+ This logic might be better moved to Document or a combination of Document
295+ and Group. The current (2026-02-24) Group.area() method is not strict enough:
296+ it does not limit to WG groups or IETF-stream documents.
297+ """
298+ if doc .stream_id != "ietf" :
299+ return None
300+ if doc .group is None :
301+ return None
302+ parent = doc .group .parent
303+ if parent .type_id == "area" :
304+ return AreaSerializer (parent ).data
305+ return None
306+
290307 @extend_schema_field (DocIdentifierSerializer (many = True ))
291308 def get_identifiers (self , doc : Document ):
292309 identifiers = []
0 commit comments