@contractkit/openapi-to-ck 0.8.2 → 0.9.0
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/.turbo/turbo-build$colon$ci.log +4 -4
- package/.turbo/turbo-test$colon$ci.log +12 -12
- package/CHANGELOG.md +11 -0
- package/coverage/clover.xml +121 -116
- package/coverage/coverage-final.json +2 -2
- package/coverage/index.html +15 -15
- package/coverage/src/ast-to-ck.ts.html +81 -60
- package/coverage/src/circular-refs.ts.html +1 -1
- package/coverage/src/convert.ts.html +1 -1
- package/coverage/src/index.html +15 -15
- package/coverage/src/normalize.ts.html +1 -1
- package/coverage/src/paths-to-ast.ts.html +1 -1
- package/coverage/src/schema-to-ast.ts.html +1 -1
- package/coverage/src/tag-splitter.ts.html +1 -1
- package/coverage/src/warnings.ts.html +1 -1
- package/coverage/tests/helpers.ts.html +11 -11
- package/coverage/tests/index.html +1 -1
- package/dist/{chunk-YOTHJ2V4.js → chunk-FMEMOXYD.js} +9 -2
- package/dist/{chunk-YOTHJ2V4.js.map → chunk-FMEMOXYD.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/plugin.js +1 -1
- package/package.json +2 -2
- package/src/ast-to-ck.ts +8 -1
- package/tests/ast-to-ck.test.ts +26 -0
package/dist/index.js
CHANGED
package/dist/plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractkit/openapi-to-ck",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Convert OpenAPI specs (2.0/3.0/3.1) to Contract Kit .ck files",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Marooned Software",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@scalar/openapi-parser": "^0.26.1",
|
|
31
31
|
"yaml": "^2.8.3",
|
|
32
|
-
"@contractkit/core": "0.
|
|
32
|
+
"@contractkit/core": "0.21.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@repo/config-eslint": "0.3.1",
|
package/src/ast-to-ck.ts
CHANGED
|
@@ -294,7 +294,14 @@ function serializeOperation(lines: string[], op: OpOperationNode, depth: number,
|
|
|
294
294
|
// Signature
|
|
295
295
|
if (op.signature) {
|
|
296
296
|
const sigComment = ctx.includeComments && op.signatureDescription ? ` # ${op.signatureDescription}` : '';
|
|
297
|
-
|
|
297
|
+
if (op.signaturePolicy) {
|
|
298
|
+
lines.push(`${inner}signature: {`);
|
|
299
|
+
lines.push(`${inner} options: ${op.signature}${sigComment}`);
|
|
300
|
+
lines.push(`${inner} policy: ${op.signaturePolicy}`);
|
|
301
|
+
lines.push(`${inner}}`);
|
|
302
|
+
} else {
|
|
303
|
+
lines.push(`${inner}signature: ${op.signature}${sigComment}`);
|
|
304
|
+
}
|
|
298
305
|
}
|
|
299
306
|
|
|
300
307
|
// Security
|
package/tests/ast-to-ck.test.ts
CHANGED
|
@@ -312,6 +312,32 @@ describe('route serialization', () => {
|
|
|
312
312
|
expect(result).toContain('operation(internal) /webhooks/stripe: {');
|
|
313
313
|
});
|
|
314
314
|
|
|
315
|
+
it('serializes a bare signature key', () => {
|
|
316
|
+
const root = ckRoot({
|
|
317
|
+
routes: [opRoute('/webhooks', [opOperation('post', { signature: 'SLACK_WEBHOOK', responses: [opResponse(204)] })])],
|
|
318
|
+
});
|
|
319
|
+
const result = astToCk(root);
|
|
320
|
+
expect(result).toContain('signature: SLACK_WEBHOOK');
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it('serializes a block-form signature with options and policy', () => {
|
|
324
|
+
const root = ckRoot({
|
|
325
|
+
routes: [
|
|
326
|
+
opRoute('/webhooks', [
|
|
327
|
+
opOperation('post', {
|
|
328
|
+
signature: 'SLACK_WEBHOOK',
|
|
329
|
+
signaturePolicy: 'slackSignatureValid',
|
|
330
|
+
responses: [opResponse(204)],
|
|
331
|
+
}),
|
|
332
|
+
]),
|
|
333
|
+
],
|
|
334
|
+
});
|
|
335
|
+
const result = astToCk(root);
|
|
336
|
+
expect(result).toContain('signature: {');
|
|
337
|
+
expect(result).toContain('options: SLACK_WEBHOOK');
|
|
338
|
+
expect(result).toContain('policy: slackSignatureValid');
|
|
339
|
+
});
|
|
340
|
+
|
|
315
341
|
it('serializes security: none', () => {
|
|
316
342
|
const root = ckRoot({
|
|
317
343
|
routes: [
|