-
Notifications
You must be signed in to change notification settings - Fork 4.3k
[FC-0118] docs: add ADR for api versioning strategy #38304
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
Open
taimoor-ahmed-1
wants to merge
1
commit into
openedx:docs/ADRs-axim_api_improvements
Choose a base branch
from
edly-io:docs/ADR-api_versioning_strategy
base: docs/ADRs-axim_api_improvements
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+83
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| Versioning Strategy — Non-Versioned as Default | ||
| ============================================== | ||
|
|
||
| :Status: Proposed | ||
| :Date: 2026-04-08 | ||
| :Deciders: API Working Group | ||
|
|
||
| Context | ||
| ======= | ||
|
|
||
| Open edX has multiple API versions in parallel (e.g., v0/v1/v3) which creates confusion about which | ||
| version is stable or deprecated and increases the risk that external systems rely on outdated contracts. | ||
|
|
||
| Decision | ||
| ======== | ||
|
|
||
| 1. Treat **non-versioned** endpoints as the default "current stable" API surface where feasible. | ||
| 2. When a breaking change is required: | ||
|
|
||
| * Create a new **versioned** API (e.g., ``/api/foo/v2/``). | ||
| * Replace the non-versioned endpoint to point to the newly versioned implementation so that | ||
| the default remains stable and predictable. | ||
|
|
||
| 3. Publish explicit deprecation policies: | ||
|
|
||
| * Mark old versions as deprecated in schema/docs. | ||
| * Provide migration guides and a removal timeline. | ||
|
|
||
| Relevance in edx-platform | ||
| ========================= | ||
|
|
||
| * **Current mix**: LMS and CMS use both versioned and non-versioned API paths. | ||
| Examples: ``api/enrollment/v1/``, ``api/val/v0/``, ``api/instructor/v1/`` and | ||
| ``v2/``, ``api/user/v1/`` and ``api/user/v2/``, ``api/mfe_config/v1``, | ||
| ``api/course_experience/`` (no version in path), ``api/xblock/v2/``, | ||
| ``api/libraries/v2/`` (see ``lms/urls.py``, ``openedx/core/djangoapps/user_authn/urls_common.py``). | ||
| * **Confusion**: Multiple versions (v0, v1, v2, v3) without a single “default” | ||
| make it unclear which endpoint clients should use. | ||
|
|
||
| Code example (routing pattern) | ||
| ============================= | ||
|
|
||
| **Default (non-versioned) as stable:** | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| # urls.py: default entry point | ||
| urlpatterns = [ | ||
| path("api/courses/", include("course_api.urls")), # current stable | ||
| path("api/courses/v2/", include("course_api.v2.urls")), # new version when breaking | ||
| ] | ||
|
|
||
| **When introducing a breaking change:** | ||
|
|
||
| .. code-block:: text | ||
|
|
||
| 1. Add /api/courses/v2/ with new contract. | ||
| 2. Document v2 in OpenAPI; mark v1 (or old default) as deprecated with removal date. | ||
| 3. Point /api/courses/ to v2 implementation so default stays stable; or keep | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This setence doesn't make sense to me, are we going to have unversion URLs that act as aliases to the latest version of the API? I don't think that's a good idea. |
||
| /api/courses/ as v1 until deprecation period ends. | ||
|
|
||
| Consequences | ||
| ============ | ||
|
|
||
| * Pros | ||
|
|
||
| * Reduces ambiguity for clients and agents selecting an endpoint. | ||
| * Keeps a single “default” entry point stable. | ||
|
|
||
| * Cons / Costs | ||
|
|
||
| * Requires careful routing and doc updates to avoid breaking existing consumers. | ||
|
|
||
| Implementation Notes | ||
| ==================== | ||
|
|
||
| * Ensure OpenAPI clearly flags deprecated versions and identifies the default. | ||
| * Automate "latest" selection in SDK generation based on schema metadata. | ||
|
|
||
| References | ||
| ========== | ||
|
|
||
| * “Versioning confusion / deprecated versions” recommendation in the Open edX REST API standardization notes. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Including filing a DEPR issue and eventually completing the deprecation and dropping the old code.