Skip to content

Commit

Permalink
[Fleet] fix schema validation to allow undefined/null (#202732)
Browse files Browse the repository at this point in the history
Fix a few issues encountered with schema validation.

One of them reported here:
https://discuss.elastic.co/t/fleet-error-updating-policy-settings/371332

The other encountered locally when testing upgrades:
```
"Failed output validation: [request body.items.0.upgrade_details]: expected a plain object value, but found [null] instead."
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
juliaElastic and kibanamachine committed Dec 4, 2024
1 parent 632d2e8 commit 7b4e1ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/common/types/models/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface NewAgentPolicy {
global_data_tags?: GlobalDataTag[];
monitoring_pprof_enabled?: boolean;
monitoring_http?: {
enabled: boolean;
enabled?: boolean;
host?: string;
port?: number;
};
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/fleet/server/types/models/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const AgentPolicyBaseSchema = {
monitoring_pprof_enabled: schema.maybe(schema.boolean()),
monitoring_http: schema.maybe(
schema.object({
enabled: schema.boolean(),
enabled: schema.maybe(schema.boolean()),
host: schema.maybe(schema.string({ defaultValue: 'localhost' })),
port: schema.maybe(schema.number({ min: 0, max: 65353, defaultValue: 6791 })),
buffer: schema.maybe(schema.object({ enabled: schema.boolean({ defaultValue: false }) })),
Expand Down

0 comments on commit 7b4e1ce

Please sign in to comment.