Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class AnnotatedType {
private JsonView jsonViewAnnotation;
private boolean skipSchemaName;
private boolean skipJsonIdentity;
private String propertyName;

public AnnotatedType() {
}
Expand Down Expand Up @@ -174,6 +175,28 @@ public AnnotatedType jsonViewAnnotation(JsonView jsonViewAnnotation) {
return this;
}

/**
* @since 2.0.4
*/
public String getPropertyName() {
return propertyName;
}

/**
* @since 2.0.4
*/
public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}

/**
* @since 2.0.4
*/
public AnnotatedType propertyName(String propertyName) {
this.propertyName = propertyName;
return this;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
.name(annotatedType.getName())
.resolveAsRef(annotatedType.isResolveAsRef())
.jsonViewAnnotation(annotatedType.getJsonViewAnnotation())
.propertyName(annotatedType.getPropertyName())
.skipOverride(true);
if (resolvedArrayAnnotation != null) {
ArraySchema schema = new ArraySchema();
Expand Down Expand Up @@ -323,6 +324,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
.schemaProperty(annotatedType.isSchemaProperty())
.resolveAsRef(annotatedType.isResolveAsRef())
.jsonViewAnnotation(annotatedType.getJsonViewAnnotation())
.propertyName(annotatedType.getPropertyName())
.skipOverride(true);
return context.resolve(aType);
}
Expand Down Expand Up @@ -357,6 +359,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
.skipSchemaName(true)
.resolveAsRef(annotatedType.isResolveAsRef())
.jsonViewAnnotation(annotatedType.getJsonViewAnnotation())
.propertyName(annotatedType.getPropertyName())
.parent(annotatedType.getParent()));
if (addPropertiesSchema != null) {
if (StringUtils.isNotBlank(addPropertiesSchema.getName())) {
Expand Down Expand Up @@ -386,6 +389,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
.ctxAnnotations(schemaAnnotations)
.skipSchemaName(true)
.resolveAsRef(annotatedType.isResolveAsRef())
.propertyName(annotatedType.getPropertyName())
.jsonViewAnnotation(annotatedType.getJsonViewAnnotation())
.parent(annotatedType.getParent()));

Expand Down Expand Up @@ -444,6 +448,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
.name(annotatedType.getName())
.resolveAsRef(annotatedType.isResolveAsRef())
.jsonViewAnnotation(annotatedType.getJsonViewAnnotation())
.propertyName(annotatedType.getPropertyName())
.skipOverride(true);
model = context.resolve(aType);
return model;
Expand Down Expand Up @@ -569,7 +574,8 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
.resolveAsRef(annotatedType.isResolveAsRef())
.jsonViewAnnotation(annotatedType.getJsonViewAnnotation())
.skipSchemaName(true)
.schemaProperty(true);
.schemaProperty(true)
.propertyName(propName);

final AnnotatedMember propMember = member;
aType.jsonUnwrappedHandler((t) -> {
Expand Down Expand Up @@ -918,7 +924,8 @@ protected Schema processAsId(String propertyName, AnnotatedType type,
.type(propType)
.ctxAnnotations(annotations)
.jsonViewAnnotation(type.getJsonViewAnnotation())
.schemaProperty(true);
.schemaProperty(true)
.propertyName(type.getPropertyName());

return context.resolve(aType);
}
Expand Down Expand Up @@ -1026,6 +1033,7 @@ private static AnnotatedType removeJsonIdentityAnnotations(AnnotatedType type) {
.skipSchemaName(type.isSkipSchemaName())
.type(type.getType())
.skipJsonIdentity(true)
.propertyName(type.getPropertyName())
.ctxAnnotations(AnnotationsUtils.removeAnnotations(type.getCtxAnnotations(), JsonIdentityInfo.class, JsonIdentityReference.class));
}
}
Expand Down