-
Notifications
You must be signed in to change notification settings - Fork 469
feat: synchronize-openapi-schema-with-gram #6499
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
Merged
+869
−82
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
be43ede
feat: added-mcp-filtered-tag-openapi-schema-generation
Zaimwa9 893ee8b
feat: added-iso-endpoints-to-current-gram
Zaimwa9 c887686
feat: added-list-environment-endpoint
Zaimwa9 8347c94
feat: try-ci-locally
Zaimwa9 25a58df
feat: removed-useless-comments
Zaimwa9 6d2deac
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8e1a64d
feat: install-with-no-root
Zaimwa9 46efa8e
Merge branch 'feat/synchronize-openapi-schema-with-gram' of github.co…
Zaimwa9 7b0ecb4
feat: use-make-install
Zaimwa9 b5fc717
feat: changed-install-gram-step
Zaimwa9 fab2768
feat: added-gram-org
Zaimwa9 c3b8f97
feat: moved-gram-push-to-deploy-workflow
Zaimwa9 c27833e
add-permissions-read-to-gram-step
Zaimwa9 e58ea58
feat: finetuning-open-api-generation
Zaimwa9 9d2351a
feat: integrate-security-scheme-and-missing-endpoints
Zaimwa9 47b03de
feat: bumped-workflows-and-private
Zaimwa9 52c002f
feat: bumped-workflows-and-private
Zaimwa9 444a4fa
feat: moved-to-using-x-gram
Zaimwa9 ce1244d
feat: added-gram-push-to-pr-workflow
Zaimwa9 b3c5467
feat: added-permission-checks
Zaimwa9 8c4c7fd
feat: trigger-pipeline
Zaimwa9 71a4800
feat: fixed-conflicts
Zaimwa9 890cfb9
feat: re-added-job
Zaimwa9 1f89181
feat: resynced-lock
Zaimwa9 6ccc3c4
feat: re-added-private-module
Zaimwa9 4d2fb11
feat: cleanup-site-packagers
Zaimwa9 1d312be
feat: bumped-private-modules-versions
Zaimwa9 80ce3ce
feat: check-auth-prefix
Zaimwa9 a7188b6
feat: fixed-mypy
Zaimwa9 3c1fd00
feat: removed-dot
Zaimwa9 27bd651
feat: removed-gram-on-platform-pull-request
Zaimwa9 4cbf4d5
feat: clean-site-packages-before-mv
Zaimwa9 75b803e
feat: codecov-patch
Zaimwa9 f2594e4
feat: removed-unused-content-disposition
Zaimwa9 3b09ca2
feat: addressed-review-comments
Zaimwa9 442821d
feat: rebased-main
Zaimwa9 a01905b
feat: reverted-site-packages-clean-up
Zaimwa9 ecdfb84
feat: fixed-lock
Zaimwa9 16335c9
Merge branch 'main' of github.com:Flagsmith/flagsmith into feat/synch…
Zaimwa9 e06d217
feat: moved-project-and-org-to-vars
Zaimwa9 4b148b1
feat: wrapped-init-in-type-checking
Zaimwa9 a133b58
feat: copy-dictionary-instead-of-mutating
Zaimwa9 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
Some comments aren't visible on the classic Files Changed page.
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
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
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
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,37 @@ | ||
| from typing import Any | ||
|
|
||
| from drf_spectacular.views import SpectacularJSONAPIView, SpectacularYAMLAPIView | ||
| from rest_framework.request import Request | ||
| from rest_framework.response import Response | ||
|
|
||
| from api.openapi import MCPSchemaGenerator, SchemaGenerator | ||
|
|
||
|
|
||
| class _MCPSchemaViewMixin: | ||
| """ | ||
| Mixin that provides MCP schema generator selection based on ?mcp=true query parameter. | ||
| """ | ||
|
|
||
| def get_generator_class(self) -> type: | ||
| try: | ||
| if self.request.query_params["mcp"].lower() == "true": # type: ignore[attr-defined] | ||
| return MCPSchemaGenerator | ||
| except (AttributeError, KeyError): | ||
| pass | ||
| return SchemaGenerator | ||
|
|
||
| def get(self, request: Request, *args: Any, **kwargs: Any) -> Response: | ||
| self.generator_class = self.get_generator_class() | ||
| return super().get(request, *args, **kwargs) # type: ignore[misc, no-any-return] | ||
|
|
||
|
|
||
| class CustomSpectacularJSONAPIView(_MCPSchemaViewMixin, SpectacularJSONAPIView): | ||
| """ | ||
| JSON schema view that supports ?mcp=true query parameter for MCP-filtered output. | ||
| """ | ||
|
|
||
|
|
||
| class CustomSpectacularYAMLAPIView(_MCPSchemaViewMixin, SpectacularYAMLAPIView): | ||
| """ | ||
| YAML schema view that supports ?mcp=true query parameter for MCP-filtered output. | ||
| """ |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.