openapi3-ts
Advanced tools
Comparing version 3.0.3 to 3.1.0
# Changelog: openapi3-ts | ||
## Version 3.1.0 | ||
2022.10.06 | ||
- PR [#88](https://github.com/metadevpro/openapi3-ts/pull/88) Added support to Webhooks. Contributed by @samchungy | ||
## Version 3.0.3 | ||
@@ -5,0 +11,0 @@ |
@@ -31,2 +31,3 @@ import * as oa from '../model/index.js'; | ||
addExternalDocs(extDoc: oa.ExternalDocumentationObject): OpenApiBuilder; | ||
addWebhook(webhook: string, webhookItem: oa.PathItemObject): OpenApiBuilder; | ||
} |
@@ -26,3 +26,4 @@ "use strict"; | ||
tags: [], | ||
servers: [] | ||
servers: [], | ||
webhooks: {} | ||
}; | ||
@@ -140,3 +141,7 @@ } | ||
} | ||
addWebhook(webhook, webhookItem) { | ||
this.rootDoc.webhooks[webhook] = webhookItem; | ||
return this; | ||
} | ||
} | ||
exports.OpenApiBuilder = OpenApiBuilder; |
@@ -13,2 +13,3 @@ import { ISpecificationExtension } from './SpecificationExtension.js'; | ||
externalDocs?: ExternalDocumentationObject; | ||
webhooks?: PathsObject; | ||
} | ||
@@ -15,0 +16,0 @@ export interface InfoObject extends ISpecificationExtension { |
@@ -31,2 +31,3 @@ import * as oa from '../model/index.js'; | ||
addExternalDocs(extDoc: oa.ExternalDocumentationObject): OpenApiBuilder; | ||
addWebhook(webhook: string, webhookItem: oa.PathItemObject): OpenApiBuilder; | ||
} |
@@ -23,3 +23,4 @@ import * as yaml from 'yaml'; | ||
tags: [], | ||
servers: [] | ||
servers: [], | ||
webhooks: {} | ||
}; | ||
@@ -137,2 +138,6 @@ } | ||
} | ||
addWebhook(webhook, webhookItem) { | ||
this.rootDoc.webhooks[webhook] = webhookItem; | ||
return this; | ||
} | ||
} |
@@ -13,2 +13,3 @@ import { ISpecificationExtension } from './SpecificationExtension.js'; | ||
externalDocs?: ExternalDocumentationObject; | ||
webhooks?: PathsObject; | ||
} | ||
@@ -15,0 +16,0 @@ export interface InfoObject extends ISpecificationExtension { |
{ | ||
"name": "openapi3-ts", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "TS Model & utils for OpenAPI 3.x specification.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -25,3 +25,4 @@ import { OpenApiBuilder } from '.'; | ||
tags: [], | ||
servers: [] | ||
servers: [], | ||
webhooks: {} | ||
}); | ||
@@ -136,2 +137,16 @@ }); | ||
}); | ||
it('addWebhook', () => { | ||
const webhook1 = { | ||
post: { | ||
responses: { | ||
default: { | ||
description: 'event processed' | ||
} | ||
} | ||
} | ||
}; | ||
const sut = OpenApiBuilder.create().addWebhook('webhook1', webhook1).rootDoc; | ||
expect(sut.webhooks['webhook1']).eql(webhook1); | ||
}); | ||
it('addSchema', () => { | ||
@@ -398,3 +413,3 @@ const schema1: oa.SchemaObject = { | ||
expect(sut).eql( | ||
`{"openapi":"3.0.0","info":{"title":"app9","version":"5.6.7"},"paths":{},"components":{"schemas":{},"responses":{},"parameters":{},"examples":{},"requestBodies":{},"headers":{},"securitySchemes":{},"links":{},"callbacks":{}},"tags":[],"servers":[]}` | ||
`{"openapi":"3.0.0","info":{"title":"app9","version":"5.6.7"},"paths":{},"components":{"schemas":{},"responses":{},"parameters":{},"examples":{},"requestBodies":{},"headers":{},"securitySchemes":{},"links":{},"callbacks":{}},"tags":[],"servers":[],"webhooks":{}}` | ||
); | ||
@@ -408,3 +423,3 @@ }); | ||
expect(sut).eql( | ||
'openapi: 3.0.0\ninfo:\n title: app9\n version: 5.6.7\npaths: {}\ncomponents:\n schemas: {}\n responses: {}\n parameters: {}\n examples: {}\n requestBodies: {}\n headers: {}\n securitySchemes: {}\n links: {}\n callbacks: {}\ntags: []\nservers: []\n' | ||
'openapi: 3.0.0\ninfo:\n title: app9\n version: 5.6.7\npaths: {}\ncomponents:\n schemas: {}\n responses: {}\n parameters: {}\n examples: {}\n requestBodies: {}\n headers: {}\n securitySchemes: {}\n links: {}\n callbacks: {}\ntags: []\nservers: []\nwebhooks: {}\n' | ||
); | ||
@@ -411,0 +426,0 @@ }); |
@@ -34,3 +34,4 @@ import * as yaml from 'yaml'; | ||
tags: [], | ||
servers: [] | ||
servers: [], | ||
webhooks: {} | ||
}; | ||
@@ -160,2 +161,6 @@ } | ||
} | ||
addWebhook(webhook: string, webhookItem: oa.PathItemObject): OpenApiBuilder { | ||
this.rootDoc.webhooks[webhook] = webhookItem; | ||
return this; | ||
} | ||
} |
@@ -32,2 +32,3 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
externalDocs?: ExternalDocumentationObject; | ||
webhooks?: PathsObject; | ||
} | ||
@@ -34,0 +35,0 @@ export interface InfoObject extends ISpecificationExtension { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92333
2438