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

Property writer-with-order-by-keys not taken into account #1690

Closed
fabienfleureau opened this issue Jun 1, 2022 · 5 comments
Closed

Property writer-with-order-by-keys not taken into account #1690

fabienfleureau opened this issue Jun 1, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@fabienfleureau
Copy link

Describe the bug
When springdoc.writer-with-order-by-keys is set to true, in the yaml generated file the keys are not sorted alphabetically
It seems related to this commit:
e77aec1#diff-f7a64fc1c3465d474089ceed1a982db7c484a3c23570ac637948999956614e6dL119
ObjectMapperProvider.java:119
As you can see the ObjectMapper is not configured anymore with MapperFeature.SORT_PROPERTIES_ALPHABETICALLY set to true.

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    2.7.0
  • What modules and versions of springdoc-openapi are you using?
    springdoc-openapi-webmvc-core 1.6.9
    springdoc-openapi-webflux-core 1.6.9
    springdoc-openapi-common 1.6.9
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    yaml

Expected behavior

  • A clear and concise description of what you expected to happen.
    I expect the yaml to be generated with keys sorted alphabetically
  • What is the expected result using OpenAPI Description (yml or json)?
@fabienfleureau
Copy link
Author

This PR should fix the issue:
#1691

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Jun 7, 2022

@fabienfleureau,

The sort is working fine. See test below:

If you believe, you are facing any issue, make sure you provide a Minimal, Reproducible Example - with HelloController that reproduces the problem

@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Jun 7, 2022
@mtorba
Copy link

mtorba commented Jun 20, 2022

Hi @bnasslahsen.
We are facing the same issue now (upgrade from 1.6.8 to 1.6.9 rearranged our output yaml), and I disagree with your assessment, it's not working fine. In fact the very test you linked proves that.
https://github.com/springdoc/springdoc-openapi/blob/master/springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app138.json has been edited right before 1.6.9 release (0dc49dd) into non-alphabetic parameter order:
"parameters":[{"name":"hello","in":"query","required":true,"schema":{"type":"string"}}]
from
"parameters":[{"in":"query","name":"hello","required":true,"schema":{"type":"string"}}]
I would argue that this test currently validates incorrect behaviour.

@mariusz-zawadzki
Copy link

I've created a new PR with expectations fixed:
#1713

app138.json is a copy from from tag v1.6.8

@bnasslahsen
Copy link
Contributor

Thank you @mariusz-zawadzki for your contirbution to the project.
You change, is now merged.

@bnasslahsen bnasslahsen added bug Something isn't working and removed invalid This doesn't seem right labels Jun 20, 2022
@bnasslahsen bnasslahsen pinned this issue Jun 20, 2022
@springdoc springdoc locked as resolved and limited conversation to collaborators Jun 20, 2022
@bnasslahsen bnasslahsen unpinned this issue Jul 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants