Skip to content

Could not derive type of path parameter "id" but the path fragment is "pk" ? #194

@eLvErDe

Description

@eLvErDe

Hello,

Could you help me understanding why spectacular says that ?

I have the following code snippets:

group_preference_multi_by_id = SelfGroupMultiPreferenceViewSet.as_view({
    "get": "retrieve",
    "put": "update",
    "delete": "destroy",
})

group_preference_urlpatterns = [
    path(
        "api/preferences/multi/by-group/<path:group>/<path:application>/<path:preference>/<int:pk>/",
        group_preference_multi_by_id,
        name="multi_preferences_by_given_group_by_id",
    ),
]

But the generated OpenAPI route uses "id" instead of "pk" and keep warning me that type could not be infered (and defaults to string while being actually integer).

Thanks in advance,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions