Skip to content

Commit

Permalink
[HTTP] Default to oldest in dev (#203225)
Browse files Browse the repository at this point in the history
## Summary

Changes the default HTTP version resolution in dev to `oldest` (matches
non-dev).

The original intention was to guide developers to always sending a
versioned header when interacting with Kibana. In practice, however,
developers just set-and-forget the following configuration to get around
this annoyance:

```yaml
server.versioned.versionResolution: 'oldest'
```

...undoing the original intention. Having this guidance does not justify
the confusion/annoyance that this dev-only default creates and so this
proposal simply removes it.

To better guide developers we can consider other options like: make
`version` required in core's HTTP client interface (lots of updates...),
doing something in tests, adding docs, something else or any combo of
these.

Given the fact that developers generally discover this workaround and
undo the originally intended guidance, I'm proposing not blocking on
first having another approach in place.
  • Loading branch information
jloleysens authored Dec 17, 2024
1 parent 3e06d6a commit c1bda1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ describe('versioned', () => {
).toThrow(/failed validation/);
});

it('defaults version resolution "none" when in dev', () => {
it('defaults version resolution "oldest" when in dev', () => {
expect(config.schema.validate({}, { dev: true })).toMatchObject({
versioned: { versionResolution: 'none' },
versioned: { versionResolution: 'oldest' },
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ const configSchema = schema.object(
* Which handler resolution algo to use for public routes: "newest" or "oldest".
*
* @note Internal routes always require a version to be specified.
* @note in development we have an additional option "none" which is also the default in dev.
* @note in development we have an additional option "none".
* This prevents any fallbacks and requires that a version specified.
* Useful for ensuring that a given client always specifies a version.
*/
versionResolution: schema.conditional(
schema.contextRef('dev'),
true,
schema.oneOf([schema.literal('newest'), schema.literal('oldest'), schema.literal('none')], {
defaultValue: 'none',
defaultValue: 'oldest',
}),
schema.oneOf([schema.literal('newest'), schema.literal('oldest')], {
defaultValue: 'oldest',
Expand Down

0 comments on commit c1bda1d

Please sign in to comment.