Skip to content

Commit 3fe4bcd

Browse files
feat: export more individual types for arazzo (#1630)
1 parent 4e2f993 commit 3fe4bcd

2 files changed

Lines changed: 52 additions & 12 deletions

File tree

packages/core/src/types/arazzo.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { getNodeTypesFromJSONSchema } from './json-schema-adapter';
44

55
export const ARAZZO_ROOT_TYPE = 'Root';
66

7-
const operationMethod = {
7+
export const operationMethod = {
88
type: 'string',
99
enum: ['get', 'post', 'put', 'delete', 'patch'],
1010
} as const;
11-
const expectSchema = {
11+
export const expectSchema = {
1212
type: 'object',
1313
properties: {
1414
statusCode: { type: 'number' },
@@ -58,7 +58,7 @@ const arazzoSourceDescriptionSchema = {
5858
additionalProperties: false,
5959
required: ['name', 'type', 'url'],
6060
} as const;
61-
const sourceDescriptionSchema = {
61+
export const sourceDescriptionSchema = {
6262
type: 'object',
6363
oneOf: [
6464
openAPISourceDescriptionSchema,
@@ -81,7 +81,7 @@ const extendedOperation = {
8181
additionalProperties: false,
8282
required: ['path', 'method'],
8383
} as const;
84-
const parameter = {
84+
export const parameter = {
8585
type: 'object',
8686
oneOf: [
8787
{
@@ -124,7 +124,7 @@ const parameters = {
124124
type: 'array',
125125
items: parameter,
126126
} as const;
127-
const infoObject = {
127+
export const infoObject = {
128128
type: 'object',
129129
properties: {
130130
title: { type: 'string' },
@@ -135,7 +135,7 @@ const infoObject = {
135135
additionalProperties: false,
136136
required: ['title', 'version'],
137137
} as const;
138-
const replacement = {
138+
export const replacement = {
139139
type: 'object',
140140
properties: {
141141
target: { type: 'string' },
@@ -150,7 +150,7 @@ const replacement = {
150150
},
151151
},
152152
} as const;
153-
const requestBody = {
153+
export const requestBody = {
154154
type: 'object',
155155
properties: {
156156
contentType: { type: 'string' },
@@ -172,7 +172,7 @@ const requestBody = {
172172
additionalProperties: false,
173173
required: ['payload'],
174174
} as const;
175-
const criteriaObject = {
175+
export const criteriaObject = {
176176
type: 'object',
177177
properties: {
178178
condition: { type: 'string' },
@@ -204,7 +204,7 @@ const criteriaObjects = {
204204
type: 'array',
205205
items: criteriaObject,
206206
} as const;
207-
const inherit = {
207+
export const inherit = {
208208
type: 'string',
209209
enum: ['auto', 'none'],
210210
} as const;
@@ -242,7 +242,7 @@ const onFailureList = {
242242
type: 'array',
243243
items: onFailureObject,
244244
} as const;
245-
const step = {
245+
export const step = {
246246
type: 'object',
247247
properties: {
248248
stepId: { type: 'string' },
@@ -317,7 +317,7 @@ const JSONSchema = {
317317
required: ['type'],
318318
additionalProperties: true,
319319
} as const;
320-
const workflow = {
320+
export const workflow = {
321321
type: 'object',
322322
properties: {
323323
workflowId: { type: 'string' },
Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,44 @@
11
import type { FromSchema } from 'json-schema-to-ts';
2-
import type { arazzoSchema } from '../types/arazzo';
2+
import type {
3+
arazzoSchema,
4+
parameter,
5+
operationMethod,
6+
expectSchema,
7+
sourceDescriptionSchema,
8+
infoObject,
9+
requestBody,
10+
replacement,
11+
inherit,
12+
criteriaObject,
13+
step,
14+
workflow,
15+
} from '../types/arazzo';
316

417
export type ArazzoDefinition = FromSchema<typeof arazzoSchema>;
18+
export type OperationMethod = FromSchema<typeof operationMethod>;
19+
export type ResponseContext = {
20+
statusCode: number;
21+
body: any;
22+
headers: Headers;
23+
mimeType: string;
24+
} & Record<string, any>;
25+
export type Expect = FromSchema<typeof expectSchema>;
26+
export type SourceDescription = FromSchema<typeof sourceDescriptionSchema>;
27+
export type Parameter = FromSchema<typeof parameter>;
28+
export type InfoObject = FromSchema<typeof infoObject>;
29+
export type RequestBody = FromSchema<typeof requestBody>;
30+
export type Replacement = FromSchema<typeof replacement>;
31+
export type Inherit = FromSchema<typeof inherit>;
32+
export type CriteriaObject = FromSchema<typeof criteriaObject>;
33+
export type VerboseLog = {
34+
method: OperationMethod;
35+
path: string;
36+
host: string;
37+
body?: any;
38+
headerParams?: Record<string, string>;
39+
statusCode?: number;
40+
};
41+
export type Step = FromSchema<typeof step>;
42+
export type Workflow = FromSchema<typeof workflow> & {
43+
steps: Step[];
44+
};

0 commit comments

Comments
 (0)