Skip to content

Commit

Permalink
docs: fix swagger output
Browse files Browse the repository at this point in the history
  • Loading branch information
takb committed Jan 29, 2025
1 parent 555265c commit 93073a0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.graphhopper.json.Statement;
import com.graphhopper.util.CustomModel;
import com.graphhopper.util.JsonFeature;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -14,21 +15,26 @@

public class RouteRequestCustomModel {
@JsonProperty("distance_influence")
@Schema(description = "Parameter determining the influence of the distance between two points on the edge weight")
private double distanceInfluence;

@JsonProperty("heading_penalty")
@Schema(hidden = true)
private double headingPenalty = (double) 300.0F;

@JsonProperty("speed")
@JsonDeserialize(contentUsing = StatementDeserializer.class)
@Schema(description = "Array of objects describing rules to be applied to the speed of edges")
private List<Statement> speedStatements = new ArrayList<>();

@JsonProperty("priority")
@JsonDeserialize(contentUsing = StatementDeserializer.class)
@Schema(description = "Array of objects describing rules to be applied to the priority of edges")
private List<Statement> priorityStatements = new ArrayList<>();

@JsonProperty("areas")
private Map<String, JsonFeature> areas = new HashMap();
@Schema(implementation = RouteRequestCustomModelAreas.class, description = "Map of areas that can be referenced in speed and priority rules")
private Map<String, JsonFeature> areas = new HashMap<>();

public CustomModel toGHCustomModel() {
CustomModel customModel = new CustomModel();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.heigit.ors.api.requests.routing;

import io.swagger.v3.oas.annotations.media.Schema;

import java.util.Map;

@Schema(type = "object", implementation = RouteRequestCustomModelGeoJSONFeature.class)
public interface RouteRequestCustomModelAreas extends Map<String, RouteRequestCustomModelGeoJSONFeature> {
@Schema(hidden = true)
boolean isEmpty();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.heigit.ors.api.requests.routing;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class RouteRequestCustomModelGeoJSONFeature {
@JsonProperty("type")
@Schema(description = "GeoJSON type", defaultValue = "Feature")
public final String type = "Feature";

@JsonProperty("geometry")
@Schema(description = "Feature geometry")
public RouteRequestCustomModelGeoJSONPolygonGeometry geometry;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.heigit.ors.api.requests.routing;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class RouteRequestCustomModelGeoJSONPolygonGeometry {
@JsonProperty("type")
@Schema(description = "GeoJSON type", defaultValue = "Polygon")
public final String type = "Polygon";

@JsonProperty("coordinates")
public Double[][][] coordinates;
}

0 comments on commit 93073a0

Please sign in to comment.