-
-
Notifications
You must be signed in to change notification settings - Fork 146
docs: fix critical code example errors and typos #819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- types.md: Fix wrong model (models.Color -> models.Fruit) for FruitPartialInput - types.md: Fix decorator reference (@strawberry.django.type -> @strawberry_django.type) - fields.md: Fix function name (fields() -> field()) - fields.md: Fix decorator (@strawberry_django.type -> @strawberry.type for non-model type) - filters.md: Fix invalid GraphQL syntax for nested filters - filters.md: Fix parameter name (skip_object_order_method -> skip_object_filter_method) - ordering.md: Fix decorator name (@strawberry_django.ordering_type -> @strawberry_django.order_type) - ordering.md: Fix invalid GraphQL syntax for nested ordering - queries.md: Fix incorrect relay import and connection usage - subscriptions.md: Fix typo (manange.py -> manage.py) - choices-field.md: Fix Python import syntax (import .models -> from . import models)
- Fix wrong example app path (examples/django -> examples/ecommerce_app) - Fix incomplete sentence about descriptions - Fix numbering gap in Next Steps section (was jumping from 11 to 13)
- Add installation instructions - Add Django configuration (AUTHENTICATION_BACKENDS, settings) - Document HasPerm, HasSourcePerm, HasRetvalPerm usage with examples - Document all parameters (with_anonymous, with_superuser, any_perm, fail_silently) - Explain list filtering behavior and performance considerations - Add global vs object permissions section - Add troubleshooting section for common issues - Add links to related documentation
…tion - Add installation and configuration instructions - Document AuthGraphQLProtocolTypeRouter with all parameters - Explain difference from Strawberry's GraphQLProtocolTypeRouter - Add channel layers configuration for Redis and in-memory - Document how to access authenticated user in resolvers - Add production server deployment examples (Daphne, Uvicorn, Hypercorn) - Include advanced custom routing example - Add troubleshooting section for common issues
- Document all auth functions: current_user(), login(), logout(), register() - Add GraphQL usage examples for each function - Explain password validation with AUTH_PASSWORD_VALIDATORS - Document custom user model support - Add optional User | None return type pattern - Show how to access user in resolvers - Document Django Channels support for WebSocket auth - Add session configuration examples - Document error handling patterns
- Document all permission extensions: IsAuthenticated, IsStaff, IsSuperuser, HasPerm, HasSourcePerm, HasRetvalPerm - Add parameter tables with types, defaults, and descriptions - Fix typo: 'is_autenticated' -> 'is_authenticated' - Add examples for combining permissions, custom messages - Document fail_silently behavior and when to use it - Add section on creating custom permission extensions - Document schema directives and how to turn them off - Add list filtering behavior for HasRetvalPerm - Improve overall structure and readability
- Document all DjangoOptimizerExtension parameters in a table - Add prefetch_custom_queryset parameter documentation - Add section on temporarily turning off the optimizer - Add comprehensive troubleshooting section: - Extra queries still occurring - Deferred field errors - Prefetch not working for nested relations - Polymorphic queries issues - Performance debugging tips - Add See Also section with related documentation links
- Document TestClient and AsyncTestClient constructors - Add query() method parameter table - Document Response object structure - Add examples for: - Basic queries - Variables - Mutations - Authentication with login() context manager - Custom headers - File uploads - Expecting errors (assert_no_errors=False) - Async testing - Add pytest-django usage notes - Add section on custom Django client - Add subscription testing reference
- Document full_clean parameter for controlling validation - Add FullCleanOptions with parameter table (exclude, validate_unique, validate_constraints) - Add examples for disabling validation and customizing validation behavior - Explain use cases for customized validation
Reviewer's GuideThis PR significantly expands and corrects the documentation across multiple guides and integrations, fixing broken/incorrect code examples, typos, and API references while adding detailed usage sections for testing, permissions, authentication, Channels, optimizer, validation, and several integrations (federation, GeoDjango, guardian). File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- In the permissions guide, the documented parameters for HasSourcePerm/HasRetvalPerm are described as "same as HasPerm" (including any_perm/with_anonymous/with_superuser), but the earlier API description used an
anyargument for these extensions—please align the parameter names and examples with the actual function signatures to avoid confusion. - In the ordering guide you changed the decorator name from
@strawberry_django.ordering_typeto@strawberry_django.order_type; double-check that this matches the real API, as using the wrong decorator name here will lead to runtime errors for users copying the example.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the permissions guide, the documented parameters for HasSourcePerm/HasRetvalPerm are described as "same as HasPerm" (including any_perm/with_anonymous/with_superuser), but the earlier API description used an `any` argument for these extensions—please align the parameter names and examples with the actual function signatures to avoid confusion.
- In the ordering guide you changed the decorator name from `@strawberry_django.ordering_type` to `@strawberry_django.order_type`; double-check that this matches the real API, as using the wrong decorator name here will lead to runtime errors for users copying the example.
## Individual Comments
### Comment 1
<location> `docs/index.md:143-144` </location>
<code_context>
have model docstrings and help text that aren't user-oriented. But if you're starting clean (or overhauling
existing dosctrings and helptext), setting up the following is super useful for your API users.
-If you don't set these true, you can always provide user-oriented descriptions. See the
</code_context>
<issue_to_address>
**issue (typo):** Fix typos in 'dosctrings' and 'helptext'.
Specifically, change 'dosctrings' to 'docstrings' and 'helptext' to 'help text' so the phrase reads "existing docstrings and help text".
```suggestion
have model docstrings and help text that aren't user-oriented. But if you're starting clean (or overhauling
existing docstrings and help text), setting up the following is super useful for your API users.
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR significantly expands the documentation with comprehensive guides for integrations and features. The PR adds three new integration documentation files (guardian, geodjango, federation) and substantially expands existing guides with detailed examples, troubleshooting sections, and parameter references.
Key Changes
- Added comprehensive documentation for django-guardian, GeoDjango, and Apollo Federation integrations
- Expanded Django Channels integration from a stub to a complete guide with routing examples
- Fixed critical import statement error in choices-field.md
- Added extensive examples and troubleshooting sections to authentication, permissions, optimizer, and unit-testing guides
- Corrected example app paths throughout documentation
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/integrations/guardian.md | New comprehensive guide for object-level permissions with django-guardian |
| docs/integrations/geodjango.md | New guide for GeoDjango spatial field support |
| docs/integrations/federation.md | New guide for Apollo Federation integration |
| docs/integrations/channels.md | Expanded from stub to comprehensive WebSocket/ASGI guide |
| docs/integrations/choices-field.md | Fixed import statement syntax error |
| docs/guide/authentication.md | Expanded with detailed API reference and examples |
| docs/guide/permissions.md | Comprehensive expansion with detailed parameter docs |
| docs/guide/unit-testing.md | Expanded with complete API reference and examples |
| docs/guide/validation.md | Added FullCleanOptions documentation |
| docs/guide/optimizer.md | Added troubleshooting section and extension parameters |
| docs/guide/filters.md | Fixed variable name typo in comment |
| docs/guide/ordering.md | Corrected decorator name and GraphQL syntax |
| docs/guide/queries.md | Updated import statements for relay |
| docs/guide/subscriptions.md | Fixed typo in manage.py command |
| docs/guide/types.md | Fixed model reference and decorator syntax |
| docs/guide/fields.md | Fixed decorator name typo |
| docs/index.md | Fixed example app paths and formatting |
| docs/faq.md | Added troubleshooting entries for common errors |
| docs/README.md | Updated integration list with new entries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #819 +/- ##
=======================================
Coverage 89.69% 89.69%
=======================================
Files 45 45
Lines 4310 4310
=======================================
Hits 3866 3866
Misses 444 444 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- index.md: Fix typos 'dosctrings' -> 'docstrings' and 'helptext' -> 'help text' - guardian.md: Fix recursive method call by using declarative field syntax - queries.md: Fix relay import to use DjangoListConnection (ListConnection not exported)
Vibed more documentation improvements with claude 4.5 opus
Summary by Sourcery
Improve and expand documentation for testing, permissions, authentication, Channels integration, optimization, validation, and various integrations, while fixing typos, broken examples, and incorrect references across the docs.
Documentation: