-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
171711f
commit 41f81b4
Showing
12 changed files
with
127 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { OpenAPIPath, Referenced } from '../../types'; | ||
import { OpenAPIParser } from '../OpenAPIParser'; | ||
import { OperationModel } from './Operation'; | ||
import { isOperationName } from '../..'; | ||
import { RedocNormalizedOptions } from '../RedocNormalizedOptions'; | ||
|
||
export class WebhookModel { | ||
operations: OperationModel[] = []; | ||
|
||
constructor( | ||
parser: OpenAPIParser, | ||
options: RedocNormalizedOptions, | ||
infoOrRef?: Referenced<OpenAPIPath>, | ||
) { | ||
const webhooks = parser.deref<OpenAPIPath>(infoOrRef || {}); | ||
parser.exitRef(infoOrRef); | ||
|
||
for (const webhookName of Object.keys(webhooks)) { | ||
const webhook = webhooks[webhookName]; | ||
const operations = Object.keys(webhook).filter(isOperationName); | ||
for (const operationName of operations) { | ||
const operationInfo = webhook[operationName]; | ||
const operation = new OperationModel( | ||
parser, | ||
{ | ||
...operationInfo, | ||
httpVerb: operationName, | ||
}, | ||
undefined, | ||
options, | ||
false, | ||
); | ||
|
||
this.operations.push(operation); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters