Skip to content

Commit

Permalink
update DTO's to ensure default formats are V1/V2 (USACE#820)
Browse files Browse the repository at this point in the history
default aliases are used for the default (*/*) and default JSON
(application/json)
  • Loading branch information
adamkorynta authored Aug 2, 2024
1 parent 240f393 commit 0abb215
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cwms-data-api/src/main/java/cwms/cda/data/dto/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

@JsonRootName("catalog")
@FormattableWith(contentType = Formats.XML, formatter = XMLv1.class)
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
@FormattableWith(contentType = Formats.JSONV2, formatter = JsonV2.class)
public class Catalog extends CwmsDTOPaginated {
@Schema(
Expand Down
4 changes: 1 addition & 3 deletions cwms-data-api/src/main/java/cwms/cda/data/dto/CwmsId.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
import cwms.cda.formatters.Formats;
import cwms.cda.formatters.annotations.FormattableWith;
import cwms.cda.formatters.json.JsonV1;
import java.util.ArrayList;
import java.util.List;

@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
@JsonDeserialize(builder = CwmsId.Builder.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@Schema(description = "A representation of a location category")
@JsonRootName("location_category")
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
public class LocationCategory extends CwmsDTO
{
private final String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Schema(description = "A representation of a location group")
@JsonRootName("location_group")
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
@FormattableWith(contentType = Formats.CSV, formatter = CsvV1.class)
public class LocationGroup extends CwmsDTO {
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.Objects;

@JsonRootName("property")
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
@JsonDeserialize(builder = Property.Builder.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import cwms.cda.formatters.json.JsonV1;
import cwms.cda.formatters.Formats;

@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
public class RecentValue extends CwmsDTOBase
{
String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@Schema(description = "A representation of a TimeSeries category")
@JsonRootName("timeseries-category")
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
public class TimeSeriesCategory extends CwmsDTO
{
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@Schema(description = "A representation of a timeseries group")
@JsonRootName("timeseries-group")
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
public class TimeSeriesGroup extends CwmsDTO {
private String id;
private TimeSeriesCategory timeSeriesCategory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@JsonDeserialize(builder = LockRevokerRights.Builder.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
public class LockRevokerRights extends CwmsDTO {

private final String projectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@JsonDeserialize(builder = ProjectLock.Builder.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
@FormattableWith(contentType = Formats.JSON, formatter = JsonV2.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV2.class, aliases = {Formats.DEFAULT, Formats.JSON})
public class ProjectLock extends CwmsDTO {
// officeId held by CwmsDTO
private final String projectId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy.class)
@FormattableWith(contentType = Formats.JSON, formatter = JsonV1.class)
@FormattableWith(contentType = Formats.JSONV1, formatter = JsonV1.class, aliases = {Formats.DEFAULT, Formats.JSON})
public class ProjectLockId extends CwmsDTOBase {
private final String id;

Expand Down

0 comments on commit 0abb215

Please sign in to comment.