Skip to content

feat(valhalla): add multimodal support with the date_time API parameter#124

Merged
azarz merged 6 commits into
mainfrom
feat/add-multimodal-routing
Jul 24, 2026
Merged

feat(valhalla): add multimodal support with the date_time API parameter#124
azarz merged 6 commits into
mainfrom
feat/add-multimodal-routing

Conversation

@azarz

@azarz azarz commented Jul 3, 2026

Copy link
Copy Markdown
Member

No description provided.

@azarz
azarz marked this pull request as ready for review July 24, 2026 08:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an optional date_time query parameter for Valhalla multimodal computations and wires it through the service parameter model, Simple API controller, and Valhalla request payload, with accompanying documentation updates.

Changes:

  • Added a new date_time service parameter and exposed it on route and isochrone operations.
  • Propagated date_time through Simple API parsing/validation, request objects, and Valhalla request JSON construction.
  • Introduced a new string parameter type (StringParameter) and enabled it in parameterManager, plus updated docs/samples/changelog.

Reviewed changes

Copilot reviewed 16 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/resources/parameters/date_time.json Adds the date_time service parameter definition.
src/resources/operations/route.json Exposes date_time on the route operation.
src/resources/operations/isochrone.json Exposes date_time on the isochrone operation.
src/js/sources/valhallaSource.js Maps request.date_time into Valhalla date_time payload.
src/js/requests/routeRequest.js Adds date_time field + accessors to route request model.
src/js/requests/isochroneRequest.js Adds date_time field + accessors to isochrone request model.
src/js/parameters/stringParameter.js Introduces a resource parameter implementation for string.
src/js/parameters/parameterManager.js Allows string type, validates config, instantiates StringParameter.
src/js/apis/simple/1.0.0/init.js Adds date_time to generated Simple API parameter descriptions/capabilities.
src/js/apis/simple/1.0.0/controller/controller.js Parses/validates date_time for route and isochrone requests.
readme.md Markdown whitespace/formatting adjustments.
readme_en.md Markdown whitespace/formatting adjustments.
documentation/index.md Mentions date_time availability for multimodal Valhalla resources.
documentation/configuration/resources/valhalla.resource Updates sample Valhalla resource config (multimodal + date_time).
documentation/apis/simple/1.0.0/api.json Documents date_time parameter and schema constraints (FR).
documentation_en/index.md Mentions date_time availability (EN).
documentation_en/apis/simple/1.0.0/api.json Documents date_time parameter and schema constraints (EN).
changelog.md Records the new date_time parameter and multimodal exposure.
Comments suppressed due to low confidence (2)

src/js/requests/routeRequest.js:370

  • Accent manquant dans le commentaire JSDoc (départ).
  * @description Attribuer la date et heure de depart

src/js/requests/isochroneRequest.js:317

  • Le type du paramètre dt dans le JSDoc est indiqué comme {object} alors que date_time est une chaîne (cf. regex/paramètre OpenAPI).
  * @function
  * @name set date_time
  * @description Attribuer la date et heure de depart.
  * @param {object} dt - Date et heure de depart.
  *

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/resources/parameters/date_time.json Outdated
Comment thread documentation/index.md Outdated
Comment thread src/js/apis/simple/1.0.0/init.js
Comment thread src/js/apis/simple/1.0.0/init.js
Comment thread src/js/requests/routeRequest.js Outdated
Comment thread src/js/requests/isochroneRequest.js Outdated
Comment thread src/resources/parameters/date_time.json
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Amaury Zarzelli <amaury.zarzelli@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (2)

src/js/apis/simple/1.0.0/controller/controller.js:935

  • Same issue as route: if (parameters.date_time) ignores an explicitly provided empty value (date_time=). This should validate and return 400 rather than being treated as missing.
    // date_time
    if (parameters.date_time) {

documentation/configuration/resources/valhalla.resource:176

  • Same as the route operation section above: adding a values.pattern for date_time in the sample config keeps the validation contract explicit and aligned with the API docs/controller regex.
        {
            "id": "date_time"
        },

Comment thread src/resources/parameters/date_time.json
Comment on lines +104 to +109
if (this._values.pattern) {
const regex = new RegExp(this._values.pattern);
if (!regex.test(userValue)) {
return errorManager.createErrorMessage("value does not match required pattern");
}
}
Comment on lines +429 to +431
// date_time
if (parameters.date_time) {

Comment on lines +87 to +89
{
"id": "date_time"
},
* @description Classe modelisant un parametre de type string dans une operation.
*
*/
module.exports = class StringParameter extends ResourceParameter {
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 18 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/js/parameters/stringParameter.js:109

  • new RegExp(this._values.pattern) can throw if the configured pattern is not a valid regex, which would crash request validation at runtime. Catch the error and return a validation message instead.
    if (this._values.pattern) {
      const regex = new RegExp(this._values.pattern);
      if (!regex.test(userValue)) {
        return errorManager.createErrorMessage("value does not match required pattern");
      }
    }

Comment thread src/resources/parameters/date_time.json
Comment thread src/js/requests/routeRequest.js
Comment thread src/js/requests/isochroneRequest.js
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@azarz
azarz merged commit a32b87b into main Jul 24, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants