-
Notifications
You must be signed in to change notification settings - Fork 21
[ENG-8028][ENG-8189] 4.1.5 GV Doc: GV API Contacts -> Swagger API #294
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
cslzchen
merged 13 commits into
CenterForOpenScience:feature/verified-resource-linking
from
opaduchak:feature/ENG-8028
Jul 7, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d020b10
base swagger imp
opaduchak 5fdc139
removed yasg settings
opaduchak 67e1b8a
fixed ssh url
opaduchak d8b9899
fixed filters
opaduchak 51fe7f6
fixed resurse reference and user reference endpoints
opaduchak b831873
added extend_schema descriptions, excluded internal views, fixed some…
opaduchak ac47984
added management command to generate proper openapi spec
opaduchak e35d973
reverted removal of swagger views, added debug switch
opaduchak 313937f
declutter
opaduchak ad3cf36
added generated names for relations
opaduchak a9bc59b
removed openapi.yml
opaduchak 3311a29
pr fixes
opaduchak a6ae60c
fixed filling link dataverse
opaduchak 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
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 |
|---|---|---|
| @@ -1,9 +1,21 @@ | ||
| from drf_spectacular.utils import ( | ||
| extend_schema, | ||
| extend_schema_view, | ||
| ) | ||
|
|
||
| from addon_service.authorized_account.views import AuthorizedAccountViewSet | ||
|
|
||
| from .models import AuthorizedCitationAccount | ||
| from .serializers import AuthorizedCitationAccountSerializer | ||
|
|
||
|
|
||
| @extend_schema_view( | ||
| create=extend_schema( | ||
| description="Create new authorized citation account for given external citation service. " | ||
| 'For OAuth services it\'s required to create account with `"initiate_oauth"=true` ' | ||
| "in order to proceed with OAuth flow" | ||
| ), | ||
| ) | ||
| class AuthorizedCitationAccountViewSet(AuthorizedAccountViewSet): | ||
| queryset = AuthorizedCitationAccount.objects.all() | ||
| serializer_class = AuthorizedCitationAccountSerializer |
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 |
|---|---|---|
| @@ -1,9 +1,21 @@ | ||
| from drf_spectacular.utils import ( | ||
| extend_schema, | ||
| extend_schema_view, | ||
| ) | ||
|
|
||
| from addon_service.authorized_account.views import AuthorizedAccountViewSet | ||
|
|
||
| from .models import AuthorizedComputingAccount | ||
| from .serializers import AuthorizedComputingAccountSerializer | ||
|
|
||
|
|
||
| @extend_schema_view( | ||
| create=extend_schema( | ||
| description="Create new authorized computing account for given external computing service.\n " | ||
| 'For OAuth services it\'s required to create account with `"initiate_oauth"=true` ' | ||
| "in order to proceed with OAuth flow" | ||
| ), | ||
| ) | ||
| class AuthorizedComputingAccountViewSet(AuthorizedAccountViewSet): | ||
| queryset = AuthorizedComputingAccount.objects.all() | ||
| serializer_class = AuthorizedComputingAccountSerializer |
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 |
|---|---|---|
| @@ -1,9 +1,21 @@ | ||
| from drf_spectacular.utils import ( | ||
| extend_schema, | ||
| extend_schema_view, | ||
| ) | ||
|
|
||
| from addon_service.authorized_account.views import AuthorizedAccountViewSet | ||
|
|
||
| from .models import AuthorizedLinkAccount | ||
| from .serializers import AuthorizedLinkAccountSerializer | ||
|
|
||
|
|
||
| @extend_schema_view( | ||
| create=extend_schema( | ||
| description="Create new authorized link account for given external link service.\n " | ||
| 'For OAuth services it\'s required to create account with `"initiate_oauth"=true` ' | ||
| "in order to proceed with OAuth flow" | ||
| ), | ||
| ) | ||
| class AuthorizedLinkAccountViewSet(AuthorizedAccountViewSet): | ||
| queryset = AuthorizedLinkAccount.objects.all() | ||
| serializer_class = AuthorizedLinkAccountSerializer |
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,28 @@ | ||
| from drf_spectacular.extensions import OpenApiFilterExtension | ||
|
|
||
|
|
||
| class RestrictedReadOnlyViewSetExtension(OpenApiFilterExtension): | ||
|
cslzchen marked this conversation as resolved.
|
||
| target_class = "addon_service.common.filtering.RestrictedListEndpointFilterBackend" # full dotted path | ||
|
cslzchen marked this conversation as resolved.
|
||
|
|
||
| def get_schema_operation_parameters(self, auto_schema, *args, **kwargs): | ||
| if auto_schema.method != "GET" or "list" not in auto_schema.view.action: | ||
| return [] | ||
|
|
||
| required_filter_fields = getattr( | ||
| auto_schema.view, "required_list_filter_fields", () | ||
| ) | ||
|
|
||
| parameters = [] | ||
| for field_name in required_filter_fields: | ||
| parameters.append( | ||
| { | ||
| "name": f"filter[{field_name}]", | ||
| "in": "query", # This corresponds to OpenApiParameter.QUERY | ||
| "description": f"Filter by {field_name}. This filter must be uniquely identifying.", | ||
| "required": True, | ||
| "schema": { | ||
| "type": "string" # This corresponds to OpenApiTypes.STR, OpenApiTypes.URI, etc. | ||
| }, | ||
| } | ||
| ) | ||
| return parameters | ||
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 |
|---|---|---|
| @@ -1,9 +1,25 @@ | ||
| from drf_spectacular.utils import ( | ||
| extend_schema, | ||
| extend_schema_view, | ||
| ) | ||
|
|
||
| from addon_service.configured_addon.views import ConfiguredAddonViewSet | ||
|
|
||
| from .models import ConfiguredCitationAddon | ||
| from .serializers import ConfiguredCitationAddonSerializer | ||
|
|
||
|
|
||
| @extend_schema_view( | ||
| create=extend_schema( | ||
| description="Create new configured citation addon for given authorized citation account, linking it to desired project.\n " | ||
| "To configure it properly, you must specify `root_folder` on the provider's side.\n " | ||
| "Note that everything under this folder is going to be accessible to everyone who has access to this project" | ||
| ), | ||
| get=extend_schema( | ||
| description="Get configured citation addon by it's pk. " | ||
| "\nIf you want to fetch all configured citation addons, you should do so through resource_reference related view", | ||
| ), | ||
| ) | ||
| class ConfiguredCitationAddonViewSet(ConfiguredAddonViewSet): | ||
| queryset = ConfiguredCitationAddon.objects.active() | ||
| serializer_class = ConfiguredCitationAddonSerializer |
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
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.
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.