tangled
alpha
login
or
join now
mokkenstorm.dev
/
openapi-ts
0
fork
atom
fork of hey-api/openapi-ts because I need some additional things
0
fork
atom
overview
issues
pulls
pipelines
chore: document types update
Lubos
1 year ago
cebf3270
c2ee902b
+13
-18
3 changed files
expand all
collapse all
unified
split
.changeset
fast-dolls-pull.md
packages
openapi-ts
src
plugins
@hey-api
services
plugin.ts
transformers
plugin.ts
+5
.changeset/fast-dolls-pull.md
···
1
1
+
---
2
2
+
'@hey-api/openapi-ts': patch
3
3
+
---
4
4
+
5
5
+
fix: export a map of error and response types by status code
+2
-2
packages/openapi-ts/src/plugins/@hey-api/services/plugin.ts
···
19
19
import { irRef } from '../../../utils/ref';
20
20
import { transformServiceName } from '../../../utils/transform';
21
21
import type { PluginHandler } from '../../types';
22
22
-
import { operationResponseTransformerRef } from '../transformers/plugin';
22
22
+
import { operationTransformerIrRef } from '../transformers/plugin';
23
23
import {
24
24
operationOptionsType,
25
25
serviceFunctionIdentifier,
···
139
139
const fileTransformers = context.file({ id: 'transformers' });
140
140
if (fileTransformers) {
141
141
const identifier = fileTransformers.identifier({
142
142
-
$ref: operationResponseTransformerRef({ id: operation.id }),
142
142
+
$ref: operationTransformerIrRef({ id: operation.id, type: 'response' }),
143
143
namespace: 'value',
144
144
});
145
145
if (identifier.name) {
+6
-16
packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts
···
21
21
id: string;
22
22
}
23
23
24
24
-
const operationTransformerIrRef = ({
24
24
+
export const operationTransformerIrRef = ({
25
25
id,
26
26
type,
27
27
}: OperationIRRef & {
···
45
45
pascalCase: false,
46
46
})}${affix}`;
47
47
};
48
48
-
49
49
-
// TODO: parser - currently unused
50
50
-
export const operationDataTransformerRef = ({ id }: OperationIRRef): string =>
51
51
-
operationTransformerIrRef({ id, type: 'data' });
52
52
-
53
53
-
// TODO: parser - currently unused
54
54
-
export const operationErrorTransformerRef = ({ id }: OperationIRRef): string =>
55
55
-
operationTransformerIrRef({ id, type: 'error' });
56
56
-
57
57
-
export const operationResponseTransformerRef = ({
58
58
-
id,
59
59
-
}: OperationIRRef): string =>
60
60
-
operationTransformerIrRef({ id, type: 'response' });
61
48
62
49
const schemaIrRef = ({
63
50
$ref,
···
394
381
}
395
382
396
383
let identifierResponseTransformer = file.identifier({
397
397
-
$ref: operationResponseTransformerRef({ id: operation.id }),
384
384
+
$ref: operationTransformerIrRef({ id: operation.id, type: 'response' }),
398
385
create: true,
399
386
namespace: 'value',
400
387
});
···
442
429
// the created schema response transformer was empty, do not generate
443
430
// it and prevent any future attempts
444
431
identifierResponseTransformer = file.blockIdentifier({
445
445
-
$ref: operationResponseTransformerRef({ id: operation.id }),
432
432
+
$ref: operationTransformerIrRef({
433
433
+
id: operation.id,
434
434
+
type: 'response',
435
435
+
}),
446
436
namespace: 'value',
447
437
});
448
438
}