Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

### 0.1.4
* Fix `bin` entry in package.json
* Improve logic to include and exclude http functions

## 0.1.3
* Make `index.js` executable

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Parameters for `ApiDefinitionConfiguration`:
Logic to include / exclude http functions:
* If `functionNameRegexToInclude` and `functionNameRegexToExclude` are not specified all functions are used.
* Otherwise:
* If the http function name matches some pattern from `functionNameRegexToExclude`, then the http function will be excluded from the api definition.
* If the http function name matches some pattern from `functionNameRegexToInclude`, then the http function will be included into the api definition.
* If `functionNameRegexToExclude` is defined and the http function name matches some pattern from `functionNameRegexToExclude`, then the http function will be excluded from the api definition.
* If `functionNameRegexToInclude` is defined and the http function name matches some pattern from `functionNameRegexToInclude`, then the http function will be included into the api definition.

## Supported Features
* URL path parameters
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@senacor/azure-function-middleware-openapi-generator",
"version": "0.1.3",
"version": "0.1.4",
"description": "OpenAPI Generator for @senacor/azure-function-middleware",
"main": "index/dist.js",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/generateApiDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ function shouldIncludeHttpFunctionInApiDefinition(config: ApiDefinitionConfigura
return true;
}

if (config.functionNameRegexToExclude?.some((regex) => name.match(regex)) === true) {
if (config.functionNameRegexToExclude && config.functionNameRegexToExclude.some((regex) => name.match(regex))) {
return false;
}

return config.functionNameRegexToInclude?.some((regex) => name.match(regex)) === true;
return !config.functionNameRegexToInclude || config.functionNameRegexToInclude.some((regex) => name.match(regex));
}

function extractParametersFromRoute(route: string): OpenAPIV3.ParameterObject[] {
Expand Down