Repository navigation
Generate Configuration Documentation - Part 1 - #4478
Conversation
# Conflicts: # src/main/java/org/opentripplanner/standalone/config/WheelchairAccessibilityRequestMapper.java
…ed later to output doc.
This commit refactors the NodeAdaptor and add support for adding documentation. The code for building a parameter is extracted in to ParameterBuilder. There is still a few pieces left to implement, like full support for complex types and unit tests for the doc-generation. # Conflicts: # src/main/java/org/opentripplanner/standalone/config/framework/NodeAdapter.java
…ion, asZoneId, and asStringMap
Codecov ReportBase: 58.82% // Head: 59.29% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #4478 +/- ##
=============================================
+ Coverage 58.82% 59.29% +0.47%
- Complexity 11689 11816 +127
=============================================
Files 1535 1542 +7
Lines 61356 62268 +912
Branches 6954 6961 +7
=============================================
+ Hits 36090 36921 +831
- Misses 23124 23187 +63
- Partials 2142 2160 +18
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
This looks generally very nice! I ran the code and it produced lines like these: Presumably the |
This issue is still there |
|
Yes, can confirm. The OTPFeatures are not checked correctly: |
leonardehrenfried
left a comment
There was a problem hiding this comment.
Please fix the warnings about OTPFetures.
…json/ParameterBuilder.java Co-authored-by: Leonard Ehrenfried <mail@leonard.io>
c033824 to
a5ef077
Compare
|
I made a temporary fix to the EnumMap causing the warning:
I want to make a better fix to this - but that requires a bit of refactoring, so I would like to do that in a separate PR. I updated the unit-test to cover this case and others (witch was ok, but did not have coverage). |
There was a problem hiding this comment.
I must change my review, because I just noticed a problem with the updater params.
When I use one of my previous configurations I see the following exception on startup:
12:14:44.133 INFO (ConfigLoader.java:221) Summarizing 'septa/router-config.json': {
"updaters" : [ {
"type" : "vehicle-positions",
"sourceType" : "gtfs-http",
"url" : "https://www3.septa.org/gtfsrt/septarail-pa-us/Vehicle/rtVehiclePosition.pb",
"feedId" : "septa-rail",
"frequencySec" : 60
}, {
"type" : "vehicle-rental",
"sourceType" : "gbfs",
"frequencySec" : 60,
"url" : "https://gbfs.bcycle.com/bcycle_indego/gbfs.json"
} ]
}
12:14:44.150 ERROR (OTPMain.java:55) The parameter value 'gtfs-http' is not legal. Expected one of [GBFS, SMOOVE, VILKKU, KML, PARK_API, BICYCLE_PARK_API, HSL_PARK, GTFS_RT_HTTP, GTFS_RT_FILE, GTFS_RT_VEHICLE_POSITIONS]. Parameter: updaters.[1].sourceType. Source: router-config.json.
org.opentripplanner.util.OtpAppException: The parameter value 'gtfs-http' is not legal. Expected one of [GBFS, SMOOVE, VILKKU, KML, PARK_API, BICYCLE_PARK_API, HSL_PARK, GTFS_RT_HTTP, GTFS_RT_FILE, GTFS_RT_VEHICLE_POSITIONS]. Parameter: updaters.[1].sourceType. Source: router-config.json.
at org.opentripplanner.standalone.config.framework.json.NodeAdapter.createException(NodeAdapter.java:253)
at org.opentripplanner.standalone.config.framework.json.ParameterBuilder.error(ParameterBuilder.java:580)
at org.opentripplanner.standalone.config.framework.json.ParameterBuilder.lambda$parseEnum$15(ParameterBuilder.java:486)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at org.opentripplanner.standalone.config.framework.json.ParameterBuilder.parseEnum(ParameterBuilder.java:485)
at org.opentripplanner.standalone.config.framework.json.ParameterBuilder.asEnum(ParameterBuilder.java:172)
at org.opentripplanner.standalone.config.updaters.VehiclePositionsUpdaterConfig.create(VehiclePositionsUpdaterConfig.java:24)
at org.opentripplanner.standalone.config.UpdatersConfig.<init>(UpdatersConfig.java:146)
at org.opentripplanner.standalone.config.RouterConfig.<init>(RouterConfig.java:94)
at org.opentripplanner.standalone.config.ConfigLoader.loadRouterConfig(ConfigLoader.java:148)
at org.opentripplanner.standalone.config.ConfigModel.<init>(ConfigModel.java:64)
at org.opentripplanner.standalone.config.configure.LoadConfigModule.providesModel(LoadConfigModule.java:39)
at org.opentripplanner.standalone.config.configure.LoadConfigModule_ProvidesModelFactory.providesModel(LoadConfigModule_ProvidesModelFactory.java:42)
at org.opentripplanner.standalone.config.configure.LoadConfigModule_ProvidesModelFactory.get(LoadConfigModule_ProvidesModelFactory.java:33)
at org.opentripplanner.standalone.config.configure.LoadConfigModule_ProvidesModelFactory.get(LoadConfigModule_ProvidesModelFactory.java:13)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at org.opentripplanner.standalone.configure.DaggerLoadApplicationFactory$LoadApplicationFactoryImpl.configModel(DaggerLoadApplicationFactory.java:129)
at org.opentripplanner.standalone.configure.LoadApplication.config(LoadApplication.java:65)
at org.opentripplanner.standalone.OTPMain.startOTPServer(OTPMain.java:112)
at org.opentripplanner.standalone.OTPMain.main(OTPMain.java:53)
12:14:44.151 INFO (OtpStartupInfo.java:43) OTP SHUTTING DOWN (version: 2.2.0-SNAPSHOT, ser.ver.id: 67, commit: ccfa4b706296c0858aa87f9877d2d97ed2e5c64c, branch: ccfa4b706296c0858aa87f9877d2d97ed2e5c64c)
I've written a unit test which allows you to easily reproduce the problem: leonardehrenfried@781fd9a
|
Or is the change of the enum values intentional? |
# Conflicts: # src/main/java/org/opentripplanner/standalone/config/updaters/GtfsRealtimeAlertsUpdaterConfig.java # src/main/java/org/opentripplanner/standalone/config/updaters/MqttGtfsRealtimeUpdaterConfig.java # src/main/java/org/opentripplanner/standalone/config/updaters/WFSNotePollingGraphUpdaterConfig.java # src/main/java/org/opentripplanner/standalone/config/updaters/WebsocketGtfsRealtimeUpdaterConfig.java
|
For the updaters we used to map a set of string type and data-sources into enum types used inside OTP. This is flexible and make it easier to change the internal model, but it also can be very confusing and might not give us that much - it is relatively easy to update the config files. So, after talking to @leonardehrenfried I changed the source types "gtfs-http" to "gtfs-rt-http" and "gtfs-file" to "gtfs-rt-file". The error message you will get if you do not update the config is this: We can further improve the error message later if we list all sourceTypes for each updater type. |
leonardehrenfried
left a comment
There was a problem hiding this comment.
I re-ran the IBI smoke test suite with this PR and all tests pass.
Summary
Implement framework for generating the documentation
Part 1 of #4477
Some of the deprecated configuration options are removed with this PR.
Unit tests
Some unit tests are added