Skip to content
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

Should be resolving some of the issues with v1/v2. #584

Merged
merged 1 commit into from
Oct 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/rdme-openapi.yml
Original file line number Diff line number Diff line change
@@ -20,8 +20,4 @@ jobs:
- name: Run `openapi` command for v1🚀
uses: readmeio/rdme@v8
with:
rdme: openapi openapi-schema-v1.yml --key=${{ secrets.README_API_KEY }} --id=641f6d9e0ffbcd06c0e7343c
- name: Run `openapi` command for v2🚀
uses: readmeio/rdme@v8
with:
rdme: openapi openapi-schema-v2.yml --key=${{ secrets.README_API_KEY }} --id=641f6d9e0ffbcd06c0e7343c
rdme: openapi openapi-schema.yml --key=${{ secrets.README_API_KEY }} --id=641f6d9e0ffbcd06c0e7343c
19 changes: 18 additions & 1 deletion api/views.py
Original file line number Diff line number Diff line change
@@ -3,11 +3,12 @@
from rest_framework import viewsets
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.schemas.openapi import AutoSchema

from api import models
from api import serializers
from api import filters
#from api.schema_generator import CustomSchema



class ManifestViewSet(viewsets.ReadOnlyModelViewSet):
@@ -95,6 +96,7 @@ class DocumentViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of documents.
retrieve: API endpoint for returning a particular document.
"""
schema = AutoSchema(operation_id_base='V1Document')
queryset = models.Document.objects.all().order_by("pk")
serializer_class = serializers.DocumentSerializer
search_fields = ['title', 'desc']
@@ -111,6 +113,7 @@ class SpellViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of spells.
retrieve: API endpoint for returning a particular spell.
"""
schema = AutoSchema(operation_id_base='V1Spell')
queryset = models.Spell.objects.all().order_by("pk")
filterset_class=filters.SpellFilter
serializer_class = serializers.SpellSerializer
@@ -137,6 +140,7 @@ class SpellListViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of spell lists.
retrieve: API endpoint for returning a particular spell list.
"""
schema = AutoSchema(operation_id_base='V1SpellList')
queryset = models.SpellList.objects.all().order_by("pk")
serializer_class = serializers.SpellListSerializer
filterset_class = filters.SpellListFilter
@@ -148,6 +152,7 @@ class MonsterViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of monsters.
retrieve: API endpoint for returning a particular monster.
"""
schema = AutoSchema(operation_id_base='V1Monster')
queryset = models.Monster.objects.all().order_by("pk")
filterset_class = filters.MonsterFilter

@@ -159,6 +164,7 @@ class BackgroundViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of backgrounds.
retrieve: API endpoint for returning a particular background.
"""
schema = AutoSchema(operation_id_base='V1Background')
queryset = models.Background.objects.all().order_by("pk")
serializer_class = serializers.BackgroundSerializer
ordering_fields = '__all__'
@@ -172,6 +178,7 @@ class PlaneViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of planes.
retrieve: API endpoint for returning a particular plane.
"""
schema = AutoSchema(operation_id_base='V1Plane')
queryset = models.Plane.objects.all().order_by("pk")
serializer_class = serializers.PlaneSerializer
filterset_class = filters.PlaneFilter
@@ -183,6 +190,7 @@ class SectionViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of sections.
retrieve: API endpoint for returning a particular section.
"""
schema = AutoSchema(operation_id_base='V1Section')
queryset = models.Section.objects.all().order_by("pk")
serializer_class = serializers.SectionSerializer
ordering_fields = '__all__'
@@ -196,6 +204,7 @@ class FeatViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of feats.
retrieve: API endpoint for returning a particular feat.
"""
schema = AutoSchema(operation_id_base='V1Feat')
queryset = models.Feat.objects.all().order_by("pk")
serializer_class = serializers.FeatSerializer
filterset_class = filters.FeatFilter
@@ -207,6 +216,7 @@ class ConditionViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of conditions.
retrieve: API endpoint for returning a particular condition.
"""
schema = AutoSchema(operation_id_base='V1Condition')
queryset = models.Condition.objects.all().order_by("pk")
serializer_class = serializers.ConditionSerializer
search_fields = ['name', 'desc']
@@ -218,6 +228,7 @@ class RaceViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of races.
retrieve: API endpoint for returning a particular race.
"""
schema = AutoSchema(operation_id_base='V1Race')
queryset = models.Race.objects.all().order_by("pk")
serializer_class = serializers.RaceSerializer
filterset_class = filters.RaceFilter
@@ -230,6 +241,7 @@ class SubraceViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint that allows viewing of Subraces.
retrieve: API endpoint for returning a particular subrace.
"""
schema = AutoSchema(operation_id_base='V1Subrace')
queryset = models.Subrace.objects.all().order_by("pk")
serializer_class = serializers.SubraceSerializer
search_fields = ['name', 'desc']
@@ -244,6 +256,7 @@ class CharClassViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of classes and archetypes.
retrieve: API endpoint for returning a particular class or archetype.
"""
schema = AutoSchema(operation_id_base='V1Class')
queryset = models.CharClass.objects.all().order_by("pk")
serializer_class = serializers.CharClassSerializer
filterset_class = filters.CharClassFilter
@@ -256,6 +269,7 @@ class ArchetypeViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint that allows viewing of Archetypes.
retrieve: API endpoint for returning a particular archetype.
"""
schema = AutoSchema(operation_id_base='V1Archetype')
queryset = models.Archetype.objects.all().order_by("pk")
serializer_class = serializers.ArchetypeSerializer
search_fields = ['name', 'desc']
@@ -270,6 +284,7 @@ class MagicItemViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of magic items.
retrieve: API endpoint for returning a particular magic item.
"""
schema = AutoSchema(operation_id_base='V1MagicItem')
queryset = models.MagicItem.objects.all().order_by("pk")
serializer_class = serializers.MagicItemSerializer
filterset_class = filters.MagicItemFilter
@@ -281,6 +296,7 @@ class WeaponViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of weapons.
retrieve: API endpoint for returning a particular weapon.
"""
schema = AutoSchema(operation_id_base='V1Weapon')
queryset = models.Weapon.objects.all().order_by("pk")
serializer_class = serializers.WeaponSerializer
filterset_class = filters.WeaponFilter
@@ -292,6 +308,7 @@ class ArmorViewSet(viewsets.ReadOnlyModelViewSet):
list: API endpoint for returning a list of armor.
retrieve: API endpoint for returning a particular armor.
"""
schema = AutoSchema(operation_id_base='V1Armor')
queryset = models.Armor.objects.all().order_by("pk")
serializer_class = serializers.ArmorSerializer
filterset_class = filters.ArmorFilter
Loading
Loading