Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automatic Import] Modify codegen to autogenerate openAPI spec code #193243

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { Integration } from '../../common/api/model/common_attributes';
import { Integration } from '../../common';

export const testIntegration: Integration = {
name: 'integration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SamplesFormatName } from '../../common/api/model/common_attributes';
import { SamplesFormatName } from '../../common';
import type { Pipeline } from '../../common';

export const categorizationInitialPipeline: Pipeline = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SamplesFormatName } from '../../common/api/model/common_attributes';
import { SamplesFormatName } from '../../common';

export const ecsMappingExpectedResults = {
mapping: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SamplesFormatName } from '../../common/api/model/common_attributes';
import { SamplesFormatName } from '../../common';

export const kvState = {
lastExecutedChain: 'testchain',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SamplesFormatName } from '../../common/api/model/common_attributes';
import { SamplesFormatName } from '../../common';

export const logFormatDetectionTestState = {
lastExecutedChain: 'testchain',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { SamplesFormatName } from '../../common/api/model/common_attributes';
import { SamplesFormatName } from '../../common';
import type { Pipeline } from '../../common';

export const relatedInitialPipeline: Pipeline = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
import { z } from '@kbn/zod';

import {
PackageName,
DataStreamName,
LogSamples,
Connector,
LangSmithOptions,
DataStreamName,
PackageName,
} from '../model/common_attributes';
import { AnalyzeLogsAPIResponse } from '../model/response_schemas';
} from '../model/common_attributes.gen';
import { AnalyzeLogsAPIResponse } from '../model/response_schemas.gen';

export type AnalyzeLogsRequestBody = z.infer<typeof AnalyzeLogsRequestBody>;
export const AnalyzeLogsRequestBody = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ paths:
post:
summary: Analyzes log samples and processes them.
operationId: AnalyzeLogs
x-codegen-enabled: false
x-codegen-enabled: true
description: Analyzes log samples and processes them
tags:
- Analyze Logs API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { expectParseSuccess } from '@kbn/zod-helpers';
import { AnalyzeLogsRequestBody } from './analyze_logs_route';
import { AnalyzeLogsRequestBody } from './analyze_logs_route.gen';
import { getAnalyzeLogsRequestBody } from '../model/api_test.mock';

describe('Analyze Logs request schema', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Integration Assistatnt Build Integrarion API endpoint
* version: 1
*/

import { z } from '@kbn/zod';

import { Integration } from '../model/common_attributes';
import { Integration } from '../model/common_attributes.gen';

export type BuildIntegrationRequestBody = z.infer<typeof BuildIntegrationRequestBody>;
export const BuildIntegrationRequestBody = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ paths:
post:
summary: Builds Integration with the given input samples
operationId: BuildIntegration
x-codegen-enabled: false
x-codegen-enabled: true
description: Build Integration for the given input samples
tags:
- Build Integration API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,36 @@
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Integration Assistatnt Categorization API endpoint
* version: 1
*/

import { z } from '@kbn/zod';

import {
Connector,
DataStreamName,
LangSmithOptions,
PackageName,
Pipeline,
DataStreamName,
RawSamples,
Pipeline,
Connector,
SamplesFormat,
} from '../model/common_attributes';
import { CategorizationAPIResponse } from '../model/response_schemas';
LangSmithOptions,
} from '../model/common_attributes.gen';
import { CategorizationAPIResponse } from '../model/response_schemas.gen';

export type CategorizationRequestBody = z.infer<typeof CategorizationRequestBody>;
export const CategorizationRequestBody = z.object({
packageName: PackageName,
dataStreamName: DataStreamName,
rawSamples: RawSamples,
samplesFormat: SamplesFormat,
currentPipeline: Pipeline,
connectorId: Connector,
samplesFormat: SamplesFormat,
langSmithOptions: LangSmithOptions.optional(),
});
export type CategorizationRequestBodyInput = z.input<typeof CategorizationRequestBody>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ paths:
post:
summary: Builds Categorization processors based on the samples
operationId: Categorization
x-codegen-enabled: false
x-codegen-enabled: true
description: Perform Categorization for the given ecs mappings.
tags:
- Categorization API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { expectParseSuccess } from '@kbn/zod-helpers';
import { CategorizationRequestBody } from './categorization_route';
import { CategorizationRequestBody } from './categorization_route.gen';
import { getCategorizationRequestMock } from '../model/api_test.mock';

describe('Categorization request schema', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Integration Assistatnt Check Pipeline API endpoint
* version: 1
*/

import { z } from '@kbn/zod';

import { Pipeline, RawSamples } from '../model/common_attributes';
import { CheckPipelineAPIResponse } from '../model/response_schemas';
import { RawSamples, Pipeline } from '../model/common_attributes.gen';
import { CheckPipelineAPIResponse } from '../model/response_schemas.gen';

export type CheckPipelineRequestBody = z.infer<typeof CheckPipelineRequestBody>;
export const CheckPipelineRequestBody = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ paths:
post:
summary: Checks if the pipeline is valid for the given samples
operationId: CheckPipeline
x-codegen-enabled: false
x-codegen-enabled: true
description: Check latest pipeline against the input samples.
tags:
- Check Pipeline API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import {
PackageName,
DataStreamName,
RawSamples,
SamplesFormat,
Mapping,
Connector,
LangSmithOptions,
SamplesFormat,
} from '../model/common_attributes';
import { ESProcessorItem } from '../model/processor_attributes';
import { EcsMappingAPIResponse } from '../model/response_schemas';
} from '../model/common_attributes.gen';
import { ESProcessorItem } from '../model/processor_attributes.gen';
import { EcsMappingAPIResponse } from '../model/response_schemas.gen';

export type EcsMappingRequestBody = z.infer<typeof EcsMappingRequestBody>;
export const EcsMappingRequestBody = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ paths:
post:
summary: Builds ECS Mapping based on the input samples
operationId: EcsMapping
x-codegen-enabled: false
x-codegen-enabled: true
description: Perform ECS mapping for the given input JSON samples
tags:
- ECS Mapping API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { expectParseSuccess } from '@kbn/zod-helpers';
import { EcsMappingRequestBody } from './ecs_route';
import { EcsMappingRequestBody } from './ecs_route.gen';
import { getEcsMappingRequestMock } from '../model/api_test.mock';

describe('Ecs Mapping request schema', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* 2.0.
*/

import type { AnalyzeLogsRequestBody } from '../analyze_logs/analyze_logs_route';
import type { BuildIntegrationRequestBody } from '../build_integration/build_integration';
import type { CategorizationRequestBody } from '../categorization/categorization_route';
import type { EcsMappingRequestBody } from '../ecs/ecs_route';
import type { RelatedRequestBody } from '../related/related_route';
import type { DataStream, Integration, Pipeline } from './common_attributes';
import type { AnalyzeLogsRequestBody } from '../analyze_logs/analyze_logs_route.gen';
import type { BuildIntegrationRequestBody } from '../build_integration/build_integration.gen';
import type { CategorizationRequestBody } from '../categorization/categorization_route.gen';
import type { EcsMappingRequestBody } from '../ecs/ecs_route.gen';
import type { RelatedRequestBody } from '../related/related_route.gen';
import type { DataStream, Integration, Pipeline } from './common_attributes.gen';

const rawSamples = ['{"test1": "test1"}'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@
* 2.0.
*/

/*
* NOTICE: Do not edit this file manually.
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
*
* info:
* title: Common Rule Attributes
* version: not applicable
*/

import { z } from '@kbn/zod';

import { ESProcessorItem } from './processor_attributes';
import { ESProcessorItem } from './processor_attributes.gen';

/**
* Package name for the integration to be built.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
version: "not applicable"
paths: {}
components:
x-codegen-enabled: false
x-codegen-enabled: true
schemas:
PackageName:
type: string
Expand Down
Loading