mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -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
|
||||
*/
|
||||
|
||||
import { UUID } from '../common_attributes.gen';
|
||||
import { UUID, NonEmptyString } from '../common_attributes.gen';
|
||||
import { Replacements } from '../conversations/common_attributes.gen';
|
||||
|
||||
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 const ExecuteConnectorRequestBody = z.object({
|
||||
conversationId: UUID.optional(),
|
||||
conversationId: z.union([UUID, NonEmptyString]).optional(),
|
||||
message: z.string().optional(),
|
||||
model: z.string().optional(),
|
||||
subAction: z.enum(['invokeAI', 'invokeStream']),
|
||||
|
|
|
@ -31,7 +31,9 @@ paths:
|
|||
- subAction
|
||||
properties:
|
||||
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:
|
||||
type: string
|
||||
model:
|
||||
|
|
|
@ -44,7 +44,7 @@ export const NormalizedAnonymizationFieldError = z.object({
|
|||
|
||||
export type AnonymizationFieldResponse = z.infer<typeof AnonymizationFieldResponse>;
|
||||
export const AnonymizationFieldResponse = z.object({
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
timestamp: NonEmptyString.optional(),
|
||||
field: z.string(),
|
||||
allowed: z.boolean().optional(),
|
||||
|
|
|
@ -103,7 +103,9 @@ components:
|
|||
- field
|
||||
properties:
|
||||
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':
|
||||
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||
field:
|
||||
|
|
|
@ -152,7 +152,7 @@ export const ConversationSummary = z.object({
|
|||
export type ErrorSchema = z.infer<typeof ErrorSchema>;
|
||||
export const ErrorSchema = z
|
||||
.object({
|
||||
id: UUID.optional(),
|
||||
id: z.union([UUID, NonEmptyString]).optional(),
|
||||
error: z.object({
|
||||
status_code: z.number().int().min(400),
|
||||
message: z.string(),
|
||||
|
|
|
@ -130,7 +130,9 @@ components:
|
|||
additionalProperties: false
|
||||
properties:
|
||||
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:
|
||||
type: object
|
||||
required:
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
ConversationUpdateProps,
|
||||
ConversationMessageCreateProps,
|
||||
} from './common_attributes.gen';
|
||||
import { UUID } from '../common_attributes.gen';
|
||||
import { UUID, NonEmptyString } from '../common_attributes.gen';
|
||||
|
||||
export type AppendConversationMessageRequestParams = z.infer<
|
||||
typeof AppendConversationMessageRequestParams
|
||||
|
@ -31,7 +31,7 @@ export const AppendConversationMessageRequestParams = z.object({
|
|||
/**
|
||||
* The conversation's `id` value.
|
||||
*/
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
});
|
||||
export type AppendConversationMessageRequestParamsInput = z.input<
|
||||
typeof AppendConversationMessageRequestParams
|
||||
|
@ -60,7 +60,7 @@ export const DeleteConversationRequestParams = z.object({
|
|||
/**
|
||||
* The conversation's `id` value.
|
||||
*/
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
});
|
||||
export type DeleteConversationRequestParamsInput = z.input<typeof DeleteConversationRequestParams>;
|
||||
|
||||
|
@ -72,7 +72,7 @@ export const ReadConversationRequestParams = z.object({
|
|||
/**
|
||||
* The conversation's `id` value.
|
||||
*/
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
});
|
||||
export type ReadConversationRequestParamsInput = z.input<typeof ReadConversationRequestParams>;
|
||||
|
||||
|
@ -84,7 +84,7 @@ export const UpdateConversationRequestParams = z.object({
|
|||
/**
|
||||
* The conversation's `id` value.
|
||||
*/
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
});
|
||||
export type UpdateConversationRequestParamsInput = z.input<typeof UpdateConversationRequestParams>;
|
||||
|
||||
|
|
|
@ -52,7 +52,9 @@ paths:
|
|||
required: true
|
||||
description: The conversation's `id` value.
|
||||
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:
|
||||
200:
|
||||
description: Indicates a successful call.
|
||||
|
@ -86,7 +88,9 @@ paths:
|
|||
required: true
|
||||
description: The conversation's `id` value.
|
||||
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:
|
||||
required: true
|
||||
content:
|
||||
|
@ -126,7 +130,9 @@ paths:
|
|||
required: true
|
||||
description: The conversation's `id` value.
|
||||
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:
|
||||
200:
|
||||
description: Indicates a successful call.
|
||||
|
@ -162,7 +168,9 @@ paths:
|
|||
required: true
|
||||
description: The conversation's `id` value.
|
||||
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:
|
||||
required: true
|
||||
content:
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
KnowledgeBaseEntryResponse,
|
||||
KnowledgeBaseEntryUpdateProps,
|
||||
} from './common_attributes.gen';
|
||||
import { UUID } from '../common_attributes.gen';
|
||||
import { UUID, NonEmptyString } from '../common_attributes.gen';
|
||||
|
||||
export type CreateKnowledgeBaseEntryRequestBody = z.infer<
|
||||
typeof CreateKnowledgeBaseEntryRequestBody
|
||||
|
@ -41,7 +41,7 @@ export const DeleteKnowledgeBaseEntryRequestParams = z.object({
|
|||
/**
|
||||
* The Knowledge Base Entry's `id` value
|
||||
*/
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
});
|
||||
export type DeleteKnowledgeBaseEntryRequestParamsInput = z.input<
|
||||
typeof DeleteKnowledgeBaseEntryRequestParams
|
||||
|
@ -57,7 +57,7 @@ export const ReadKnowledgeBaseEntryRequestParams = z.object({
|
|||
/**
|
||||
* The Knowledge Base Entry's `id` value.
|
||||
*/
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
});
|
||||
export type ReadKnowledgeBaseEntryRequestParamsInput = z.input<
|
||||
typeof ReadKnowledgeBaseEntryRequestParams
|
||||
|
@ -73,7 +73,7 @@ export const UpdateKnowledgeBaseEntryRequestParams = z.object({
|
|||
/**
|
||||
* The Knowledge Base Entry's `id` value
|
||||
*/
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
});
|
||||
export type UpdateKnowledgeBaseEntryRequestParamsInput = z.input<
|
||||
typeof UpdateKnowledgeBaseEntryRequestParams
|
||||
|
|
|
@ -45,7 +45,9 @@ paths:
|
|||
required: true
|
||||
description: The Knowledge Base Entry's `id` value.
|
||||
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:
|
||||
200:
|
||||
description: Successful request returning a Knowledge Base Entry
|
||||
|
@ -72,7 +74,9 @@ paths:
|
|||
required: true
|
||||
description: The Knowledge Base Entry's `id` value
|
||||
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:
|
||||
required: true
|
||||
content:
|
||||
|
@ -105,7 +109,9 @@ paths:
|
|||
required: true
|
||||
description: The Knowledge Base Entry's `id` value
|
||||
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:
|
||||
200:
|
||||
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 const PromptResponse = z.object({
|
||||
id: UUID,
|
||||
id: z.union([UUID, NonEmptyString]),
|
||||
timestamp: NonEmptyString.optional(),
|
||||
name: z.string(),
|
||||
promptType: z.string(),
|
||||
|
|
|
@ -105,7 +105,9 @@ components:
|
|||
- content
|
||||
properties:
|
||||
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':
|
||||
$ref: '../common_attributes.schema.yaml#/components/schemas/NonEmptyString'
|
||||
name:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue