strawberry-graphql/strawberry-django

LSP: warn on `fields="__all__"` and add code action to expose all fields

开放

#558 创建于 2024年6月14日

 (0 条评论) (0 个反应) (0 位负责人)Python (152 个派生)auto 404
enhancementhelp wanted

仓库指标

星标
 (496 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

We don't have an LSP for Strawberry Django, but in case we add one I think this feature would be neat to have.

We allow to use fields="__all__", which might lead to security issues, so the LSP could warn when using that, and also provide a code action that does what __all__ does, but with code

From this:

@strawberry.django.type(models.Flyer, fields="__all__")
class Flyer:
    ...

To this:

@strawberry.django.type(models.Flyer)
class Flyer:
    id: auto
    title: auto

We could also add code action to expose additional fields :)

贡献者指南