fix(access): Give the entity Base serializers unique schema component names - #1199
Conversation
|
there are tasks missing from the pr template that specifically state dont delete. those tasks are for the PR reviewer to use as a checklist. please re-add them. Any additional task you require go above them. Also dont forget to enable actions in your fork as the pr is un-meragable withou the tests. PR template
### :books: Summary
<!-- your summary here emojis ref: https://github.com/yodamad/gitlab-emoji -->
### :link: Links / References
<!--
using a list as any links to other references or links as required. if relevant, describe the link/reference
Include any issues or related merge requests. Note: dependent MR's also to be added to "Merge request dependencies"
-->
### :construction_worker: Tasks
- [ ] Add your tasks here if required (delete)
<!-- dont remove tasks below strike through including the checkbox by enclosing in double tidle '~~' -->
- [ ] **Feature Release ONLY** :red_square: [Squash migration files](https://docs.djangoproject.com/en/5.2/topics/migrations/#squashing-migrations) :red_square:
_Multiple migration files created as part of this release are to be sqauashed into a few files as possible so as to limit the number of migrations_
- [ ] :firecracker: Contains breaking-change Any Breaking change(s)?
_Breaking Change must also be notated in the commit that introduces it and in [Conventional Commit Format](https://www.conventionalcommits.org/en/v1.0.0/)._
- [ ] :notebook: Release notes updated
- [ ] :blue_book: Documentation written
_All features to be documented within the correct section(s). Administration, Development and/or User_
- [ ] :checkered_flag: Milestone assigned
- [ ] :gear: :test_tube: [Functional Test(s) Written](https://nofusscomputing.com/projects/centurion_erp/development/testing/)
- [ ] :test_tube: [Unit Test(s) Written](https://nofusscomputing.com/projects/centurion_erp/development/testing/)
_ensure test coverage delta is not less than zero_
- [ ] :page_facing_up: Roadmap updated
|
18eb592 to
85172ac
Compare
|
FYI, Randomly failing CI jobs have been addressed now. So any failing job needs to be rectified. |
Okay, noted, I'll check back on my task |
ffe5bcd to
99d48b6
Compare
Thanks @jon-nfc I've re-added the reviewer task checklist, rebased onto the current feat-next-release (the "require rebase" check now passes), and enabled Actions on my fork. The fork's CI workflow still can't run though it ends in startup_failure. From ci.yaml, the workflow-level env: references org secrets (GITLAB_USERNAME_ROBOT / GITLAB_TOKEN_ROBOT) and the jobs call reusable workflows from other repos (nofusscomputing/action_python|action_docker|action_mkdocs), none of which are available on a contributor's fork so the required Integration/Docker checks never report. How would you like fork contributors to get those checks to pass? Happy to adjust anything on my side. |
|
Thanks for correcting OP.
The reusable workflows are public and are working. If they weren't, you wouldn't see anything. The failing job is here:
I'll fix this in the morning. That job is for syncing to my gitlab org and doesnt need to run on a fork. |
3bdffaa to
488e135
Compare
488e135 to
dd9fe2b
Compare
|
Github reports there's merge conflicts when I attempt to rebase, even though there shouldn't be.... So I cant rebase on your behalf. CI workflows updated now. so you shouldn't have any issues with them running now. |
Okay, I'll check it. I'm at work right now, sir. Sorry about that, and don't worry. |
Don't feel rushed. I understand you have a life. |
Don't worry, I love programming. It's my passion, and I really enjoy contributing to your Centurion project. I'll check it again later. |
c3d4404 to
9f3024b
Compare
… names The Base serializers in entity_company / entity_person / entity_contact had no explicit component_name, so drf-spectacular resolved them to the same "EntityBaseBase" component as access.serializers.entity.BaseSerializer, producing "identical names, different identities" warnings. Suffix the model name to each, matching the existing Model/View serializer naming. ref: nofusscomputing#361
9f3024b to
378c946
Compare
|
Rebased onto the latest The fork |
taking a look now |
Looking at the error, That's required to upload the scan results to the security tab. Shit. looks like I'll need to figure out how to make forks to have their CI triggered by PR and not by push which is what I have now. That's what I get I suppose, I started on gitlab so naturally assumed it would be the same on github. "read the bloody docs jon." What I'll do is merge this anyway. there's nothing major in it. |
| from access.serializers.entity import ( | ||
| BaseSerializer as BaseBaseSerializer, | ||
| ModelSerializer as BaseModelSerializer, | ||
| ) | ||
| from access.serializers.organization import TenantBaseSerializer | ||
|
|
||
|
|
||
|
|
||
| @extend_schema_serializer(component_name = 'CompanyEntityBaseSerializer') | ||
| class BaseSerializer( | ||
| BaseBaseSerializer, | ||
| ): | ||
|
|
||
| pass |
There was a problem hiding this comment.
I was clearly paaying attention here. I've imported the base, just to define another empty base that inherits from the imported base. when i could have just done
from access.serializers.entity import (
BaseSerializer
ModelSerializer as BaseModelSerializer,
)and achieved the same thing. Although not to phased, as the serializers down the track will become meta classes. So these files will eventually be deleted.
📚 Summary
First slice of #361, scoped to the Entity serializer group as suggested by @jon-nfc.
The
BaseSerializerclasses inentity_company,entity_personandentity_contacthad no explicitcomponent_name, so drf-spectacular resolved them to the sameEntityBaseBasecomponent asaccess.serializers.entity.BaseSerializer, producing "identical names, different identities" warnings. Each now carries a model-suffixedcomponent_name(CompanyEntityBaseSerializer,PersonEntityBaseSerializer,ContactEntityBaseSerializer), matching the existingModel/Viewserializer naming in these files.python manage.py spectacular --api-version v2warnings: 71 -> 68 (the threeEntityBaseBasecollisions removed, no new warnings introduced).itam.*/assistance.*serializers.🔗 Links / References
👷 Tasks
spectacularwarnings reduced 71 -> 68, no new warnings introducedFeature Release ONLY 🟥 Squash migration files 🟥Multiple migration files created as part of this release are to be sqauashed into a few files as possible so as to limit the number of migrations
🧨 Contains breaking-change Any Breaking change(s)?
Breaking Change must also be notated in the commit that introduces it and in Conventional Commit Format.
📘 Documentation written
All features to be documented within the correct section(s). Administration, Development and/or User
🏁 Milestone assigned
⚙️ 🧪 Functional Test(s) Written
🧪 Unit Test(s) Written
ensure test coverage delta is not less than zero
📄 Roadmap updated