PokeAPI / pokeapi

The Pokémon API
https://pokeapi.co
BSD 3-Clause "New" or "Revised" License
4.15k stars 935 forks source link

docs(openapi): `q` query string param, fix `id` path parameter, nix refactor #1087

Closed Indyandie closed 4 months ago

Indyandie commented 4 months ago

OpenAPI Docs

Related #1078 #1065

Indyandie commented 4 months ago

@Naramsim

Naramsim commented 4 months ago

Hi, when trying your schema here: https://editor-next.swagger.io/

I don't see the q parameter for /abilities/, is it missing somewhere? On the other hand, if I check out /berries/ I have q but it's weirdly formatted:

swagger

Also, I don't really like the fat that we are adding other code to every method just for documenting one querystring. Can't we treat q like offset or limit?

Indyandie commented 4 months ago

I'll take a look and try to figure how to apply it like offset and limit. Where are those defined? Sorry i am not too familiar with django... 😅

Indyandie commented 4 months ago

@Naramsim I got rid of all that unnecessary code. All the endpoints that use PokeapiCommonViewset should pick up the definitions. The formatting is probably that swagger isn't reading the quoteblock properly.

Naramsim commented 4 months ago

Nice! Thanks a lot! If you have time, would you be able to fix the quoteblock strange formatting? Also, in the console I see other errors and warnings.

Many thanks!

pokeapi-machine-user commented 4 months ago

This Pull Request won't be deployed since the label no-deploy was found in its meta-data.

Indyandie commented 4 months ago

Nice! Thanks a lot! If you have time, would you be able to fix the quoteblock strange formatting? Also, in the console I see other errors and warnings.

Many thanks!

@Naramsim what command is generating the errors and warnings, can you share them? Or can you create an issue with all the details?

Naramsim commented 4 months ago

If you go here and input your openapi URL and then wait 15 seconds, a popup opens up in the bottom part and you can see something like:

Severity Line Code Message
  9320 7010601 tags must be an array of Tag Objects
  2795 10069 property "example" is deprecated, use "examples" instead