diff --git a/docs/docs/cli/cli-commands/apic-help.md b/docs/docs/cli/cli-commands/apic-help.md index 616a583..20baaae 100644 --- a/docs/docs/cli/cli-commands/apic-help.md +++ b/docs/docs/cli/cli-commands/apic-help.md @@ -1 +1,17 @@ -# APIC Help +# Util commands + +## APIC help + +To get cli help over various commands + +```bash +apic help +``` + +## Version + +To get the current version of APIC cli + +```bash +apic --version +``` diff --git a/docs/docs/cli/cli-commands/apic-run.md b/docs/docs/cli/cli-commands/apic-run.md index 2aa6e2e..c87d29e 100644 --- a/docs/docs/cli/cli-commands/apic-run.md +++ b/docs/docs/cli/cli-commands/apic-run.md @@ -1 +1,12 @@ # APIC Run + +To run APIC cli validation against the api schema file + +## Options + +| Name | Flag | Desc | Required | Type | Default | +| ------- | ---- | ------------------------------------------------ | -------- | --------------- | ------- | +| apiType | -a | API schema type | true | Enum[ openapi ] | - | +| schema | | URL or local file containing the API schema file | true | String | - | +| config | | path to apic config file | false | String | ./apic | +| export | | export the final report to the given directory | false | String | - | diff --git a/docs/docs/cli/installation.md b/docs/docs/cli/installation.md index 3fd1687..34d8dd6 100644 --- a/docs/docs/cli/installation.md +++ b/docs/docs/cli/installation.md @@ -5,12 +5,20 @@ import TabItem from '@theme/TabItem'; -Use brew package manaager +Use brew package manager

+Add the 1-platform brew tap + ```bash -brew install one-platform/apic +brew tap 1-platform/homebrew-tools +``` + +Now you can install the CLI + +```bash +brew install 1-platform/apic ```
@@ -19,31 +27,99 @@ We use cloudsmith to distribute packages

+Add 1-platform cloudsmith repo url to your package manager + ```bash +apk add --no-cache bash curl + curl -1sLf \ - 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.deb.sh' \ - | sudo bash + 'https://dl.cloudsmith.io/public/1-platform/apic/cfg/setup/bash.alpine.sh' \ + | bash +``` + +Now you can install the CLI + +```bash +apk add apic --update-cache ``` - + + We use cloudsmith to distribute packages

+Add 1-platform cloudsmith repo url to your package manager + ```bash +apt-get update && apt-get install -y bash curl + curl -1sLf \ - 'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.deb.sh' \ - | sudo bash + 'https://dl.cloudsmith.io/public/1-platform/apic/cfg/setup/bash.deb.sh' \ + | bash +``` + +Now you can install the CLI + +```bash +apt-get update && apt-get install -y apic ```
+ + +We use cloudsmith to distribute packages +
+
+ +Add 1-platform cloudsmith repo url to your package manager + +```bash +curl -1sLf \ + 'https://dl.cloudsmith.io/public/1-platform/apic/cfg/setup/bash.rpm.sh' \ + | sh +``` + +Now you can install the CLI + +```bash +yum install apic +``` + +If your a fedora user + +```bash +dnf install apic +``` + +
+ + +We use scoop to distribute packages +
+
+ +Add 1-platform scoop repo url + +```bash +scoop bucket add https://github.com/1-Platform/scoop-tools +``` + +Now you can install the CLI + +```bash +scoop install apic +``` + +
+
To make sure it's installed correctly you can run ```bash -apic help +apic --version ``` ### Run against an OpenAPI diff --git a/docs/docs/cli/modules/env.md b/docs/docs/cli/modules/env.md index 735c133..c5fa0bd 100644 --- a/docs/docs/cli/modules/env.md +++ b/docs/docs/cli/modules/env.md @@ -1 +1,21 @@ # Env Module + +Env module can be imported from `apic/env` to set and get environment variabls. + +## Functions + +### setEnv + +```js +import { setEnv } from "apic/env"; + +setEnv("key", "value"); +``` + +### getEnv + +```js +import { getEnv } from "apic/env"; + +const envValue = getEnv("key"); +``` diff --git a/docs/docs/cli/modules/exec.md b/docs/docs/cli/modules/exec.md index 0e7e514..4287150 100644 --- a/docs/docs/cli/modules/exec.md +++ b/docs/docs/cli/modules/exec.md @@ -1 +1,17 @@ # Exec Module + +Exec module can be imported from `apic/exec` to execute system commands. + +## Functions + +### cmd + +```js +import cmd from "apic/exec"; + +const { data, error } = cmd("...."); +``` + +This will execute a system command. + +Data key contains system output and error key contains the stderr diff --git a/docs/docs/cli/modules/overview.md b/docs/docs/cli/modules/overview.md index 07dd0c5..88a2961 100644 --- a/docs/docs/cli/modules/overview.md +++ b/docs/docs/cli/modules/overview.md @@ -1 +1,26 @@ +--- +sidebar_position: 1 +--- + # Overview + +APIC comes with some JS modules to help you write your own rule. + +You can import those packages under the `apic/` namespace. + +List of APIC modules + +| Name | Package | Desc | +| -------------------------------------- | ------------ | ------------------------------------ | +| [Exec Module](/cli/modules/exec) | apic/exec | To run system commands | +| [Env Module](/cli/modules/env) | apic/env | To set and get environment variables | +| [Strings Module](/cli/modules/strings) | apic/strings | To check string casing | + +:::caution + +Right now apic doen't support importing anything else, even relative JS file. + +We are still working on ways to package complex plugins. + +Soon will add support to apic to support complex plugins. +::: diff --git a/docs/docs/cli/modules/strings.md b/docs/docs/cli/modules/strings.md new file mode 100644 index 0000000..a9744ff --- /dev/null +++ b/docs/docs/cli/modules/strings.md @@ -0,0 +1,52 @@ +# Strings Module + +To check for string casing and some more operations not covered by the JS strings. + +## Functions + +### isCasing + +```js +import { isCasing } from "apic/strings"; + +const value = "hello_world"; +const check = isCasing(value, "snakecase"); +``` + +To check whether given value is a valid provided casing. + +The casing can be snakecase, camelcase, pascalcase and kebabcase. + +### isPlural + +```js +import { isPlural } from "apic/strings"; + +const value = "properties"; +const check = isPlural(value); +``` + +### isSingular + +```js +import { isSingular } from "apic/strings"; + +const value = "property"; +const check = isSingular(value); +``` + +### pluralize + +```js +import { pluralize } from "apic/strings"; + +const value = pluralize("property"); +``` + +### singular + +```js +import { singular } from "apic/strings"; + +const value = singular("properties"); +``` diff --git a/docs/docs/cli/overview.md b/docs/docs/cli/overview.md index ec7077e..e7bf639 100644 --- a/docs/docs/cli/overview.md +++ b/docs/docs/cli/overview.md @@ -6,7 +6,7 @@ It mainly validates your API schema file, runs it against the rules you have spe ## CLI Architecture -[image-to-be-added-cli-arch] +![cli-architecture](/img/cli-arch.png) ### Config @@ -40,6 +40,14 @@ plugins: +:::info + +Rules section points towards builtin apic rules + +Where as plugins sections points towards user defined rules + +::: + ### Rules Rules are the validations executed over a schema file. diff --git a/docs/docs/cli/rules/builtin/openapi/ status-code-check.md b/docs/docs/cli/rules/builtin/openapi/ status-code-check.md new file mode 100644 index 0000000..d8ea180 --- /dev/null +++ b/docs/docs/cli/rules/builtin/openapi/ status-code-check.md @@ -0,0 +1,14 @@ +# Status Code Checks + +## Desc + +1. Rule Name: status_code_check +2. Category: quality + +Checks whether there is any invalid status code. Also can be used only allow particular set of status code in an API. + +## Options + +| Name | Desc | Required | Type | Default | +| -------------------- | ---------------------------------------- | -------- | -------- | ------- | +| allowed_status_codes | status code that are only allowed in api | false | String[] | [ ] | diff --git a/docs/docs/cli/rules/builtin/openapi/body-in-get.md b/docs/docs/cli/rules/builtin/openapi/body-in-get.md new file mode 100644 index 0000000..9704b6b --- /dev/null +++ b/docs/docs/cli/rules/builtin/openapi/body-in-get.md @@ -0,0 +1,12 @@ +# Body In Get Request + +## Desc + +1. Rule Name: body_in_get_req +2. Category: security + +Check whether there is body in a GET request. + +## Options + +None diff --git a/docs/docs/cli/rules/builtin/openapi/req-body-query-case-check.md b/docs/docs/cli/rules/builtin/openapi/req-body-query-case-check.md new file mode 100644 index 0000000..31dbd4f --- /dev/null +++ b/docs/docs/cli/rules/builtin/openapi/req-body-query-case-check.md @@ -0,0 +1,15 @@ +# Schema Case Check + +## Desc + +1. Rule Name: schema_case_checker +2. Category: Quality + +Checks for casing over a request body and query params. + +## Options + +| Name | Desc | Required | Type | Default | +| --------------- | ----------------------------------------------- | -------- | ------------------------------------------------- | --------- | +| req_body_casing | casing system to be followed for request bodies | false | Enum[kebabcase, snakecase, camelcase, pascalcase] | camelcase | +| params_casing | casing system to be followed for query params | false | Enum[kebabcase, snakecase, camelcase, pascalcase] | camelcase | diff --git a/docs/docs/cli/rules/builtin/openapi/unsafe-url-check.md b/docs/docs/cli/rules/builtin/openapi/unsafe-url-check.md new file mode 100644 index 0000000..9b5c5ef --- /dev/null +++ b/docs/docs/cli/rules/builtin/openapi/unsafe-url-check.md @@ -0,0 +1,12 @@ +# Unsafe URL Character Check + +## Desc + +1. Rule Name: unsafe_url_character_check +2. Category: quality + +Checks whether URL contains any invalid characters by web specification. + +## Options + +Nil diff --git a/docs/docs/cli/rules/builtin/openapi/url-case-check.md b/docs/docs/cli/rules/builtin/openapi/url-case-check.md new file mode 100644 index 0000000..6b4a33e --- /dev/null +++ b/docs/docs/cli/rules/builtin/openapi/url-case-check.md @@ -0,0 +1,16 @@ +# URL Casing Check + +## Desc + +1. Rule name: url_case_checker +2. Category: quality + +Checks for URL's casing. + +## Options + +| Name | Desc | Required | Type | Default | +| --------------- | -------------------------------------------- | -------- | ------------------------------------------------- | --------- | +| casing | casing system to be followed | false | Enum[kebabcase, snakecase, camelcase, pascalcase] | kebabcase | +| base_urls | base url followed by the schema for all URLs | false | String[] | [ ] | +| blacklist_paths | URLs to be ignored | false | String[] | [ ] | diff --git a/docs/docs/cli/rules/builtin/openapi/url-length-check.md b/docs/docs/cli/rules/builtin/openapi/url-length-check.md index 07b60ff..9fcc148 100644 --- a/docs/docs/cli/rules/builtin/openapi/url-length-check.md +++ b/docs/docs/cli/rules/builtin/openapi/url-length-check.md @@ -1 +1,18 @@ # URL Length Check + +## Desc + +1. Rule Name: url_length +2. Category: quality + +Checks whether API's URL is too long. + +Weights are assigned to all dynamic path params like `/url/{dynamic}` that estimate how long are they generally. + +## Options + +| Name | Desc | Required | Type | Default | +| --------------- | ----------------------------------------------------------------------------------- | -------- | -------- | ------- | +| weight | Dynamic path params average length. Ex: `/url/{id}` the average length id could be. | false | Number | 5 | +| max_url_length | maximum allowed url length | false | Number | 75 | +| blacklist_paths | URLs to be ignored | false | String[] | [ ] | diff --git a/docs/docs/cli/rules/builtin/openapi/url-plural-check.md b/docs/docs/cli/rules/builtin/openapi/url-plural-check.md new file mode 100644 index 0000000..cf71656 --- /dev/null +++ b/docs/docs/cli/rules/builtin/openapi/url-plural-check.md @@ -0,0 +1,18 @@ +# URL Plural Check + +## Desc + +1. Rule Name: url_plural_checker +2. Category: quality + +Checks whether resources in URL are in singular or plural as specified in config. + +Ex: + +`/property/:id` would fail for plural check as it should be `/properties/:id` + +| Name | Desc | Required | Type | Default | +| --------------- | -------------------------------------------- | -------- | ------------------------ | -------- | +| type | Is it singular or plural | false | Enum[ singular, plural ] | singular | +| base_urls | base url followed by the schema for all URLs | false | String[] | [ ] | +| blacklist_paths | URLs to be ignored | false | String[] | [ ] | diff --git a/docs/docs/cli/rules/builtin/openapi/url-similarity-check.md b/docs/docs/cli/rules/builtin/openapi/url-similarity-check.md new file mode 100644 index 0000000..e7042c5 --- /dev/null +++ b/docs/docs/cli/rules/builtin/openapi/url-similarity-check.md @@ -0,0 +1,16 @@ +# URL Similarity Checks + +## Desc + +1. Rule Name: url_similarity_check +2. Category: Quality + +Checks for very similar URLs in a schema + +## Options + +| Name | Desc | Required | Type | Default | +| --------------- | --------------------------------------------------------------------------------- | -------- | -------- | ------- | +| weight | Weight define how much similar are two URLs. 0 < similarity <1 where 1 being same | false | Number | 0.9 | +| base_urls | base url followed by the schema for all URLs | false | String[] | [ ] | +| blacklist_paths | URLs to be ignored | false | String[] | [ ] | diff --git a/docs/docs/cli/rules/builtin/overview.md b/docs/docs/cli/rules/builtin/overview.md index 07dd0c5..461b568 100644 --- a/docs/docs/cli/rules/builtin/overview.md +++ b/docs/docs/cli/rules/builtin/overview.md @@ -1 +1,19 @@ # Overview + +APIC comes with batteries included. + +APIC has some built-in rules for users to get started. Some of them are + +1. URL Case Check +2. URL Lenth Check +3. Query params and request body case check +4. Plural case check +5. And more.... + +:::info + +Right now APIC support's openapi only. More will be coming soon like GraphQL + +::: + +Following section gives you an outlook on various rules and available options. diff --git a/docs/docs/cli/rules/customizing.md b/docs/docs/cli/rules/customizing.md index 57949d1..550f3f9 100644 --- a/docs/docs/cli/rules/customizing.md +++ b/docs/docs/cli/rules/customizing.md @@ -1 +1,80 @@ # Customizing + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +So let's take the URL case checker. + +By default, the **URL case checker** rule validates whether your URL is a kebab case. + +#### But wait! + +What if your team prefers a snake case or camel case? + +APIC has got your team. + +Write your customization in the APIC config file and pass it to APIC. APIC will handle the rest for you. + +So how does a config file looks? Here you go. + + + + +```yaml +rules: + url_case_checker: + options: + casing: snakecase +``` + + + + +```json +{ + "rules": { + "url_case_checker": { + "options": { + "casing": "snakecase" + } + } + } +} +``` + + + + +```toml +[rules.url_case_checker.options] +casing = "snakecase" +``` + + + + +:::info + +By default apic looks for a apic file in the directory your executing the cli. + +You can change that by using the `--config` option in the cli + +::: + +## APIC Config file Definition + +```yaml +# builtin rules are accessed with rules key +rules: + rule_name: + disable: false # to disable a rule + options: + option1: value +# user defined rules are in plugins +plugins: + rule_name: + file: ./some/dir + disable: false + options: + option1: value +``` diff --git a/docs/docs/cli/rules/user-defined/our-first-rule.md b/docs/docs/cli/rules/user-defined/our-first-rule.md deleted file mode 100644 index 47edcd1..0000000 --- a/docs/docs/cli/rules/user-defined/our-first-rule.md +++ /dev/null @@ -1 +0,0 @@ -# Our First Rule diff --git a/docs/docs/cli/rules/user-defined/overview.md b/docs/docs/cli/rules/user-defined/overview.md index 07dd0c5..33ce322 100644 --- a/docs/docs/cli/rules/user-defined/overview.md +++ b/docs/docs/cli/rules/user-defined/overview.md @@ -1 +1,78 @@ -# Overview +# Writing your own rule + +APIC is quite extensible. Teams can write their own rule and load them on APIC. + +These scripts could be on the web or in your local directory. Let's see how to write your own rule. + +## Scenario + +Consider your team uses some CLI for testing security over your API. Let's see how to integrate that into APIC. + +## Rule File + +Rules are defined using a **Javascript** file. They contain the schema validation logic. + +APIC looks for a default exported function, and it gets executed. To execute system commands from the rule file, APIC provides a module called `apic/exec`. + +```js title="my-rule.js" +import cmd from "apic/exec"; + +export default function (config, opts) { + const output = cmd(`cli commands ....`); // output is the stdout of the CLI + // If this is JSON stdout + // output will be object with data and error as key + const data = JSON.parse(output.data); + data.forEach((d) => { + // check for condition + // if it fails report it using config.report({}); + }); + + // finally set a score out of 100 based on validations that are checked + config.setScore("security", 100); +} +``` + +### Some important notes + +1. opts argument contains whatever user wants to pass to the rule +2. config contains a couple of things + +| Properties | Desc | Type | +| ---------- | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| type | type of api schema file | Enum[openapi] | +| schema | api schema file | object | +| setScore | function to set score by the rule | (category, value) => void | +| report | function to say what went wrong on validation failure | ({message:string,
path: string,
method:string,
metadata:{key:string, value:string}[], })=>void | + +## Connect new rule + +To connect your new rule with APIC, specify the rule name and the file location in the config file. + +The file can be absolute, relative or a web URL. If it's relative URL, remember that it's relative to the point of execution. + +```yaml title="apic.yaml" +plugins: + rules: + # your rule name + my_security_cli: + file: "" + # where you can pass some options to rule + options: + option1: something +``` + +:::caution + +All rule names must be in snakecase. This is for rendering purpose of UI in future. + +::: + +## Run it + +Now just run apic, if you have named the config file as apic and placed it in same directory then it will be automatically loaded. If not use `--config` option. + +```bash +apic run -a openapi --schema https://petstore3.swagger.io/api/v3/openapi.json --config . +``` + +#### 🎉🎉🎉🎉 Congrats that's your own first rule. diff --git a/docs/docs/cli/rules/what-are-rules.md b/docs/docs/cli/rules/what-are-rules.md index 965297a..85deb1f 100644 --- a/docs/docs/cli/rules/what-are-rules.md +++ b/docs/docs/cli/rules/what-are-rules.md @@ -1 +1,31 @@ # What are rules + +Rules define how you want to check an API schema. They are the validations to be executed against your API based on your schema. + +Some of the builtin rules are + +1. API URL length check +2. URL resources plural or singular validation +3. Casing checks + +Rules are not limited to just quality checks. + +Each one can give a validation on one of these categories. + +1. Security +2. Quality +3. Performance + +### So how do you write a rule? + +Simple, it's just a JS file, as shown below. + +```js +export default function (config, opts) { + // config: object containing your schema file, schema type and some functions + // opts: user passed options for rules customization + // do the required checks +} +``` + +Check out [this section to know more about writing your rule.](/cli/rules/user-defined/overview) diff --git a/docs/docs/kudos.md b/docs/docs/kudos.md index f80081c..d5d6f16 100644 --- a/docs/docs/kudos.md +++ b/docs/docs/kudos.md @@ -1 +1,17 @@ # Kudos + +I like to acknowledge some of the core libraries and the programming language used to make this project successful. + +Kudos, and wholeheartedly thankful for these projects. + +1. [Goja](https://github.com/dop251/goja) +2. [Cobra](https://github.com/spf13/cobra) +3. [Viper](https://github.com/spf13/viper) +4. [Go](https://github.com/golang/go/) +5. [Lipgloss](https://github.com/charmbracelet/lipgloss) +6. [Kin-openapi](https://github.com/getkin/kin-openapi) +7. [Docusaurus](https://github.com/facebook/docusaurus) +8. [pnpm](https://pnpm.io) +9. [cloudsmith](https://cloudsmith.io) + +> And all the other libraries that I couldn't acknowledge in this list. diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 7a5d7aa..c30b8ea 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -37,12 +37,13 @@ const config = { // Remove this to remove the "edit this page" links. editUrl: "https://github.com/1-platform/api-catalog/tree/main/docs", }, - blog: { - showReadingTime: true, - // Please change this to your repo. - // Remove this to remove the "edit this page" links. - editUrl: "https://github.com/1-platform/api-catalog/tree/main/blog", - }, + // blog: { + // showReadingTime: true, + // // Please change this to your repo. + // // Remove this to remove the "edit this page" links. + // editUrl: "https://github.com/1-platform/api-catalog/tree/main/blog", + // }, + blog: false, theme: { customCss: require.resolve("./src/css/custom.scss"), }, @@ -62,12 +63,12 @@ const config = { image: "img/docusaurus-social-card.jpg", navbar: { title: "API Catalog", - // logo: { - // alt: "API Catalog Next Docs", - // src: "j", - // }, + logo: { + alt: "API Catalog Next Docs", + src: "/img/logo.png", + }, items: [ - { to: "/blog", label: "Blog", position: "left" }, + // { to: "/blog", label: "Blog", position: "left" }, { href: "https://github.com/1-platform/api-catalog", label: "GitHub", @@ -83,8 +84,8 @@ const config = { title: "More", items: [ { - label: "Blog", - to: "/blog", + label: "One Platform", + to: "https://one.redhat.com", }, { label: "GitHub", diff --git a/docs/sidebars.js b/docs/sidebars.js index 78e1e1e..21d5c85 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -35,25 +35,24 @@ const sidebars = { { type: "category", label: "OpenAPI", - items: ["cli/rules/builtin/openapi/url-length-check"], + items: [ + { + type: "autogenerated", + dirName: "cli/rules/builtin/openapi", // Generate sidebar slice from docs/tutorials/easy + }, + ], }, ], }, - { - type: "category", - label: "User Defined Rules", - items: [ - "cli/rules/user-defined/overview", - "cli/rules/user-defined/our-first-rule", - ], - }, + "cli/rules/user-defined/overview", { type: "category", label: "Modules", items: [ - "cli/modules/overview", - "cli/modules/exec", - "cli/modules/env", + { + type: "autogenerated", + dirName: "cli/modules", // Generate sidebar slice from docs/tutorials/easy + }, ], }, { diff --git a/docs/static/img/cli-arch.png b/docs/static/img/cli-arch.png new file mode 100644 index 0000000..18ece22 Binary files /dev/null and b/docs/static/img/cli-arch.png differ diff --git a/docs/static/img/favicon.ico b/docs/static/img/favicon.ico index c01d54b..5b7820c 100644 Binary files a/docs/static/img/favicon.ico and b/docs/static/img/favicon.ico differ diff --git a/docs/static/img/logo.png b/docs/static/img/logo.png new file mode 100644 index 0000000..2560de9 Binary files /dev/null and b/docs/static/img/logo.png differ diff --git a/docs/static/img/logo.svg b/docs/static/img/logo.svg deleted file mode 100644 index 9db6d0d..0000000 --- a/docs/static/img/logo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/plugins/builtin.zip b/plugins/builtin.zip index 669c1bc..77d4c2d 100644 Binary files a/plugins/builtin.zip and b/plugins/builtin.zip differ diff --git a/plugins/builtin/openapi/config.yaml b/plugins/builtin/openapi/config.yaml index 1ab4d63..d48e884 100644 --- a/plugins/builtin/openapi/config.yaml +++ b/plugins/builtin/openapi/config.yaml @@ -15,7 +15,7 @@ rules: file: "url_plural_checker.js" options: type: "singular" - url_similiarity_check: - file: "url_similiarity_check.js" + url_similarity_check: + file: "url_similarity_check.js" options: weight: 0.9 diff --git a/plugins/builtin/openapi/url_similiarity_check.js b/plugins/builtin/openapi/url_similarity_check.js similarity index 90% rename from plugins/builtin/openapi/url_similiarity_check.js rename to plugins/builtin/openapi/url_similarity_check.js index 71b7976..d68d2f6 100644 --- a/plugins/builtin/openapi/url_similiarity_check.js +++ b/plugins/builtin/openapi/url_similarity_check.js @@ -40,7 +40,7 @@ export default function (config, options) { let numberOfResponses = 0; let numbnerOfFalseResponses = 0; - const weight = options?.weight || 0.8; + const weight = options?.weight || 0.9; const blackListPaths = options?.blacklist_paths || []; const baseURLs = options?.base_urls || []; @@ -55,8 +55,8 @@ export default function (config, options) { if (j !== i) { const pathB = stripOfBaseURL(paths[j], baseURLs); - const similiarity = compareTwoStrings(pathA, pathB); - if (similiarity > weight) { + const similarity = compareTwoStrings(pathA, pathB); + if (similarity > weight) { numbnerOfFalseResponses++; // get all methods @@ -65,7 +65,7 @@ export default function (config, options) { .toUpperCase(); config.report({ - message: `URL ${paths[i]} similiar to ${paths[j]}, similiarity: ${similiarity}`, + message: `URL ${paths[i]} similar to ${paths[j]}, similarity: ${similarity}`, path: paths[i], method: methods, });