@checkdigit/eslint-plugin 7.18.0-PR.143-072f → 7.18.0-PR.143-8126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-mjs/athena/api-locator.mjs +9 -3
- package/dist-mjs/athena/api-matcher.mjs +4 -2
- package/dist-mjs/athena/athena.mjs +5 -5
- package/dist-mjs/openapi/generate-schema.mjs +9 -1
- package/dist-mjs/openapi/service-schema-generator.mjs +40 -18
- package/dist-types/athena/api-locator.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/v1/swagger.yml +81 -0
- package/src/athena/api-locator.ts +9 -2
- package/src/athena/api-matcher.ts +3 -1
- package/src/athena/athena.ts +4 -4
- package/src/openapi/generate-schema.ts +12 -0
- package/src/openapi/service-schema-generator.ts +46 -19
- package/src/services/eslintPlugin/v1/swagger.schema.deref.json +167 -0
- package/src/services/interchange/v1/swagger.schema.deref.json +1 -75
- package/src/services/interchange/v1/swagger.schema.json +1 -51
- package/src/services/ledger/v1/swagger.schema.deref.json +49 -2610
- package/src/services/ledger/v1/swagger.schema.json +106 -878
- package/src/services/link/v1/swagger.schema.deref.json +3 -426
- package/src/services/link/v1/swagger.schema.json +3 -261
- package/src/services/message/v1/swagger.schema.deref.json +1669 -8447
- package/src/services/message/v1/swagger.schema.json +5 -531
- package/src/services/message/v2/swagger.schema.deref.json +5125 -27716
- package/src/services/message/v2/swagger.schema.json +5 -523
- package/src/services/paymentCard/v1/swagger.schema.deref.json +36 -1185
- package/src/services/paymentCard/v1/swagger.schema.json +5 -499
- package/src/services/paymentCard/v2/swagger.schema.deref.json +60 -1186
- package/src/services/paymentCard/v2/swagger.schema.json +5 -511
- package/src/services/person/v1/swagger.schema.deref.json +510 -2348
- package/src/services/person/v1/swagger.schema.json +4 -470
- package/src/services/teampayClientManagement/v1/swagger.schema.deref.json +155 -1254
- package/src/services/teampayClientManagement/v1/swagger.schema.json +3 -369
- package/src/services/vault/v2/swagger.schema.deref.json +2048 -0
|
@@ -84,30 +84,56 @@ function readServiceConfig(
|
|
|
84
84
|
return { organization: pkgOrg, serviceName: pkgServiceName, apiRoot, endpoints: apiEndpoints };
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
function findServiceLocally(serviceFolder: string, org: string, serviceName: string): ServiceSource | null {
|
|
88
|
+
const config = readServiceConfig(readFileSync(`${serviceFolder}/package.json`, 'utf-8'), org, serviceName);
|
|
89
|
+
if (config === null) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const endpoints: ServiceEndpoint[] = [];
|
|
94
|
+
for (const endpoint of config.endpoints) {
|
|
95
|
+
const swaggerPath = `${serviceFolder}/${config.apiRoot}/${endpoint}/swagger.yml`;
|
|
96
|
+
if (existsSync(swaggerPath)) {
|
|
97
|
+
endpoints.push({ path: endpoint, yamlContent: readFileSync(swaggerPath, 'utf-8') });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (endpoints.length > 0) {
|
|
102
|
+
return { organization: config.organization, serviceName: config.serviceName, endpoints };
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function findServiceInProject(serviceName: string): ServiceSource | null {
|
|
108
|
+
const packageJsonString = readFileSync(`./package.json`, 'utf-8');
|
|
109
|
+
const packageJson = JSON.parse(packageJsonString) as unknown as { name: string };
|
|
110
|
+
const [org, projectName] = packageJson.name.slice(1).split('/');
|
|
111
|
+
if (org === undefined) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (projectName === serviceName) {
|
|
116
|
+
log('service is the current project, looking for API schemas locally', serviceName);
|
|
117
|
+
const serviceSource = findServiceLocally('.', org, serviceName);
|
|
118
|
+
if (serviceSource !== null) {
|
|
119
|
+
return serviceSource;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
87
126
|
function findServiceInNodeModules(serviceName: string): ServiceSource | null {
|
|
88
127
|
for (const org of GITHUB_ORGANIZATIONS) {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
if (!existsSync(packageJsonPath)) {
|
|
128
|
+
const serviceFolder = `node_modules/@${org}/${serviceName}`;
|
|
129
|
+
if (!existsSync(serviceFolder)) {
|
|
92
130
|
continue;
|
|
93
131
|
}
|
|
94
132
|
|
|
95
133
|
try {
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const endpoints: ServiceEndpoint[] = [];
|
|
102
|
-
for (const endpoint of config.endpoints) {
|
|
103
|
-
const swaggerPath = `${packageDir}/${config.apiRoot}/${endpoint}/swagger.yml`;
|
|
104
|
-
if (existsSync(swaggerPath)) {
|
|
105
|
-
endpoints.push({ path: endpoint, yamlContent: readFileSync(swaggerPath, 'utf-8') });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (endpoints.length > 0) {
|
|
110
|
-
return { organization: config.organization, serviceName: config.serviceName, endpoints };
|
|
134
|
+
const serviceSource = findServiceLocally(serviceFolder, org, serviceName);
|
|
135
|
+
if (serviceSource !== null) {
|
|
136
|
+
return serviceSource;
|
|
111
137
|
}
|
|
112
138
|
} catch {
|
|
113
139
|
// continue to next org
|
|
@@ -157,7 +183,8 @@ export function generateSchemasForService(
|
|
|
157
183
|
): { schema: ApiSchemas; endpoint: string }[] {
|
|
158
184
|
log('generating schemas for service', serviceName);
|
|
159
185
|
|
|
160
|
-
const source =
|
|
186
|
+
const source =
|
|
187
|
+
findServiceInProject(serviceName) ?? findServiceInNodeModules(serviceName) ?? findServiceOnGitHub(serviceName);
|
|
161
188
|
if (source === null) {
|
|
162
189
|
log('no swagger source found for service', serviceName);
|
|
163
190
|
return [];
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apis": {
|
|
3
|
+
"/eslint-plugin/v1/ping": {
|
|
4
|
+
"get": {
|
|
5
|
+
"request": {
|
|
6
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
7
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/api/PingGetRequestContext",
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"headers": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"additionalProperties": true
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": [],
|
|
16
|
+
"additionalProperties": false
|
|
17
|
+
},
|
|
18
|
+
"responses": {
|
|
19
|
+
"200": {
|
|
20
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
21
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/api/PingGetResponseOK",
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"headers": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": true
|
|
27
|
+
},
|
|
28
|
+
"body": {
|
|
29
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
30
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/definitions/Ping",
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"required": ["serverTime"],
|
|
34
|
+
"properties": {
|
|
35
|
+
"serverTime": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"format": "date-time",
|
|
38
|
+
"description": "Current server time"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": ["body"],
|
|
44
|
+
"additionalProperties": false
|
|
45
|
+
},
|
|
46
|
+
"default": {
|
|
47
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
48
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/api/PingGetResponseDefault",
|
|
49
|
+
"type": "object",
|
|
50
|
+
"properties": {
|
|
51
|
+
"headers": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": true
|
|
54
|
+
},
|
|
55
|
+
"body": {
|
|
56
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
57
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/definitions/Error",
|
|
58
|
+
"type": "object",
|
|
59
|
+
"additionalProperties": false,
|
|
60
|
+
"description": "Error message",
|
|
61
|
+
"properties": {
|
|
62
|
+
"message": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"code": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": ["body"],
|
|
72
|
+
"additionalProperties": false
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"head": {
|
|
77
|
+
"request": {
|
|
78
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
79
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/api/PingHeadRequestContext",
|
|
80
|
+
"type": "object",
|
|
81
|
+
"properties": {
|
|
82
|
+
"headers": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"additionalProperties": true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"required": [],
|
|
88
|
+
"additionalProperties": false
|
|
89
|
+
},
|
|
90
|
+
"responses": {
|
|
91
|
+
"200": {
|
|
92
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
93
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/api/PingHeadResponseOK",
|
|
94
|
+
"type": "object",
|
|
95
|
+
"properties": {
|
|
96
|
+
"headers": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"additionalProperties": true
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"required": [],
|
|
102
|
+
"additionalProperties": false
|
|
103
|
+
},
|
|
104
|
+
"default": {
|
|
105
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
106
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/api/PingHeadResponseDefault",
|
|
107
|
+
"type": "object",
|
|
108
|
+
"properties": {
|
|
109
|
+
"headers": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"additionalProperties": true
|
|
112
|
+
},
|
|
113
|
+
"body": {
|
|
114
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
115
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/definitions/Error",
|
|
116
|
+
"type": "object",
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"description": "Error message",
|
|
119
|
+
"properties": {
|
|
120
|
+
"message": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"code": {
|
|
124
|
+
"type": "string"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": ["body"],
|
|
130
|
+
"additionalProperties": false
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"definitions": {
|
|
137
|
+
"Ping": {
|
|
138
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
139
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/definitions/Ping",
|
|
140
|
+
"type": "object",
|
|
141
|
+
"additionalProperties": false,
|
|
142
|
+
"required": ["serverTime"],
|
|
143
|
+
"properties": {
|
|
144
|
+
"serverTime": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"format": "date-time",
|
|
147
|
+
"description": "Current server time"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"Error": {
|
|
152
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
153
|
+
"$id": "https://eslint-plugin.checkdigit/eslint-plugin/v1/schemas/definitions/Error",
|
|
154
|
+
"type": "object",
|
|
155
|
+
"additionalProperties": false,
|
|
156
|
+
"description": "Error message",
|
|
157
|
+
"properties": {
|
|
158
|
+
"message": {
|
|
159
|
+
"type": "string"
|
|
160
|
+
},
|
|
161
|
+
"code": {
|
|
162
|
+
"type": "string"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -1,80 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apis": {
|
|
3
|
-
"/interchange/v1/ping": {
|
|
4
|
-
"get": {
|
|
5
|
-
"request": {
|
|
6
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
7
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/api/PingGetRequestContext",
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"headers": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"additionalProperties": true
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"required": [],
|
|
16
|
-
"additionalProperties": false
|
|
17
|
-
},
|
|
18
|
-
"responses": {
|
|
19
|
-
"200": {
|
|
20
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
21
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/api/PingGetResponseOK",
|
|
22
|
-
"type": "object",
|
|
23
|
-
"properties": {
|
|
24
|
-
"headers": {
|
|
25
|
-
"type": "object",
|
|
26
|
-
"additionalProperties": true
|
|
27
|
-
},
|
|
28
|
-
"body": {
|
|
29
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
30
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/definitions/Ping",
|
|
31
|
-
"type": "object",
|
|
32
|
-
"additionalProperties": false,
|
|
33
|
-
"required": ["serverTime"],
|
|
34
|
-
"properties": {
|
|
35
|
-
"serverTime": {
|
|
36
|
-
"type": "string",
|
|
37
|
-
"format": "date-time",
|
|
38
|
-
"description": "Current server time"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"required": ["body"],
|
|
44
|
-
"additionalProperties": false
|
|
45
|
-
},
|
|
46
|
-
"default": {
|
|
47
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
48
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/api/PingGetResponseDefault",
|
|
49
|
-
"type": "object",
|
|
50
|
-
"properties": {
|
|
51
|
-
"headers": {
|
|
52
|
-
"type": "object",
|
|
53
|
-
"additionalProperties": true
|
|
54
|
-
},
|
|
55
|
-
"body": {
|
|
56
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
57
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/definitions/Error",
|
|
58
|
-
"type": "object",
|
|
59
|
-
"additionalProperties": false,
|
|
60
|
-
"properties": {
|
|
61
|
-
"message": {
|
|
62
|
-
"type": "string"
|
|
63
|
-
},
|
|
64
|
-
"code": {
|
|
65
|
-
"type": "string",
|
|
66
|
-
"minLength": 1,
|
|
67
|
-
"enum": ["CREATED ON TOO FAR IN FUTURE"]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
"required": ["body"],
|
|
73
|
-
"additionalProperties": false
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
},
|
|
3
|
+
"/interchange/v1/ping": {},
|
|
78
4
|
"/interchange/v1/interchange/:interchangeId": {
|
|
79
5
|
"put": {
|
|
80
6
|
"request": {
|
|
@@ -1,56 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"apis": {
|
|
3
|
-
"/interchange/v1/ping": {
|
|
4
|
-
"get": {
|
|
5
|
-
"request": {
|
|
6
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
7
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/api/PingGetRequestContext",
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"headers": {
|
|
11
|
-
"type": "object",
|
|
12
|
-
"additionalProperties": true
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"required": [],
|
|
16
|
-
"additionalProperties": false
|
|
17
|
-
},
|
|
18
|
-
"responses": {
|
|
19
|
-
"200": {
|
|
20
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
21
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/api/PingGetResponseOK",
|
|
22
|
-
"type": "object",
|
|
23
|
-
"properties": {
|
|
24
|
-
"headers": {
|
|
25
|
-
"type": "object",
|
|
26
|
-
"additionalProperties": true
|
|
27
|
-
},
|
|
28
|
-
"body": {
|
|
29
|
-
"$ref": "/interchange/v1/schemas/definitions/Ping"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"required": ["body"],
|
|
33
|
-
"additionalProperties": false
|
|
34
|
-
},
|
|
35
|
-
"default": {
|
|
36
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
37
|
-
"$id": "https://eslint-plugin.checkdigit/interchange/v1/schemas/api/PingGetResponseDefault",
|
|
38
|
-
"type": "object",
|
|
39
|
-
"properties": {
|
|
40
|
-
"headers": {
|
|
41
|
-
"type": "object",
|
|
42
|
-
"additionalProperties": true
|
|
43
|
-
},
|
|
44
|
-
"body": {
|
|
45
|
-
"$ref": "/interchange/v1/schemas/definitions/Error"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"required": ["body"],
|
|
49
|
-
"additionalProperties": false
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
3
|
+
"/interchange/v1/ping": {},
|
|
54
4
|
"/interchange/v1/interchange/:interchangeId": {
|
|
55
5
|
"put": {
|
|
56
6
|
"request": {
|