Skip to content
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

position of @ApiOperation is not recognized #610

Closed
heapifyman opened this issue Mar 12, 2015 · 11 comments
Closed

position of @ApiOperation is not recognized #610

heapifyman opened this issue Mar 12, 2015 · 11 comments
Labels
Milestone

Comments

@heapifyman
Copy link
Contributor

I specified the position parameter in all @ApiOperation annotations in my Controller, but the operations are listed in a different order in the generated swagger-ui.

Am I missing something?

@dilipkrish
Copy link
Member

@heapifyman You can change the ordering by providing your own ordering logic using apiDescriptionOrdering.

@heapifyman
Copy link
Contributor Author

That does not seem to be working. I just tried with the following:

.apiDescriptionOrdering(new Ordering<ApiDescription>() {
    @Override
    public int compare(ApiDescription left, ApiDescription right) {
        return left.getDescription().compareTo(right.getDescription());
    }
});

If I am not mistaken that should order the descriptions by method names of the controller?
However, that is not what I get to see in the browser. What am I missing?

@karensg
Copy link

karensg commented Mar 30, 2015

I encounter the same issue. The expected behavior would be that the @ApiOperation annotations get sorted in ascending order by position attribute. Would be nice to have this fixed in 1.x branch if not too much work.

@jfiala
Copy link
Contributor

jfiala commented Apr 9, 2015

I'm facing the same with the latest 1.x version 1.0.2.
Additionally, also the @Api - position attribute seems to be ignored, the controllers are always listed in alphabetical order.
This is also not working in version 0.8.8.

@anishgopalan
Copy link

Is the issue still open? I'm see this in 2.x also.

@dilipkrish
Copy link
Member

Its not open and the position is deprecated.

@anishgopalan
Copy link

Okay , thanks for the update.

@fanjianhang
Copy link

@dilipkrish Hi, if i want to order apis, what should i do?

@dilipkrish
Copy link
Member

@fanjianhang Currently it is ordered by path

@fanjianhang
Copy link

@dilipkrish Thanks, i recommend it can order by position or some smart parameter

@dilipkrish dilipkrish added this to the 2.9.0 milestone Apr 25, 2018
@jinyahuan
Copy link

I also encountered the same problem.
And found an extended solution, I hope to help you, and may submit a PR later.
Version 2.7.0 is work.
#732 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants