Skip to content

Commit

Permalink
Merge pull request #585 from open5e/staging
Browse files Browse the repository at this point in the history
Readmedocs  changes.
  • Loading branch information
augustjohnson authored Oct 20, 2024
2 parents 18def73 + ae87150 commit 36a0baa
Show file tree
Hide file tree
Showing 4 changed files with 10,292 additions and 10,796 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/rdme-openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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):
Expand Down Expand Up @@ -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']
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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__'
Expand 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
Expand All @@ -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__'
Expand 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
Expand All @@ -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']
Expand All @@ -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
Expand All @@ -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']
Expand All @@ -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
Expand All @@ -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']
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 36a0baa

Please sign in to comment.