Skip to content

Move /route-custom into /route endpoint - #2252

Merged
easbar merged 15 commits into
masterfrom
custom_model_route_endpoint
Mar 19, 2021
Merged

easbar merged 15 commits into
masterfrom
custom_model_route_endpoint

Conversation

@easbar

@easbar easbar commented Mar 15, 2021

Copy link
Copy Markdown
Member

Here I moved the functionality of /route-custom into the route endpoint. The custom model now lives under a dedicated node called custom_model.

@easbar easbar added this to the 3.0 milestone Mar 15, 2021
@easbar

easbar commented Mar 15, 2021 •

Copy link
Copy Markdown
Member Author

I'm still wondering what the new API is supposed to be like. Currently with this PR a custom (POST) routing request looks like this:

{
 "profile": "some_custom_profile",
 "custom_model": { ... }
}

i.e. we have to pick a certain profile (that uses weighting: custom) and set the custom model (even though it might be just empty {}). For a 'classic' profile the request only includes the profile parameter and no custom model. Using a 'classic' profile and setting a custom model yields an error. Using a custom profile and not setting a custom model (instead of an empty model {}) also yields an error. Can we finalize on this API? API users need to know which profiles are 'custom' and which are not. Since we probably always need to distinguish between 'customizable' profiles and 'fixed' profiles this seems reasonable?! However, it can also be a bit more complicated than this because sending a custom model is only possible for custom profiles that allow non-CH requests.

@easbar

easbar commented Mar 15, 2021

Copy link
Copy Markdown
Member Author

Using a custom profile and not setting a custom model (instead of an empty model {}) also yields an error.

This shouldn't be. Using a custom profile without a custom model makes sense and should be allowed.

@easbar easbar changed the title WIP: Move /route-custom into /route endpoint Move /route-custom into /route endpoint Mar 18, 2021
@easbar

easbar commented Mar 18, 2021 •

Copy link
Copy Markdown
Member Author

Update: The behavior is now like this:

  • request uses custom profile and no custom model (or null) -> just use the custom profile as it was configured on the server-side
  • request uses custom profile and custom model -> the query custom model will be merged with the server custom model
  • BUT this does not work with CH, so we need to to add ch.disable=true (this is consistent to e.g. block_area)
  • custom_model={} is treated like any other custom model not like custom_model=null or a missing custom_model field
  • the maps UI adds the ch.disable=true option for custom requests via the custom model box
  • for the java API we now do request.setCustomModel(customModel) instead of request.putHint(CustomModel.KEY, customModel)

@karussell karussell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thanks!

@easbar
easbar merged commit e919a94 into master Mar 19, 2021
@easbar
easbar deleted the custom_model_route_endpoint branch March 19, 2021 08:17
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