Skip to content

Commit

Permalink
Merge pull request #728 from xsalazar/types/add_security_requirement_…
Browse files Browse the repository at this point in the history
…types

Add security requirements type to root document
  • Loading branch information
robmcguinness committed Jul 26, 2021
2 parents b83320b + ca9e6ba commit 2d033b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion index.d.ts
Expand Up @@ -112,6 +112,17 @@ declare namespace hapiswagger {
[key: string]: any;
}

/**
* Lists the required security schemes to execute this operation. The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes)
*
* The name used for each property MUST correspond to a security scheme declared in the {@link RegisterOptions.securityDefinitions}
*
* If the security scheme is of `type` "oauth2", then the value is a list of scope names required for the execution. For other security scheme types, the array MUST be empty
*/
type SecurityRequirementsType = {
[securityDefinitionName: string]: string[];
};

interface LicenseOptions {
/**
* The name of the license used for the API
Expand Down Expand Up @@ -438,7 +449,12 @@ declare namespace hapiswagger {
/**
* 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}
securityDefinitions?: { [name: string]: SecuritySchemeType };

/**
* A declaration of which security schemes are applied for the API as a whole. The list of values describes alternative security schemes that can be used (that is, there is a logical OR between the security requirements)
*/
security?: [SecurityRequirementsType];
}
}

Expand Down
1 change: 1 addition & 0 deletions optionsreference.md
Expand Up @@ -35,6 +35,7 @@
- `grouping`: (string) how to create grouping of endpoints value either `path` or `tags` - default: `path`
- `tagsGroupingFilter`: (function) A function used to determine which tags should be used for grouping (when `grouping` is set to `tags`) - default: `(tag) => tag !== 'api'`
- `securityDefinitions:`: (object) Containing [Security Definitions Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#securityDefinitionsObject). No defaults are provided.
- `security`: (array) Containing [Security Requirement Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#securityRequirementObject). No defaults are provided.
- `payloadType`: (string) How payload parameters are displayed `json` or `form` - default: `json`
- `documentationRouteTags`: (string or array) Add hapi tags to internal `hapi-swagger` routes - default: `[]`
- `documentationRoutePlugins`: (object) Add hapi plugins to internal `hapi-swagger` routes - default: `{}`
Expand Down

0 comments on commit 2d033b3

Please sign in to comment.