flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

Implement fix for issue 6183

Open khvn26 opened this issue 4 months ago • 5 comments

Thanks for submitting a PR! Please check the boxes below:

  • [ ] I have added information to docs/ if required so people know about the feature!
  • [x] I have filled in the "Changes" section below?
  • [x] I have filled in the "How did you test this code" section below?
  • [x] I have used a Conventional Commit title for this Pull Request

Changes

This PR migrates the API documentation from drf-yasg to drf-spectacular to provide an OpenAPI 3.0 compliant schema, addressing issue #6183 and building on PR #6184.

Key changes include:

  • Replaced drf-yasg with drf-spectacular for schema generation and UI.
  • Introduced new schema and docs endpoints while maintaining backward compatibility for existing /swagger.json, /swagger.yaml, and /docs/ paths.
  • Configured drf-spectacular settings, including security schemes and permissions.
  • Updated serializer fields (e.g., EdgeFeatureField) to use drf-spectacular's @extend_schema_field for union types.
  • Fixed an edge case in CreateUpdateEnvironmentSerializer to guard self.instance access.
  • Added drf-spectacular to pyproject.toml.

How did you test this code?

I tested this code manually by:

  1. Accessing the new OpenAPI 3 schema: GET /api/v1/docs/?format=openapi
  2. Verifying the new Swagger UI: GET /api/v1/docs/
  3. Confirming backward compatibility for existing schema endpoints:
    • GET /api/v1/swagger.json
    • GET /api/v1/swagger.yaml
  4. Checking the new dedicated schema endpoint: GET /api/v1/schema/

Open in Cursor Open in Web

khvn26 avatar Oct 21 '25 14:10 khvn26

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch. Learn more about Cursor Agents

cursor[bot] avatar Oct 21 '25 14:10 cursor[bot]

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview Comment Oct 22, 2025 3:39pm
flagsmith-frontend-staging Ready Ready Preview Comment Oct 22, 2025 3:39pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Ignored Ignored Preview Oct 22, 2025 3:39pm

vercel[bot] avatar Oct 21 '25 14:10 vercel[bot]

@cursor make the tests green. Use Cursor's Github app access to view test checks result. If you choose to run the tests yourself, use make test opts='-k <pytest filter>' and make test opts='--lf'. to isolate the test run to failing tests.

khvn26 avatar Oct 22 '25 15:10 khvn26

❌ Unable to add follow-up after multiple attempts. The agent may be experiencing issues.

Please try again later or check the agent status.


Open in Cursor Open in Web

Learn more about Cursor Agents

cursor[bot] avatar Oct 22 '25 15:10 cursor[bot]

Okay, Cursor's background agent is unresponsive now. I want to keep this work in a background agent, so we might hold this off until we start trying Claude Code out. CC @matthewelwell

khvn26 avatar Oct 22 '25 16:10 khvn26