dkurok

some paging functions don't have ordering

Recommended Posts

The API-functions:

  • GET /api/v3/lego/mocs/{set_num}/parts/

  • GET /api/v3/lego/sets/{set_num}/parts
  • GET /api/v3/lego/sets/{set_num}/sets/

  • GET /api/v3/users/{user_token}/partlists/

  • GET /api/v3/users/{user_token}/setlists

don't have the query-parameter "ordering" even though paging (paramter page and result with next and previous) are implemented.

Is this by design?

On the other hand I see that the API-function

GET /api/v3/users/{user_token}/profile

has a page-parameter (no ordering), but the result doesn't have the typical paging structure (count, next, previous) (Which I think makes sense when looking on what the function returns there is no paging needed).

Regards

Dietmar

Share this post


Link to post
Share on other sites

Not really by design, but due to a limitation in those calls. The ordering relies on the data coming back in a certain format which does not apply to these calls as they do a lot more special processing before the data is ready. In Django terms: the ordering filter needs a queryset, but those calls return lists.

I don't know why the page parameter appears for the profile call, I've struggled a lot getting the swagger documentation to match the real parameters.

Share this post


Link to post
Share on other sites

OK, I do understand the limitations of the framework and can live with the "missing" ordering (in my use of the API in most scenarios I will fetch all data by taversing through the "next" as long as it is not null).

Are you using "Django REST Swagger" for generating the sager docu from your API?

Meanwhile I added a lot of information to a copy of your original swagger-YAML trying to bring in also information and modelling of the paramters and especially schema of the result (which afterwards makes generating a C#-based client just a few clicks and importsinto a project).

Due to time limits (this is really a hobby for me) I have it not for all functions (I started with those I know I (will) use).

If you like, I can give you a copy of that file for a first review. Maybe it is easier to use a YAML-file for the documentation which you can update manually (and not by the automatic generation based on your API-implementation)...

Best regards

Dietmar

Share this post


Link to post
Share on other sites

Yes, that's the app I'm using. It auto generates the documentation from the API code, but I tend to spend far more time trying to get it to display the right thing than writing actual API code.

Sure, I'd love to see the file to better understand what is possible. I've never tried to auto-generate code like that before. Also, the next version of the framework is supposed to have better support for adding it into the auto generated docs.

Share this post


Link to post
Share on other sites
20 hours ago, dkurok said:

Hello Nathan,

I've send you a forum-message with my swagger-file.

regards

Dietmar

Thanks. I'll look to see if there's something I can do to improve the documentation when I'm not so busy fixing things.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now