Skip to content

Commit

Permalink
Merge pull request #727 from xsalazar/types/add_security_types
Browse files Browse the repository at this point in the history
Adds types for securityDefinitions, securitySchemes, and scopes
  • Loading branch information
robmcguinness committed Jul 24, 2021
2 parents 749dc64 + 874d494 commit 56fbec9
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions index.d.ts
Expand Up @@ -61,6 +61,57 @@ declare namespace hapiswagger {

type UiCompleteScriptType = string | UiCompleteScriptObjectType

type ScopesType = {
[scope: string]: string | any;
}

type SecuritySchemeType = {
/**
* The authorization URL to be used for this flow. This SHOULD be in the form of a URL. REQUIRED for `type` "oauth2", and `flow` "implicit" or "accessCode"
*/
authorizationUrl?: string;

/**
* A short description for security scheme.
*/
description?: string;

/**
* The flow used by the OAuth2 security scheme. Valid values are "implicit", "password", "application" or "accessCode". REQUIRED for `type` "oauth2"
*/
flow?: string;

/**
* The location of the API key. Valid values are "query" or "header". REQUIRED for `type` "apiKey"
*/
in?: string;

/**
* The name of the header or query parameter to be used. REQUIRED for `type` "apiKey"
*/
name?: string;

/**
* The available scopes for the OAuth2 security scheme. REQUIRED for `type` "oauth2"
*/
scopes?: ScopesType;

/**
* The token URL to be used for this flow. This SHOULD be in the form of a URL. REQUIRED for `type` "oauth2", and `flow` "password", "application", or "accessCode"
*/
tokenUrl?: string;

/**
* The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2"
*/
type: string;

/**
* Any property or object with a key starting with `x-*` is included in the Swagger definition (similar to `x-*` options in the `info` object)
*/
[key: string]: any;
}

interface LicenseOptions {
/**
* The name of the license used for the API
Expand Down Expand Up @@ -383,6 +434,11 @@ declare namespace hapiswagger {
* @default false
*/
tryItOutEnabled?: boolean;

/**
* A declaration of the security schemes available to be used in the specification. This does not enforce the security schemes on the operations and only serves to provide the relevant details for each scheme
*/
securityDefinitions?: {[name: string]: SecuritySchemeType}
}
}

Expand Down

0 comments on commit 56fbec9

Please sign in to comment.