mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
Relax id validation from UUID to UUID or NonEmptyString to support ES generated id's
This commit is contained in:
parent
252b8e8095
commit
ddf93a8dd1
12 changed files with 47 additions and 25 deletions
|
@ -16,7 +16,7 @@ import { z } from 'zod';
|
||||||
* version: 1
|
* version: 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { UUID } from '../common_attributes.gen';
|
import { UUID, NonEmptyString } from '../common_attributes.gen';
|
||||||
import { Replacements } from '../conversations/common_attributes.gen';
|
import { Replacements } from '../conversations/common_attributes.gen';
|
||||||
|
|
||||||
export type ExecuteConnectorRequestParams = z.infer<typeof ExecuteConnectorRequestParams>;
|
export type ExecuteConnectorRequestParams = z.infer<typeof ExecuteConnectorRequestParams>;
|
||||||
|
@ -30,7 +30,7 @@ export type ExecuteConnectorRequestParamsInput = z.input<typeof ExecuteConnector
|
||||||
|
|
||||||
export type ExecuteConnectorRequestBody = z.infer<typeof ExecuteConnectorRequestBody>;
|
export type ExecuteConnectorRequestBody = z.infer<typeof ExecuteConnectorRequestBody>;
|
||||||
export const ExecuteConnectorRequestBody = z.object({
|
export const ExecuteConnectorRequestBody = z.object({
|
||||||
conversationId: UUID.optional(),
|
conversationId: z.union([UUID, NonEmptyString]).optional(),
|
||||||
message: z.string().optional(),
|
message: z.string().optional(),
|
||||||
model: z.string().optional(),
|
model: z.string().optional(),
|
||||||
subAction: z.enum(['invokeAI', 'invokeStream']),
|
subAction: z.enum(['invokeAI', 'invokeStream']),
|
||||||
|
|
|
@ -31,7 +31,9 @@ paths:
|
||||||
- subAction
|
- subAction
|
||||||
properties:
|
properties:
|
||||||
conversationId:
|
conversationId:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
message:
|
message:
|
||||||
type: string
|
type: string
|
||||||
model:
|
model:
|
||||||
|
|
|
@ -44,7 +44,7 @@ export const NormalizedAnonymizationFieldError = z.object({
|
||||||
|
|
||||||
export type AnonymizationFieldResponse = z.infer<typeof AnonymizationFieldResponse>;
|
export type AnonymizationFieldResponse = z.infer<typeof AnonymizationFieldResponse>;
|
||||||
export const AnonymizationFieldResponse = z.object({
|
export const AnonymizationFieldResponse = z.object({
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
timestamp: NonEmptyString.optional(),
|
timestamp: NonEmptyString.optional(),
|
||||||
field: z.string(),
|
field: z.string(),
|
||||||
allowed: z.boolean().optional(),
|
allowed: z.boolean().optional(),
|
||||||
|
|
|
@ -103,7 +103,9 @@ components:
|
||||||
- field
|
- field
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
'timestamp':
|
'timestamp':
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
field:
|
field:
|
||||||
|
|
|
@ -152,7 +152,7 @@ export const ConversationSummary = z.object({
|
||||||
export type ErrorSchema = z.infer<typeof ErrorSchema>;
|
export type ErrorSchema = z.infer<typeof ErrorSchema>;
|
||||||
export const ErrorSchema = z
|
export const ErrorSchema = z
|
||||||
.object({
|
.object({
|
||||||
id: UUID.optional(),
|
id: z.union([UUID, NonEmptyString]).optional(),
|
||||||
error: z.object({
|
error: z.object({
|
||||||
status_code: z.number().int().min(400),
|
status_code: z.number().int().min(400),
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
|
|
|
@ -130,7 +130,9 @@ components:
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
error:
|
error:
|
||||||
type: object
|
type: object
|
||||||
required:
|
required:
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
ConversationUpdateProps,
|
ConversationUpdateProps,
|
||||||
ConversationMessageCreateProps,
|
ConversationMessageCreateProps,
|
||||||
} from './common_attributes.gen';
|
} from './common_attributes.gen';
|
||||||
import { UUID } from '../common_attributes.gen';
|
import { UUID, NonEmptyString } from '../common_attributes.gen';
|
||||||
|
|
||||||
export type AppendConversationMessageRequestParams = z.infer<
|
export type AppendConversationMessageRequestParams = z.infer<
|
||||||
typeof AppendConversationMessageRequestParams
|
typeof AppendConversationMessageRequestParams
|
||||||
|
@ -31,7 +31,7 @@ export const AppendConversationMessageRequestParams = z.object({
|
||||||
/**
|
/**
|
||||||
* The conversation's `id` value.
|
* The conversation's `id` value.
|
||||||
*/
|
*/
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
});
|
});
|
||||||
export type AppendConversationMessageRequestParamsInput = z.input<
|
export type AppendConversationMessageRequestParamsInput = z.input<
|
||||||
typeof AppendConversationMessageRequestParams
|
typeof AppendConversationMessageRequestParams
|
||||||
|
@ -60,7 +60,7 @@ export const DeleteConversationRequestParams = z.object({
|
||||||
/**
|
/**
|
||||||
* The conversation's `id` value.
|
* The conversation's `id` value.
|
||||||
*/
|
*/
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
});
|
});
|
||||||
export type DeleteConversationRequestParamsInput = z.input<typeof DeleteConversationRequestParams>;
|
export type DeleteConversationRequestParamsInput = z.input<typeof DeleteConversationRequestParams>;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ export const ReadConversationRequestParams = z.object({
|
||||||
/**
|
/**
|
||||||
* The conversation's `id` value.
|
* The conversation's `id` value.
|
||||||
*/
|
*/
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
});
|
});
|
||||||
export type ReadConversationRequestParamsInput = z.input<typeof ReadConversationRequestParams>;
|
export type ReadConversationRequestParamsInput = z.input<typeof ReadConversationRequestParams>;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ export const UpdateConversationRequestParams = z.object({
|
||||||
/**
|
/**
|
||||||
* The conversation's `id` value.
|
* The conversation's `id` value.
|
||||||
*/
|
*/
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
});
|
});
|
||||||
export type UpdateConversationRequestParamsInput = z.input<typeof UpdateConversationRequestParams>;
|
export type UpdateConversationRequestParamsInput = z.input<typeof UpdateConversationRequestParams>;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,9 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: The conversation's `id` value.
|
description: The conversation's `id` value.
|
||||||
schema:
|
schema:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: Indicates a successful call.
|
description: Indicates a successful call.
|
||||||
|
@ -86,7 +88,9 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: The conversation's `id` value.
|
description: The conversation's `id` value.
|
||||||
schema:
|
schema:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
|
@ -126,7 +130,9 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: The conversation's `id` value.
|
description: The conversation's `id` value.
|
||||||
schema:
|
schema:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: Indicates a successful call.
|
description: Indicates a successful call.
|
||||||
|
@ -162,7 +168,9 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: The conversation's `id` value.
|
description: The conversation's `id` value.
|
||||||
schema:
|
schema:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {
|
||||||
KnowledgeBaseEntryResponse,
|
KnowledgeBaseEntryResponse,
|
||||||
KnowledgeBaseEntryUpdateProps,
|
KnowledgeBaseEntryUpdateProps,
|
||||||
} from './common_attributes.gen';
|
} from './common_attributes.gen';
|
||||||
import { UUID } from '../common_attributes.gen';
|
import { UUID, NonEmptyString } from '../common_attributes.gen';
|
||||||
|
|
||||||
export type CreateKnowledgeBaseEntryRequestBody = z.infer<
|
export type CreateKnowledgeBaseEntryRequestBody = z.infer<
|
||||||
typeof CreateKnowledgeBaseEntryRequestBody
|
typeof CreateKnowledgeBaseEntryRequestBody
|
||||||
|
@ -41,7 +41,7 @@ export const DeleteKnowledgeBaseEntryRequestParams = z.object({
|
||||||
/**
|
/**
|
||||||
* The Knowledge Base Entry's `id` value
|
* The Knowledge Base Entry's `id` value
|
||||||
*/
|
*/
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
});
|
});
|
||||||
export type DeleteKnowledgeBaseEntryRequestParamsInput = z.input<
|
export type DeleteKnowledgeBaseEntryRequestParamsInput = z.input<
|
||||||
typeof DeleteKnowledgeBaseEntryRequestParams
|
typeof DeleteKnowledgeBaseEntryRequestParams
|
||||||
|
@ -57,7 +57,7 @@ export const ReadKnowledgeBaseEntryRequestParams = z.object({
|
||||||
/**
|
/**
|
||||||
* The Knowledge Base Entry's `id` value.
|
* The Knowledge Base Entry's `id` value.
|
||||||
*/
|
*/
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
});
|
});
|
||||||
export type ReadKnowledgeBaseEntryRequestParamsInput = z.input<
|
export type ReadKnowledgeBaseEntryRequestParamsInput = z.input<
|
||||||
typeof ReadKnowledgeBaseEntryRequestParams
|
typeof ReadKnowledgeBaseEntryRequestParams
|
||||||
|
@ -73,7 +73,7 @@ export const UpdateKnowledgeBaseEntryRequestParams = z.object({
|
||||||
/**
|
/**
|
||||||
* The Knowledge Base Entry's `id` value
|
* The Knowledge Base Entry's `id` value
|
||||||
*/
|
*/
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
});
|
});
|
||||||
export type UpdateKnowledgeBaseEntryRequestParamsInput = z.input<
|
export type UpdateKnowledgeBaseEntryRequestParamsInput = z.input<
|
||||||
typeof UpdateKnowledgeBaseEntryRequestParams
|
typeof UpdateKnowledgeBaseEntryRequestParams
|
||||||
|
|
|
@ -45,7 +45,9 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: The Knowledge Base Entry's `id` value.
|
description: The Knowledge Base Entry's `id` value.
|
||||||
schema:
|
schema:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: Successful request returning a Knowledge Base Entry
|
description: Successful request returning a Knowledge Base Entry
|
||||||
|
@ -72,7 +74,9 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: The Knowledge Base Entry's `id` value
|
description: The Knowledge Base Entry's `id` value
|
||||||
schema:
|
schema:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
|
@ -105,7 +109,9 @@ paths:
|
||||||
required: true
|
required: true
|
||||||
description: The Knowledge Base Entry's `id` value
|
description: The Knowledge Base Entry's `id` value
|
||||||
schema:
|
schema:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: Successful request returning the deleted Knowledge Base Entry
|
description: Successful request returning the deleted Knowledge Base Entry
|
||||||
|
|
|
@ -44,7 +44,7 @@ export const NormalizedPromptError = z.object({
|
||||||
|
|
||||||
export type PromptResponse = z.infer<typeof PromptResponse>;
|
export type PromptResponse = z.infer<typeof PromptResponse>;
|
||||||
export const PromptResponse = z.object({
|
export const PromptResponse = z.object({
|
||||||
id: UUID,
|
id: z.union([UUID, NonEmptyString]),
|
||||||
timestamp: NonEmptyString.optional(),
|
timestamp: NonEmptyString.optional(),
|
||||||
name: z.string(),
|
name: z.string(),
|
||||||
promptType: z.string(),
|
promptType: z.string(),
|
||||||
|
|
|
@ -105,7 +105,9 @@ components:
|
||||||
- content
|
- content
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
oneOf:
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/UUID'
|
||||||
|
- $ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
'timestamp':
|
'timestamp':
|
||||||
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||||
name:
|
name:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue