Skip to content

Conversation

@TheVaan
Copy link
Contributor

@TheVaan TheVaan commented Oct 24, 2025

Problem

Currently, django-ninja is on an old code base with just a few configurations available

Solution

With this PR the sub package gets updated

Checklist

I've gone through the following:

  • I've added an explanation why this change is needed.
  • I've added a changeset (pnpm changeset).
  • I've added tests for the regression or new feature.
  • I've updated the documentation.

Note

Refactors the Django Ninja integration to a ScalarConfig-based API with new enums/options, updated rendering, expanded docs, a test suite, packaging updates, and an example playground.

  • Integration (django-ninja):
    • Replace kwargs-heavy API with typed ScalarConfig model; add OpenAPISource, SearchHotKey, Theme, DocumentDownloadType enums.
    • Rewrite get_scalar_api_reference to consume ScalarConfig and initialize via Scalar.createApiReference(...).
    • Update ScalarViewer to accept config or kwargs (backwards-compatible), defaulting OpenAPI URL.
  • Configuration/Features:
    • Support multiple sources (sources), direct content, document download types, dark mode controls, search hotkeys, auth, servers, layout, theme, and various display toggles.
  • Documentation:
    • Revamp guide with basic/advanced usage and full configuration reference in documentation/integrations/django-ninja.md.
  • Testing:
    • Add comprehensive pytest suite (tests/) covering enums, models, HTML generation, config serialization, and integration with NinjaAPI; add run_tests.py and test requirements.
  • Example Playground:
    • Add minimal Django project under playground/ demonstrating custom theming and endpoints.
  • Packaging:
    • Switch from Poetry to setup.py; add package.json, MANIFEST.in, adjust requirements.txt, and prune tests from package.
  • Release:
    • Add changeset marking a major version for scalar-django-ninja.

Written by Cursor Bugbot for commit 0427e53. This will update automatically on new commits. Configure here.

@changeset-bot
Copy link

changeset-bot bot commented Oct 24, 2025

🦋 Changeset detected

Latest commit: 0427e53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
scalar-django-ninja Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@TheVaan
Copy link
Contributor Author

TheVaan commented Oct 24, 2025

Hey @hanspagel I gave some of the required love to this integration. Documentation, tests and playground are missing for now. I'll spend some time next week (don't have the time this weekend) for this if now one else contributes to this PR.

@TheVaan TheVaan marked this pull request as ready for review October 24, 2025 21:27
@TheVaan
Copy link
Contributor Author

TheVaan commented Oct 24, 2025

Someone already reserved the name scalar-django-ninja for the pypi package. Maybe the publisher @Gpocas could delete his package because it's just a fork of this package.

@hanspagel hanspagel force-pushed the refactor/django-ninja branch from 369ecd7 to 0427e53 Compare November 3, 2025 09:27
@hanspagel
Copy link
Member

Wonderful PR, I didn’t have time to test this, and we can start publish (under whatever name) soon, too.

I haven’t looked at the code, yet, but can you also make sure to use the new HTML/JS API? Looks like that:

<!doctype html>
<html>
  <head>
    <title>Scalar API Reference</title>
    <meta charset="utf-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1" />
  </head>

  <body>
    <div id="app"></div>

    <!-- Load the Script -->
    <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>

    <!-- Initialize the Scalar API Reference -->
    <script>
      Scalar.createApiReference('#app', {
        // The URL of the OpenAPI/Swagger document
        url: 'https://registry.scalar.com/@scalar/apis/galaxy/latest?format=json',
        // Avoid CORS issues
        proxyUrl: 'https://proxy.scalar.com',
      })
    </script>
  </body>
</html>

@hanspagel hanspagel self-assigned this Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants