OWASP / OWASP/Nest

Refactor MenteeNode to use strawberry-django decorators for consistency

Open
#3,555 2 comments 0 reactions 1 assignee Claimed by @SuyashJain17 View on GitHub
enhancement
Dominant language
Python
Stars
451
Forks
707
Avg merge
22h 59m
Merged PRs (30d)
91

Description

## Is your feature request related to a problem? Please describe.

`MenteeNode` is currently implemented using the base `@strawberry.type` decorator with manually defined fields, while most other GraphQL nodes in the codebase (for example, `RepositoryNode`) use `@strawberry_django.type`. This creates an inconsistency in how Django models are exposed through the GraphQL layer. Additionally, there is an existing TODO in `mentee.py` indicating that this node should be migrated to the strawberry-django decorator for consistency.

## Describe the solution you'd like

Refactor `MenteeNode` to use `@strawberry_django.type(Mentee, ...)` instead of `@strawberry.type`. This would allow leveraging strawberry-django’s automatic field mapping and using `strawberry_django.field` for custom resolvers where needed. The change would align `MenteeNode` with other nodes in the GraphQL API and reduce manual field definitions.

## Describe alternatives you've considered

Keeping the current implementation and continuing to define all fields manually. However, this maintains the existing inconsistency and does not take advantage of the tighter Django integration provided by strawberry-django.

## Are you going to work on implementing this?

- [x] Yes
- [ ] No

## Additional context

The `Mentee` model is a Django model, making it a good candidate for `@strawberry_django.type`. Migrating it would follow an established pattern already used elsewhere in the codebase.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.