Skip to content

Commit c8e8c6c

Browse files
committed
chore: lint
1 parent df26046 commit c8e8c6c

6 files changed

Lines changed: 43 additions & 63 deletions

File tree

__tests__/example.json

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
"schemas": {
99
"Address": {
1010
"type": "object",
11-
"required": [
12-
"name"
13-
],
11+
"required": ["name"],
1412
"additionalProperties": false,
1513
"properties": {
1614
"postcode": {
@@ -26,9 +24,7 @@
2624
},
2725
"User": {
2826
"type": "object",
29-
"required": [
30-
"name"
31-
],
27+
"required": ["name"],
3228
"additionalProperties": false,
3329
"properties": {
3430
"userId": {
@@ -64,9 +60,7 @@
6460
},
6561
"CreateUserRequest": {
6662
"type": "object",
67-
"required": [
68-
"name"
69-
],
63+
"required": ["name"],
7064
"additionalProperties": false,
7165
"properties": {
7266
"userId": {
@@ -115,9 +109,7 @@
115109
"/users": {
116110
"get": {
117111
"operationId": "listUsersCommand",
118-
"tags": [
119-
"user"
120-
],
112+
"tags": ["user"],
121113
"responses": {
122114
"200": {
123115
"description": "User 200 response",
@@ -133,10 +125,7 @@
133125
},
134126
"post": {
135127
"operationId": "createUserCommand",
136-
"tags": [
137-
"user",
138-
"random"
139-
],
128+
"tags": ["user", "random"],
140129
"requestBody": {
141130
"description": "",
142131
"content": {
@@ -182,21 +171,14 @@
182171
"operationId": "deleteUserByIdCommand",
183172
"security": [
184173
{
185-
"HttpBearerJwtScheme": [
186-
"users.delete"
187-
]
174+
"HttpBearerJwtScheme": ["users.delete"]
188175
}
189176
],
190-
"tags": [
191-
"user",
192-
"random"
193-
]
177+
"tags": ["user", "random"]
194178
},
195179
"head": {
196180
"operationId": "checkUserIdAvailableCommand",
197-
"security": [
198-
{}
199-
],
181+
"security": [{}],
200182
"tags": []
201183
},
202184
"post": {
@@ -237,10 +219,8 @@
237219
"HttpBearerJwtScheme": []
238220
},
239221
{
240-
"HttpBearerJwtScheme": [
241-
"users.delete"
242-
]
222+
"HttpBearerJwtScheme": ["users.delete"]
243223
},
244224
{}
245225
]
246-
}
226+
}

__tests__/example.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ components:
2424
additionalProperties: false
2525
properties:
2626
userId:
27-
$ref: "#/components/schemas/Id"
27+
$ref: '#/components/schemas/Id'
2828
name:
2929
type: string
3030
address:
31-
$ref: "#/components/schemas/Address"
31+
$ref: '#/components/schemas/Address'
3232
age:
3333
type: integer
3434
format: int32
@@ -39,7 +39,7 @@ components:
3939
additionalProperties: false
4040
properties:
4141
address:
42-
$ref: "#/components/schemas/Address"
42+
$ref: '#/components/schemas/Address'
4343
age:
4444
type: integer
4545
format: int32
@@ -49,14 +49,14 @@ components:
4949
type: array
5050
uniqueItems: true
5151
items:
52-
$ref: "#/components/schemas/User"
52+
$ref: '#/components/schemas/User'
5353
parameters:
5454
UserId:
5555
name: userId
5656
in: path
5757
required: true
5858
schema:
59-
$ref: "#/components/schemas/Id"
59+
$ref: '#/components/schemas/Id'
6060
securitySchemes:
6161
HttpBearerJwtScheme:
6262
type: http
@@ -69,41 +69,41 @@ paths:
6969
tags:
7070
- user
7171
responses:
72-
"200":
72+
'200':
7373
description: User 200 response
7474
content:
7575
application/json:
7676
schema:
77-
$ref: "#/components/schemas/Users"
77+
$ref: '#/components/schemas/Users'
7878
post:
7979
operationId: createUserCommand
8080
tags:
8181
- user
8282
- random
8383
requestBody:
84-
description: ""
84+
description: ''
8585
content:
8686
application/json:
8787
schema:
88-
$ref: "#/components/schemas/CreateUserRequest"
88+
$ref: '#/components/schemas/CreateUserRequest'
8989
responses:
90-
"200":
90+
'200':
9191
description: User 200 response
9292
content:
9393
application/json:
9494
schema:
95-
$ref: "#/components/schemas/Users"
96-
"/users/{userId}":
95+
$ref: '#/components/schemas/Users'
96+
'/users/{userId}':
9797
get:
9898
operationId: getUserByIdCommand
9999
tags: []
100100
responses:
101-
"200":
101+
'200':
102102
description: User 200 response
103103
content:
104104
application/json:
105105
schema:
106-
$ref: "#/components/schemas/User"
106+
$ref: '#/components/schemas/User'
107107
delete:
108108
operationId: deleteUserByIdCommand
109109
security:
@@ -121,20 +121,20 @@ paths:
121121
operationId: updateUserCommand
122122
tags: []
123123
requestBody:
124-
description: ""
124+
description: ''
125125
content:
126126
application/json:
127127
schema:
128-
$ref: "#/components/schemas/UpdateUserRequest"
128+
$ref: '#/components/schemas/UpdateUserRequest'
129129
responses:
130-
"200":
131-
description: ""
130+
'200':
131+
description: ''
132132
content:
133133
application/json:
134134
schema:
135-
$ref: "#/components/schemas/User"
135+
$ref: '#/components/schemas/User'
136136
parameters:
137-
- $ref: "#/components/parameters/UserId"
137+
- $ref: '#/components/parameters/UserId'
138138
security:
139139
- HttpBearerJwtScheme: []
140140
- HttpBearerJwtScheme: *a2

lib/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Construct, IConstruct } from 'constructs';
1+
import { Construct, type IConstruct } from 'constructs';
22
import type { JSONSchema4, JSONSchema7 } from 'json-schema';
33
import type { OpenAPIV3_1 } from 'openapi-types';
44
import { Parameter } from './parameter.js';

lib/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ export const { HttpMethods } = OpenAPIV3;
88
// everyone is using the same version
99
export { Construct };
1010

11-
export { Api, OpenApiVersion } from '../lib/api.js';
12-
export { Parameter } from '../lib/parameter.js';
13-
export { Path } from '../lib/path.js';
14-
export { Reference } from '../lib/reference.js';
15-
export { Response } from '../lib/response.js';
16-
export { Schema } from '../lib/schema.js';
17-
export { SecurityRequirement } from '../lib/security-requirement.js';
18-
export { SecurityScheme } from '../lib/security-scheme.js';
19-
export { Server } from '../lib/server.js';
20-
export { Tag } from '../lib/tag.js';
11+
export { Api, OpenApiVersion } from './api.js';
12+
export { Parameter } from './parameter.js';
13+
export { Path } from './path.js';
14+
export { Reference } from './reference.js';
15+
export { Response } from './response.js';
16+
export { Schema } from './schema.js';
17+
export { SecurityRequirement } from './security-requirement.js';
18+
export { SecurityScheme } from './security-scheme.js';
19+
export { Server } from './server.js';
20+
export { Tag } from './tag.js';
2121

2222
export class ServerVariable extends Construct {}
2323

lib/operation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Construct } from 'constructs';
22
import type { OpenAPIV3_1 } from 'openapi-types';
33
import type { Parameter } from './parameter.js';
4-
import { RequestBody, RequestBodyOptions } from './request-body.js';
4+
import { RequestBody, type RequestBodyOptions } from './request-body.js';
55
import type { Response } from './response.js';
66
import type { SecurityRequirement } from './security-requirement.js';
77
import type { Tag } from './tag.js';

lib/path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import assert from 'node:assert';
1+
import * as assert from 'node:assert';
22
import { Construct } from 'constructs';
33
import type { OpenAPIV3_1 } from 'openapi-types';
44
import type { Api } from './api.js';

0 commit comments

Comments
 (0)