Skip to content

Conversation

lunkwill42
Copy link
Member

@lunkwill42 lunkwill42 commented May 20, 2025

When the NAV API first began, it did automatically provide an OpenAPI schema, courtesy of Django REST Framework (DRF). However, at some point, DRF removed this functionality and it was unintentionally lost from NAV because we never noticed.

This PR tries to add back in an OpenAPI schema (and a swagger-ui schema browser) using drf-spectacular. I'm leaving it as a draft so we can test and discuss what this should look like.

Sticking the nonews label on it while in draft-mode, since I don't know what to write in a news fragment until this feature has taken its final shape.

For OpenAPI schema generation.
@lunkwill42 lunkwill42 self-assigned this May 20, 2025
@lunkwill42 lunkwill42 added nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) api documentation Related to documentation of NAV labels May 20, 2025
@lunkwill42 lunkwill42 force-pushed the feature/openapi-schema branch from 8c22277 to aab16fd Compare May 20, 2025 10:55
@lunkwill42 lunkwill42 requested a review from a team May 20, 2025 10:57
Copy link

github-actions bot commented May 20, 2025

Test results

   12 files     12 suites   11m 43s ⏱️
2 194 tests 2 194 ✅ 0 💤 0 ❌
6 057 runs  6 057 ✅ 0 💤 0 ❌

Results for commit 494fb75.

♻️ This comment has been updated with latest results.

@lunkwill42 lunkwill42 force-pushed the feature/openapi-schema branch from aab16fd to 494fb75 Compare May 20, 2025 11:06
Copy link

@lunkwill42
Copy link
Member Author

lunkwill42 commented May 20, 2025

I really don't think the OpenAPI output is up-to-snuff - but this may simply be because our DRF API definitions are pretty screwed up.

I tried generating a Python API client (using openapi-python-client) from the spec produced by this PR, and it was pretty wonky and non-functional, making references to things that don't exist in our schema.

@lunkwill42 lunkwill42 requested a review from hmpf June 20, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api documentation Related to documentation of NAV nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant