Skip to content

Commit c1e5be0

Browse files
committed
chore: use our own http methods object instead of the enum inside the types package
1 parent fe1b02f commit c1e5be0

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

lib/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/* eslint-disable max-classes-per-file */
22
import { Construct } from 'constructs';
3-
import { OpenAPIV3 } from 'openapi-types';
43

5-
export const { HttpMethods } = OpenAPIV3;
4+
export { HttpMethods } from './http-methods.js';
65

76
// export the version of Constructs we are using to ensure we're
87
// everyone is using the same version

lib/operation.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Construct } from 'constructs';
22
import type { OpenAPIV3_1 } from 'openapi-types';
3+
import type { HttpMethods } from './http-methods.js';
34
import type { Parameter } from './parameter.js';
45
import { RequestBody, type RequestBodyOptions } from './request-body.js';
56
import type { Response } from './response.js';
@@ -24,7 +25,7 @@ export interface OperationOptions<TPath extends string = '/'> {
2425
export class Operation<TPath extends string = '/'> extends Construct {
2526
private readonly options: OperationOptions<TPath>;
2627

27-
public readonly method: OpenAPIV3_1.HttpMethods;
28+
public readonly method: HttpMethods;
2829

2930
private requestBody?: RequestBody;
3031

@@ -34,7 +35,7 @@ export class Operation<TPath extends string = '/'> extends Construct {
3435

3536
constructor(
3637
scope: Construct,
37-
method: OpenAPIV3_1.HttpMethods,
38+
method: HttpMethods,
3839
options: OperationOptions<TPath>,
3940
) {
4041
super(scope, method);

lib/path.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { strict } from 'node:assert';
22
import { Construct } from 'constructs';
33
import type { OpenAPIV3_1 } from 'openapi-types';
44
import type { Api } from './api.js';
5+
import { HttpMethods } from './http-methods.js';
56
import { Operation, type OperationOptions } from './operation.js';
67
import type { Parameter } from './parameter.js';
78
import type { Server } from './server.js';
@@ -25,7 +26,7 @@ export class Path<TPath extends string = '/'> extends Construct {
2526
}
2627

2728
public addOperation(
28-
method: OpenAPIV3_1.HttpMethods,
29+
method: HttpMethods,
2930
options: OperationOptions<TPath>,
3031
): this {
3132
// make sure we are not duplicating tags
@@ -43,7 +44,7 @@ export class Path<TPath extends string = '/'> extends Construct {
4344
return this.options.path;
4445
}
4546

46-
public synth(): OpenAPIV3_1.PathItemObject {
47+
public synth() {
4748
return {
4849
...Object.fromEntries(
4950
this.node

0 commit comments

Comments
 (0)