feat: replace django-rest-swagger with drf-spectacular #1248
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.
copied from #1050, rebased onto
2.3.0 > dependency-updates > drf-spectacular
Description
Duplicate of PR: #1050
Related issue: #698
Tasks
drf-spectacular
warnings to be fixed1.
/rdmo/conditions/
Serializers:
serializers/v1.py
ConditionViewSet > ConditionSerializer
: Unable to resolve type hint for functionget_model
. Consider using a type hint or@extend_schema_field
. Defaulting to string.Viewsets:
viewsets.py
ConditionViewSet
: Could not derive type of path parameter"var"
because modelrdmo.conditions.models.Condition
contained no such field. Consider annotating parameter with@extend_schema
. Defaulting to"string"
.2.
/rdmo/core/
Serializers:
serializers.py
RelationViewSet > ChoicesSerializer
: Unable to resolve type hint for functionsget_id
andget_text
.GroupViewSet > GroupSerializer
: Identical component names"Group"
found inrdmo.core.serializers.GroupSerializer
andrdmo.accounts.serializers.v1.GroupSerializer
. Consider renaming one.SitesViewSet > SiteSerializer
: Identical component names"Site"
found inrdmo.core.serializers.SiteSerializer
andrdmo.accounts.serializers.v1.SiteSerializer
. Consider renaming one.Viewsets:
viewsets.py
SettingsViewSet
: Exception raised while getting serializer. Ensureget_serializer_class()
is not returningNone
andget_queryset()
works.TemplatesViewSet
: Similar issue as above.3.
/rdmo/domain/
Serializers:
serializers/v1.py
AttributeViewSet > AttributeListSerializer
: Unable to resolve type hints forget_model
andis_leaf_node
.AttributeViewSet > AttributeSerializer
: Unable to resolve type hints forget_model
,get_tasks
, andget_attributes
.Viewsets:
viewsets.py
AttributeViewSet
: Could not derive type of path parameter"var"
due to missing field inrdmo.domain.models.Attribute
.4.
/rdmo/management/
Viewsets:
viewsets.py
ImportViewSet
,MetaViewSet
,UploadViewSet
: Unable to guess serializer. Consider usingGenericAPIView
or explicitly addingserializer_class
.5.
/rdmo/options/
Serializers:
serializers/v1/option.py
OptionViewSet > OptionSerializer
: Unable to resolve type hints forget_model
,text
,help
,view_text
,label
, andget_warning
.Serializers:
serializers/v1/optionset.py
OptionSetViewSet > OptionSetSerializer
: Unable to resolve type hints forget_model
andget_condition_uris
.Viewsets:
viewsets.py
OptionViewSet
,OptionSetViewSet
: Path parameter"var"
could not be derived due to missing fields inrdmo.options.models.Option
andrdmo.options.models.OptionSet
.6.
/rdmo/projects/
Serializers:
serializers/v1/__init__.py
MembershipViewSet > MembershipSerializer
: Identical component names"Membership"
found inrdmo.projects.serializers.v1.MembershipSerializer
andrdmo.accounts.serializers.v1.MembershipSerializer
. Consider renaming one.ProjectViewSet > ProjectSerializer
: Unable to resolve type hint forcatalog_uri
.ProjectViewSet > ProjectSerializer > UserSerializer
: Identical component names"User"
found inrdmo.projects.serializers.v1.UserSerializer
andrdmo.accounts.serializers.v1.UserSerializer
. Consider renaming one.Viewsets:
viewsets.py
MembershipViewSet
: Failed to obtain model due to missingqueryset
. Fix by settingqueryset = Model.objects.none()
or using@extend_schema
.7.
/rdmo/questions/
Serializers:
serializers/v1/catalog.py
CatalogViewSet > CatalogSerializer
: Identical component names"Catalog"
found inrdmo.questions.serializers.v1.catalog.CatalogSerializer
andrdmo.projects.serializers.v1.overview.CatalogSerializer
. Consider renaming one.get_model
,title
,help
, andget_warning
.Viewsets:
viewsets.py
CatalogViewSet
,PageViewSet
,QuestionViewSet
,QuestionSetViewSet
,SectionViewSet
: Path parameter"var"
could not be derived due to missing fields.8.
/rdmo/tasks/
Serializers:
serializers/v1.py
TaskViewSet > TaskSerializer
: Unable to resolve type hints forget_model
,title
,text
,get_warning
, andget_condition_uris
.Viewsets:
viewsets.py
TaskViewSet
: Path parameter"var"
could not be derived due to missing field.9.
/rdmo/views/
Serializers:
serializers/v1.py
ViewViewSet > ViewSerializer
: Unable to resolve type hints forget_model
,title
,help
, andget_warning
.Viewsets:
viewsets.py
ViewViewSet
: Path parameter"var"
could not be derived due to missing field.10. General API Operation ID Collisions
conditions_conditions_export_retrieve
domain_attributes_export_retrieve
options_options_export_retrieve
options_optionsets_export_retrieve
questions_catalogs_export_retrieve
questions_pages_export_retrieve
questions_questions_export_retrieve
questions_questionsets_export_retrieve
questions_sections_export_retrieve
tasks_tasks_export_retrieve
views_views_export_retrieve
Types of Changes
Mix between bug fix (deprecated library is replaced), new feature (schema is enhanced) and maybe breaking change (schema is different from before).
Checklist
Refs