Skip to content

Commit

Permalink
Bugfix/missing required false (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
TsimurSh authored May 23, 2024
1 parent 6a5b8ec commit 6cab8e2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ ResponseEntity<ApiArrivalDeparturesResponse> getStopArrivalDepartureCacheData(
ResponseEntity<ApiArrivalDeparturesResponse> getTripArrivalDepartureCacheData(
StandardParameters stdParameters,
@Parameter(description = "if specified, returns the list for that tripId.", required = false)
@RequestParam(value = "tripId")
@RequestParam(value = "tripId", required = false)
String tripid,
@Parameter(description = "if specified, returns the list for that date.", required = false)
@RequestParam(value = "date")
@RequestParam(value = "date", required = false)
DateParam date,
@Parameter(description = "if specified, returns the list for that starttime.", required = false)
@RequestParam(value = "starttime")
@RequestParam(value = "starttime", required = false)
Integer starttime);

/*
Expand Down Expand Up @@ -174,7 +174,7 @@ ResponseEntity<Double> getKalmanErrorValue(
ResponseEntity<ApiPredictionsForStopPathResponse> getStopPathPredictions(
StandardParameters stdParameters,
@Parameter(description = "Algorith used for calculating the perdiction", required = false)
@RequestParam(value = "algorithm")
@RequestParam(value = "algorithm", required = false)
String algorithm,
@Parameter(description = "Trip Id", required = true) @RequestParam(value = "tripId") String tripId,
@Parameter(description = "Stop path index", required = true) @RequestParam(value = "stopPathIndex")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ ResponseEntity<ApiCommandAck> pushAvlData(
@RequestParam(value = "lon")
double lon,
@Parameter(description = "Speed of AVL reporte. m/s.", required = false)
@RequestParam(value = "s", defaultValue = "NaN")
@RequestParam(value = "s", defaultValue = "NaN", required = false)
float speed,
@Parameter(
description = "Heading of AVL report. Degrees. 0 degrees=North. Should be set"
+ " to Float.NaN if speed not available",
required = false)
@RequestParam(value = "h", defaultValue = "NaN")
@RequestParam(value = "h", defaultValue = "NaN", required = false)
float heading,
@Parameter(
description = "Indicates the assignmet id of the AVL report according to the"
+ " assingment tyoe. For example, if assingment type is"
+ " ROUTE_ID, the assingment ID should be one route_id"
+ " loaded in the system.",
required = false)
@RequestParam(value = "assignmentId")
@RequestParam(value = "assignmentId", required = false)
String assignmentId,
@Parameter(
description = "Indicates the assignmet type of the AV report. This parameter"
Expand Down Expand Up @@ -177,7 +177,7 @@ ResponseEntity<ApiCommandAck> cancelTrip(
StandardParameters stdParameters,
@Parameter(description = "tripId to be marked as canceled.", required = true) @PathVariable("tripId")
String tripId,
@Parameter(description = "start trip time", required = false) @RequestParam(value = "at") DateTimeParam at);
@Parameter(description = "start trip time", required = false) @RequestParam(value = "at", required = false) DateTimeParam at);

@PostMapping(
value = "/command/reenableTrip/{tripId}",
Expand All @@ -192,7 +192,7 @@ ResponseEntity<ApiCommandAck> reenableTrip(
StandardParameters stdParameters,
@Parameter(description = "tripId to remove calceled satate.", required = true) @PathVariable("tripId")
String tripId,
@Parameter(description = "start trip time", required = false) @RequestParam(value = "at") DateTimeParam at);
@Parameter(description = "start trip time", required = false) @RequestParam(value = "at", required = false) DateTimeParam at);

@Operation(
summary = "Add vehicles to block",
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/org/transitclock/api/resources/ReportsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ ResponseEntity<String> getAvlReport(
StandardParameters stdParameters,
@Parameter(description = "Vehicle id") @RequestParam(value = "v") String vehicleId,
@Parameter(description = "Begin date(MM-DD-YYYY or YYYY-MM-DD") @RequestParam(value = "beginDate") String beginDate,
@Parameter(description = "Num days.") @RequestParam(value = "numDays", defaultValue = "1", required = false) int numDays,
@Parameter(description = "Begin time(HH:MM)") @RequestParam(value = "beginTime", required = false) String beginTime,
@Parameter(description = "End time(HH:MM)") @RequestParam(value = "endTime", required = false) String endTime);
@Parameter(description = "Num days.", required = false) @RequestParam(value = "numDays", defaultValue = "1", required = false) int numDays,
@Parameter(description = "Begin time(HH:MM)", required = false) @RequestParam(value = "beginTime", required = false) String beginTime,
@Parameter(description = "End time(HH:MM)", required = false) @RequestParam(value = "endTime", required = false) String endTime);

/**
* Handles the "tripWithTravelTimes" command which outputs arrival and departures data for the
Expand Down Expand Up @@ -105,12 +105,12 @@ ResponseEntity<String> scheduleAdhReport(
StandardParameters stdParameters,
@Parameter(description = "Route id") @RequestParam(value = "r") String routeId,
@Parameter(description = "Begin date(MM-DD-YYYY or YYYY-MM-DD") @RequestParam(value = "beginDate") String beginDate,
@Parameter(description = "Num days.") @RequestParam(value = "numDays", defaultValue = "1", required = false) int numDays,
@Parameter(description = "Num days.", required = false) @RequestParam(value = "numDays", defaultValue = "1", required = false) int numDays,
@Parameter(description = "Begin time(HH:MM)") @RequestParam(value = "beginTime") String beginTime,
@Parameter(description = "End time(HH:MM)") @RequestParam(value = "endTime") String endTime,
@Parameter(description = "Allowable early in mins(default 1.0)")
@Parameter(description = "Allowable early in mins(default 1.0)", required = false)
@RequestParam(value = "allowableEarly", required = false, defaultValue = "1.0") String allowableEarly,
@Parameter(description = "Allowable late in mins(default 4.0")
@Parameter(description = "Allowable late in mins(default 4.0", required = false)
@RequestParam(value = "allowableLate", required = false, defaultValue = "4.0") String allowableLate);

@GetMapping(value = "/reports/lastAvlJsonData",
Expand Down
23 changes: 12 additions & 11 deletions app/src/main/java/org/transitclock/api/resources/TransitimeApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,25 @@ enum UiMode {
ResponseEntity<ApiVehiclesResponse> getVehicles(
StandardParameters stdParameters,

@Parameter(description = "Vehicles is list.")
@Parameter(description = "Vehicles is list.", required = false)
@RequestParam(value = "v", required = false, defaultValue = "")
List<String> vehicleIds,

@Parameter(description = "Specifies which vehicles to get data for.")
@Parameter(description = "Specifies which vehicles to get data for.",required = false)
@RequestParam(value = "r", required = false, defaultValue = "")
List<String> routesIdOrShortNames,

@Parameter(
description = "Specifies a stop so can get predictions for routes and"
+ " determine which vehicles are the ones generating the"
+ " predictions. The other vehicles are labeled as minor so"
+ " they can be drawn specially in the UI."
+ " they can be drawn specially in the UI.",
required = false
)
@RequestParam(value = "s", required = false)
String stopId,

@Parameter(description = "Number of predictions to show.")
@Parameter(description = "Number of predictions to show.", required = false)
@RequestParam(value = "numPreds", required = false, defaultValue = "2")
int numberPredictions);

Expand Down Expand Up @@ -281,7 +282,7 @@ ResponseEntity<ApiPredictionsResponse> getPredictions(
Double lon,

@Parameter(description = "How far away a stop can be from the location (lat/lon).", required = false)
@RequestParam(value = "maxDistance", defaultValue = "1500.0")
@RequestParam(value = "maxDistance", defaultValue = "1500.0", required = false)
double maxDistance,

@Parameter(description = "Maximum number of predictions to return.")
Expand Down Expand Up @@ -326,7 +327,7 @@ ResponseEntity<ApiRoutesResponse> getRoutes(
* @param stopId optional. If set then only this stop and the remaining ones on the trip pattern
* are marked as being for the UI and can be highlighted. Useful for when want to emphasize
* in the UI only the stops that are of interest to the user.
* @param direction optional. If set then only the shape for specified direction is marked as
* @param directionId optional. If set then only the shape for specified direction is marked as
* being for the UI. Needed for situations where a single stop is used for both directions
* of a route and want to highlight in the UI only the stops and the shapes that the user is
* actually interested in.
Expand Down Expand Up @@ -369,7 +370,7 @@ ResponseEntity<ApiRoutesDetailsResponse> getRouteDetails(
* Useful for creating a UI where user needs to select a stop from a list.
*
* @param stdParameters
* @param routeShortName
* @param routesIdOrShortNames
*
* @return
*
Expand Down Expand Up @@ -481,7 +482,7 @@ ResponseEntity<ApiBlocksResponse> getBlocks(
ResponseEntity<ApiIdsResponse> getBlockIds(
StandardParameters stdParameters,
@Parameter(description = "if set, returns only the data for that serviceId.", required = false)
@RequestParam(value = "serviceId")
@RequestParam(value = "serviceId", required = false)
String serviceId);

/**
Expand Down Expand Up @@ -541,7 +542,7 @@ ResponseEntity<ApiActiveBlocksRoutesResponse> getActiveBlocksByRoute(
@Parameter(
description = "A block will be active if the time is between the block start"
+ " time minus allowableBeforeTimeSecs and the block end"
+ " time")
+ " time", required = false)
@RequestParam(value = "t", defaultValue = "0", required = false)
int allowableBeforeTimeSecs);

Expand Down Expand Up @@ -628,13 +629,13 @@ ResponseEntity<ApiAdherenceSummary> getVehicleAdherenceSummary(
description = "The number of seconds early a vehicle has to be before it is"
+ " considered in the early counter.",
required = false)
@RequestParam(value = "allowableEarlySec", defaultValue = "0")
@RequestParam(value = "allowableEarlySec", defaultValue = "0", required = false)
int allowableEarlySec,
@Parameter(
description = "The number of seconds early a vehicle has to be before it is"
+ " considered in the late counter.",
required = false)
@RequestParam(value = "allowableLateSec", defaultValue = "0")
@RequestParam(value = "allowableLateSec", defaultValue = "0" , required = false)
int allowableLateSec,
@Parameter(
description = "A block will be active if the time is between the block start"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public GtfsRealtimeApi(AgencyTimezoneCache agencyTimezoneCache, FeedCacheManager
tags = {"GTFS", "feed"})
public ResponseEntity<Object> getGtfsRealtimeVehiclePositionsFeed(
StandardParameters stdParameters,
@Parameter(description = "If specified as human, it will get the output in human readable format. Otherwise will output data in binary format")
@Parameter(description = "If specified as human, it will get the output in human readable format. Otherwise will output data in binary format", required = false)
@RequestParam(value = "format", required = false) String format) {

// Determine if output should be in human-readable format or in
Expand Down Expand Up @@ -83,7 +83,7 @@ public ResponseEntity<Object> getGtfsRealtimeVehiclePositionsFeed(
tags = {"GTFS", "feed"})
public ResponseEntity<Object> getGtfsRealtimeTripFeed(
StandardParameters stdParameters,
@Parameter(description = "If specified as human, it will get the output in human readable format. Otherwise will output data in binary format")
@Parameter(description = "If specified as human, it will get the output in human readable format. Otherwise will output data in binary format", required = false)
@RequestParam(value = "format", required = false)
String format) {
// Determine if output should be in human readable format or in
Expand Down

0 comments on commit 6cab8e2

Please sign in to comment.