-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
31 changed files
with
606 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
``` |
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 |
---|---|---|
@@ -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 | - | |
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 |
---|---|---|
@@ -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"); | ||
``` |
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -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. | ||
::: |
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,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"); | ||
``` |
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,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[] | [ ] | |
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,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 |
15 changes: 15 additions & 0 deletions
15
docs/docs/cli/rules/builtin/openapi/req-body-query-case-check.md
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,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 | |
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,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 |
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,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[] | [ ] | |
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 |
---|---|---|
@@ -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[] | [ ] | |
Oops, something went wrong.