OpenAPI: duplicated tags when both Router(tags=...) and @modify(tags=...) set the same tag

#1656 · open · 4 comments

View on GitHub ↗

Izcarmt95

When an operation has a tag in `@modify(tags=...)` and its `Router` has the same tag in `Router(tags=...)`, the generated OpenAPI operation lists the tag twice. UIs like Scalar then show every operation twice, once per tag entry. ```python from dmr import Controller, modify from dmr.openapi import build_schema from dmr.plugins.pydantic import PydanticSerializer from dmr.routing import Router, path class UserController(Controller[PydanticSerializer]): @modify(tags=['Users']) def get(self) -> str: return 'ok' users = Router('/users', [path('/all', UserController.as_view(), name='users')], tags=['Users']) api = Router('api') api.include(users, namespace='users') schema = build_schema(api) print(schema.paths['/api/users/all'].get.tags) # ['Users', 'Users'] ``` Expected: `['Users']`. The router tags and the endpoint tags should be merged without duplicates. This looks related to the change for #1299, which now propagates router metadata to included routes. - django-modern-rest 0.15.0 - Django 5.2, Python 3.13 --- _AI disclaimer: an AI assistant was used only to help write this issue._

Comments

nightcityblade

Hi, I'd like to work on this. I'll submit a focused PR with regression coverage shortly.

sobolevn

Please, go ahead :) I plan to make a release tomorrow, so I kindly ask you to fix it before the release date 🙏

nightcityblade

Update: current master changed tag resolution in #1660 so explicit endpoint tags now override router tags, and the duplicate no longer reproduces. I’m releasing this issue rather than submitting a redundant PR.

sobolevn

Can you please submit a test case for this? :)