Conversation
Contributor
|
Howdy @Naramsim! 😮 I wrote a similar thing yesterday. It seems that nothing is being generated from this change when I run However @ryu-0729's PR #1050, has a solution. see api.py ln 75 #...
retrieve_path_parameter = OpenApiParameter(
name="id",
description="This parameter can be a string or an integer.",
location=OpenApiParameter.PATH,
type=OpenApiTypes.STR,
required=True,
)
q_query_string_parameter = OpenApiParameter(
name="q",
description="> Only available locally and not at [pokeapi.co](https://pokeapi.co/docs/v2)\nCase-insensitive query applied on the `name` property. ",
location=OpenApiParameter.QUERY,
type=OpenApiTypes.STR,
)
#...
@extend_schema(
description="Pokémon are the creatures that inhabit the world of the Pokémon games. They can be caught using Pokéballs and trained by battling with other Pokémon. Each Pokémon belongs to a specific species but may take on a variant which makes it differ from other Pokémon of the same species, such as base stats, available abilities and typings. See [Bulbapedia](http://bulbapedia.bulbagarden.net/wiki/Pok%C3%A9mon_(species)) for greater detail.",
summary="Get pokemon",
tags=["pokemon"],
)
@extend_schema_view(
list=extend_schema(summary="List pokemon", parameters=[q_query_string_parameter]),
)
class PokemonResource(PokeapiCommonViewset):
queryset = Pokemon.objects.all()
serializer_class = PokemonDetailSerializer
list_serializer_class = PokemonSummarySerializer
@extend_schema(parameters=[retrieve_path_parameter])
def retrieve(self, request, pk=None):
return super().retrieve(request, pk)
#... |
Contributor
Member
Author
|
If you have the same feature but working, you can submit your PR and I'll close this one |
Contributor
|
Yeah, I'll try to post a PR today or tomorrow. @Naramsim does the 'q' param apply to all list endpoints? |
Member
Author
Yes it seems so! It would be nice to test it on unnamed resources, those that only support querying by ID. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

@Indyandie could you review this PR? Thanks!