-
Notifications
You must be signed in to change notification settings - Fork 1
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
API 1 of 3: Refactor Organisation Model #178
Merged
Merged
Conversation
This file contains 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
R2ZER0
force-pushed
the
rg/api-schema-1
branch
2 times, most recently
from
February 1, 2024 17:36
3a83dca
to
6fd4904
Compare
R2ZER0
changed the title
API: Add OpenAPI Schema w/ swagger-ui
API: Refactor Organisation Model
Feb 1, 2024
R2ZER0
changed the title
API: Refactor Organisation Model
API 1 of 3: Refactor Organisation Model
Feb 8, 2024
Move the logic to create an Organisation "fake" model instance from db, out of the view and into the model itsself.
TODO: Perhaps nn future, explicitly handle and return 404, rather than empty list?
In preparation for removing this field from the Model.
R2ZER0
force-pushed
the
rg/api-schema-1
branch
from
February 19, 2024 15:27
6fd4904
to
4c317e3
Compare
michaelwood
reviewed
Feb 20, 2024
datastore/api/experimental/api.py
Outdated
@@ -112,7 +97,7 @@ class OrganisationGrantsMadeView(generics.ListAPIView): | |||
filter_backends = [django_filters.rest_framework.DjangoFilterBackend] | |||
|
|||
def get_queryset(self): | |||
org_id = self.kwargs["org_id"] | |||
org_id = self.kwargs.get("org_id") |
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.
Maybe a quick comment about why you want an empty list if the org_id is None
michaelwood
reviewed
Feb 20, 2024
datastore/api/experimental/api.py
Outdated
).order_by("-getter_run__datetime")[0] | ||
except IndexError: | ||
publisher = None | ||
organisation = api_experimental.Organisation.get( |
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.
At some point we'll need to change this from experimental
drf-spectacular is a library which extends rest framework to generate OpenAPI Schema 3.0, and optionally server a live docs site based on the schema.
Names conflict with dashboard serialisers, drf-spectacular requires serialisers have unique names.
From drf-spectacular
and restrict the schema/swagger-ui to display only public endpoints.
* Move the new Org API into it's own API submodule * Make use of dataclass serializer library
To simplify the API, remove redundant single grant detail view. The other views display all the same data.
Fix a bug in this test missed due toprevious GrantsMadeView behaviour of returning empty list instead of 404.
The OrgDetail view wasn't properly handling object-not-found errors.
Example OrgIDs should start with prefix XE-EXAMPLE
Replace relative imports with absolute imports
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR was originally Part 1 of #175
This PR:
Publisher.getter_run
from the public API