-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Prepare FastAPI route for quotas #11315
Prepare FastAPI route for quotas #11315
Conversation
39569a7
to
27dbfd2
Compare
What do you think would be the correct course of action here?
|
2648e28
to
a0e7be2
Compare
We still need this if an endpoint returns a union of something and the client needs to know what it is dealing with. A common example is the history endpoint that returns either
I think that's a case-by-case decision to take. If we do change this we may also have to update whatever frontend component consumes this, and depending on the context (is this likely something external scripts are consuming ?) we would need to provide a route for these legacy consumers (i.e we could add a parameter that controls the response model). |
a0e7be2
to
c0e0ca7
Compare
aa6249f
to
8fcefe0
Compare
8c5cf3d
to
1825a6d
Compare
|
- AdminActions, UsesQuotaMixin and QuotaParamParser logic moved to QuotaManager
- Add some type hints - Use fstrings - Remove unused parameters
Currently is used only for Quotas so moving it to the manager
I assumed the user.id must be encoded in the response. This affects the api/whoami in configuration.py which is the also using schema.UserModel
2fbe1bd
to
81be6ff
Compare
The util.Params object was causing problems with the pydantic deserialization.
Thank you - this looks really, really nice - sorry for the delay in reviewing it. |
Cool @davelopez congrats! Thanks @jmchilton for reviewing! |
No worries and many thanks @jmchilton! |
Broken in galaxyproject#11315 Results in the following failure in BioBlend tests: ``` ______________________ TestGalaxyQuotas.test_create_quota ______________________ self = <bioblend._tests.TestGalaxyQuotas.TestGalaxyQuotas testMethod=test_create_quota> def test_create_quota(self): quota = self.gi.quotas.show_quota(self.quota['id']) self.assertEqual(quota['name'], self.quota_name) > self.assertEqual(quota['bytes'], 107374182400) E AssertionError: '107374182400' != 107374182400 bioblend/_tests/TestGalaxyQuotas.py:26: AssertionError ``` See https://github.com/galaxyproject/bioblend/runs/3593283826
Broken in galaxyproject#11315 Results in the following failure in BioBlend tests: ``` ______________________ TestGalaxyQuotas.test_create_quota ______________________ self = <bioblend._tests.TestGalaxyQuotas.TestGalaxyQuotas testMethod=test_create_quota> def test_create_quota(self): quota = self.gi.quotas.show_quota(self.quota['id']) self.assertEqual(quota['name'], self.quota_name) > self.assertEqual(quota['bytes'], 107374182400) E AssertionError: '107374182400' != 107374182400 bioblend/_tests/TestGalaxyQuotas.py:26: AssertionError ``` See https://github.com/galaxyproject/bioblend/runs/3593283826
Ref #10889
Overview
quotas
API.UserModel
fromlib/galaxy/managers/users.py
tolib/galaxy/schema/schema.py
.model_class
in pydantic models. See additional comments [*].QuotaManager
andQuotasManager
.Additional Comments
model_class
field to indicate the type of entity. After modeling every payload with pydantic models, thismodel_class
field will be redundant? or what is the real purpose of this field?Update
QuotaManager
will be used then (by composition) where needed.QuotaAPIController
to QuotasManager.BaseAPIController.validate_in_users_and_groups
to QuotasManager since it is currently only used by quotas and that way it can be shared by both controllers.api/whoami
in configuration.py which is also using schema.UserModel. Hope these changes are ok @ic4fSorry for the long PR😅