-
-
Notifications
You must be signed in to change notification settings - Fork 971
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
docs: add openAPI spec, add nix-shell
#1046
Conversation
Hi, what's nix shell? And what's the added advantage of using it? |
Howdy @Naramsim! The nix-shell is an interactive shell that's created using a nix expression (in this case the The advantage is optional for most, but it let's anyone who uses nix to run |
As i read this, its nix-shell is nothing that is needed, but nice to have and nothing that hurts to be included for the convenience of developers on NixOS |
Hi! Thanks for all the commits! When you are ready and the tests are passing you can ping me or request a review |
@Naramsim this is ready to go! |
Ok thanks! Maybe @ryu-0729 can also review this. I'm really unsure which PR should I merge in, tbh. Both of you have made a great work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Indyandie @Naramsim
I have reviewed it.
The way you divided the tags and set up the schema was very helpful.
I have added a comment and whould be happy if you could check it out.
Thanks.
@extend_schema( | ||
description="Abilities provide passive effects for Pokémon in battle or in the overworld. Pokémon have multiple possible abilities but can have only one ability at a time. Check out [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Ability) for greater detail.", | ||
tags=["pokemon"], | ||
) | ||
class AbilityResource(PokeapiCommonViewset): | ||
queryset = Ability.objects.all() | ||
serializer_class = AbilityDetailSerializer | ||
list_serializer_class = AbilitySummarySerializer | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some retrieve APIs allow passing name as a path parameter.
I was thinking that a string would be better than an integer, but what do you think?
It can be defined by overriding the retrieve method of PokeapiCommonViewset.
@extend_schema(
parameters=[
OpenApiParameter(
name="id",
description="This parameter can be a string or an integer.",
location=OpenApiParameter.PATH,
type=OpenApiTypes.STR,
),
]
)
def retrieve(self, request, pk=None):
return super().retrieve(request, pk)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can treat IDs like strings
@Naramsim @ryu-0729 I put together a mockup of the pokeapi.co using this OpenAPI document and astro starlight. |
Hi! Are you still here? I got back for a while! I think I'll merge this PR since it's too long we have it open. Honestly, I couldn't decide which one to merge and I decided to go with @Indyandie one since he seems a bit more active on GitHub than @ryu-0729 (in no way I'm criticizing your work or your profile). |
@Naramsim still here 🙋♂️ Let me know if we need anything else to merge. Probably need some instructions in the README? |
I'll merge this otherwise another 3 months will pass :) What kind of info do you want to include on the README? I'd put this command in the Makefile.
I was thinking that maybe we can also link the openapi.yml over at pokeapi.co |
A PokeAPI/api-data refresh has started. In ~45 minutes the staging branch of PokeAPI/api-data will be pushed with the new generated data. |
The updater script has finished its job and has now opened a Pull Request towards PokeAPI/api-data with the updated data. |
nix-shell
support via thedefaults.nix
.To generate pokeapi OpenAPi document run:
To start the
nix-shell
run:Fixes #528