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 @@ -31,19 +31,19 @@
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true)
@JsonSubTypes({
@JsonSubTypes.Type(value = AxisDomainCategorical.class, name = "categorical"),
@JsonSubTypes.Type(value = AxisDomainTimeRange.class, name = "timeRange")
@JsonSubTypes.Type(value = AxisDomainRange.class, name = "range")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from 'timeRange' to 'range' should also be applied to the AxisDomainSerializer.

})
public interface AxisDomain {

/**
* Returns the type of axis domain.
* <p>
* This is used as a discriminator to identify the specific subtype
* implementation (e.g., "categorical", "timeRange").
* implementation (e.g., "categorical", "range").
*
* @return A string identifying the domain type
*/
@Schema(description = "Type of axis domain (e.g., 'categorical' or 'timeRange')", requiredMode = RequiredMode.REQUIRED)
@Schema(description = "Type of axis domain (e.g., 'categorical' or 'range')", requiredMode = RequiredMode.REQUIRED)
@JsonProperty("type")
String getType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* <p>
* Used in Swagger schema generation for chart axis descriptions.
*/
public class AxisDomainTimeRange implements AxisDomain {
public class AxisDomainRange implements AxisDomain {

private final long start;
private final long end;
Expand All @@ -37,7 +37,7 @@ public class AxisDomainTimeRange implements AxisDomain {
* The maximum value of the axis domain
*/
@JsonCreator
public AxisDomainTimeRange(
public AxisDomainRange(
@JsonProperty("start") long start,
@JsonProperty("end") long end) {
this.start = start;
Expand All @@ -47,7 +47,7 @@ public AxisDomainTimeRange(
@Override
@Schema(description = "Type of axis domain", requiredMode = RequiredMode.REQUIRED)
public String getType() {
return "timeRange";
return "range";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ public interface SeriesModel {
* @return The X values' description.
*/
@JsonProperty("xValuesDescription")
@ArraySchema(arraySchema = @Schema(description = "Series' X axis description"), schema = @Schema(requiredMode = RequiredMode.REQUIRED))
@Schema(description = "Series' X axis description", requiredMode = RequiredMode.REQUIRED)
XYAxisDescription getXAxisDescription();

/**
* @return The Y values' description.
*/
@JsonProperty("yValuesDescription")
@ArraySchema(arraySchema = @Schema(description = "Series' Y axis description"), schema = @Schema(requiredMode = RequiredMode.REQUIRED))
@Schema(description = "Series' Y axis description", requiredMode = RequiredMode.REQUIRED)
XYAxisDescription getYAxisDescription();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public void serialize(IAxisDomain value, JsonGenerator gen, SerializerProvider s
if (value instanceof IAxisDomain.Categorical categorical) {
gen.writeStringField(TYPE, "categorical"); //$NON-NLS-1$
gen.writeObjectField("categories", categorical.categories()); //$NON-NLS-1$
} else if (value instanceof IAxisDomain.Range timeRange) {
gen.writeStringField(TYPE, "timeRange"); //$NON-NLS-1$
gen.writeNumberField("start", timeRange.start()); //$NON-NLS-1$
gen.writeNumberField("end", timeRange.end()); //$NON-NLS-1$
} else if (value instanceof IAxisDomain.Range range) {
gen.writeStringField(TYPE, "range"); //$NON-NLS-1$
gen.writeNumberField("start", range.start()); //$NON-NLS-1$
gen.writeNumberField("end", range.end()); //$NON-NLS-1$
} else {
throw new IllegalArgumentException("Unsupported AxisDomain implementation: " + value.getClass()); //$NON-NLS-1$
}
Expand Down
Loading