Skip to content

Commit

Permalink
JavaDoc integration not working with SnakeCaseStrategy property naming.
Browse files Browse the repository at this point in the history
Fixes #2484
  • Loading branch information
bnasslahsen committed Mar 10, 2024
1 parent 0fdfaba commit 534080f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,21 @@ public void setJavadocDescription(Class<?> cls, List<Field> fields, List<Propert
* @param field the field
* @return the boolean
*/
private static boolean findFields(Entry<String, Schema> stringSchemaEntry, Field field) {
if (field.getName().equals(stringSchemaEntry.getKey())){
private boolean findFields(Entry<String, Schema> stringSchemaEntry, Field field) {
if (field.getName().equals(stringSchemaEntry.getKey())) {
return true;
}
else {
JsonProperty jsonPropertyAnnotation = field.getAnnotation(JsonProperty.class);
if (jsonPropertyAnnotation != null) {
String jsonPropertyName = jsonPropertyAnnotation.value();
if (jsonPropertyName.equals(stringSchemaEntry.getKey())){
if (jsonPropertyName.equals(stringSchemaEntry.getKey())) {
return true;
}
}
else if (field.getName().equalsIgnoreCase(stringSchemaEntry.getKey().replaceAll("_", ""))) {
return true;
}
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@

package test.org.springdoc.api.app13;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

/**
* The type Person dto.
*/
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class PersonDTO {
/**
* The Email.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
"type": "string",
"description": "The Email."
},
"firstName": {
"first_name": {
"type": "string",
"description": "The First name."
},
"lastName": {
"last_name": {
"type": "string",
"description": "The Last name."
}
Expand All @@ -73,4 +73,4 @@
}
}
}
}
}

0 comments on commit 534080f

Please sign in to comment.