Skip to content

Commit ed3d235

Browse files
committed
feat(docs): updated docs content
1 parent df3f651 commit ed3d235

31 files changed

Lines changed: 606 additions & 44 deletions
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
# APIC Help
1+
# Util commands
2+
3+
## APIC help
4+
5+
To get cli help over various commands
6+
7+
```bash
8+
apic help
9+
```
10+
11+
## Version
12+
13+
To get the current version of APIC cli
14+
15+
```bash
16+
apic --version
17+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
# APIC Run
2+
3+
To run APIC cli validation against the api schema file
4+
5+
## Options
6+
7+
| Name | Flag | Desc | Required | Type | Default |
8+
| ------- | ---- | ------------------------------------------------ | -------- | --------------- | ------- |
9+
| apiType | -a | API schema type | true | Enum[ openapi ] | - |
10+
| schema | | URL or local file containing the API schema file | true | String | - |
11+
| config | | path to apic config file | false | String | ./apic |
12+
| export | | export the final report to the given directory | false | String | - |

docs/docs/cli/installation.md

Lines changed: 84 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@ import TabItem from '@theme/TabItem';
55

66
<Tabs>
77
<TabItem value="mac" label="MacOS" default>
8-
Use <a>brew</a> package manaager
8+
Use <a>brew</a> package manager
99
<br/>
1010
<br/>
1111

12+
Add the 1-platform brew tap
13+
1214
```bash
13-
brew install one-platform/apic
15+
brew tap 1-platform/homebrew-tools
16+
```
17+
18+
Now you can install the CLI
19+
20+
```bash
21+
brew install 1-platform/apic
1422
```
1523

1624
</TabItem>
@@ -19,31 +27,99 @@ We use cloudsmith to distribute packages
1927
<br/>
2028
<br/>
2129

30+
Add 1-platform cloudsmith repo url to your package manager
31+
2232
```bash
33+
apk add --no-cache bash curl
34+
2335
curl -1sLf \
24-
'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.deb.sh' \
25-
| sudo bash
36+
'https://dl.cloudsmith.io/public/1-platform/apic/cfg/setup/bash.alpine.sh' \
37+
| bash
38+
```
39+
40+
Now you can install the CLI
41+
42+
```bash
43+
apk add apic --update-cache
2644
```
2745

2846
</TabItem>
29-
<TabItem value="deb" label="Debian/Ubuntu">
47+
48+
<TabItem value="deb" label="Debian/Ubuntu" >
3049
We use cloudsmith to distribute packages
3150
<br/>
3251
<br/>
3352

53+
Add 1-platform cloudsmith repo url to your package manager
54+
3455
```bash
56+
apt-get update && apt-get install -y bash curl
57+
3558
curl -1sLf \
36-
'https://dl.cloudsmith.io/public/OWNER/REPOSITORY/cfg/setup/bash.deb.sh' \
37-
| sudo bash
59+
'https://dl.cloudsmith.io/public/1-platform/apic/cfg/setup/bash.deb.sh' \
60+
| bash
61+
```
62+
63+
Now you can install the CLI
64+
65+
```bash
66+
apt-get update && apt-get install -y apic
3867
```
3968

4069
</TabItem>
70+
71+
<TabItem value="linux" label="RedHat/Amazon-Linux" >
72+
We use cloudsmith to distribute packages
73+
<br/>
74+
<br/>
75+
76+
Add 1-platform cloudsmith repo url to your package manager
77+
78+
```bash
79+
curl -1sLf \
80+
'https://dl.cloudsmith.io/public/1-platform/apic/cfg/setup/bash.rpm.sh' \
81+
| sh
82+
```
83+
84+
Now you can install the CLI
85+
86+
```bash
87+
yum install apic
88+
```
89+
90+
If your a fedora user
91+
92+
```bash
93+
dnf install apic
94+
```
95+
96+
</TabItem>
97+
98+
<TabItem value="widows" label="Windows" >
99+
We use scoop to distribute packages
100+
<br/>
101+
<br/>
102+
103+
Add 1-platform scoop repo url
104+
105+
```bash
106+
scoop bucket add https://github.com/1-Platform/scoop-tools
107+
```
108+
109+
Now you can install the CLI
110+
111+
```bash
112+
scoop install apic
113+
```
114+
115+
</TabItem>
116+
41117
</Tabs>
42118

43119
To make sure it's installed correctly you can run
44120

45121
```bash
46-
apic help
122+
apic --version
47123
```
48124

49125
### Run against an OpenAPI

docs/docs/cli/modules/env.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
11
# Env Module
2+
3+
Env module can be imported from `apic/env` to set and get environment variabls.
4+
5+
## Functions
6+
7+
### setEnv
8+
9+
```js
10+
import { setEnv } from "apic/env";
11+
12+
setEnv("key", "value");
13+
```
14+
15+
### getEnv
16+
17+
```js
18+
import { getEnv } from "apic/env";
19+
20+
const envValue = getEnv("key");
21+
```

docs/docs/cli/modules/exec.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
11
# Exec Module
2+
3+
Exec module can be imported from `apic/exec` to execute system commands.
4+
5+
## Functions
6+
7+
### cmd
8+
9+
```js
10+
import cmd from "apic/exec";
11+
12+
const { data, error } = cmd("....");
13+
```
14+
15+
This will execute a system command.
16+
17+
Data key contains system output and error key contains the stderr

docs/docs/cli/modules/overview.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
15
# Overview
6+
7+
APIC comes with some JS modules to help you write your own rule.
8+
9+
You can import those packages under the `apic/` namespace.
10+
11+
List of APIC modules
12+
13+
| Name | Package | Desc |
14+
| -------------------------------------- | ------------ | ------------------------------------ |
15+
| [Exec Module](/cli/modules/exec) | apic/exec | To run system commands |
16+
| [Env Module](/cli/modules/env) | apic/env | To set and get environment variables |
17+
| [Strings Module](/cli/modules/strings) | apic/strings | To check string casing |
18+
19+
:::caution
20+
21+
Right now apic doen't support importing anything else, even relative JS file.
22+
23+
We are still working on ways to package complex plugins.
24+
25+
Soon will add support to apic to support complex plugins.
26+
:::

docs/docs/cli/modules/strings.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Strings Module
2+
3+
To check for string casing and some more operations not covered by the JS strings.
4+
5+
## Functions
6+
7+
### isCasing
8+
9+
```js
10+
import { isCasing } from "apic/strings";
11+
12+
const value = "hello_world";
13+
const check = isCasing(value, "snakecase");
14+
```
15+
16+
To check whether given value is a valid provided casing.
17+
18+
The casing can be snakecase, camelcase, pascalcase and kebabcase.
19+
20+
### isPlural
21+
22+
```js
23+
import { isPlural } from "apic/strings";
24+
25+
const value = "properties";
26+
const check = isPlural(value);
27+
```
28+
29+
### isSingular
30+
31+
```js
32+
import { isSingular } from "apic/strings";
33+
34+
const value = "property";
35+
const check = isSingular(value);
36+
```
37+
38+
### pluralize
39+
40+
```js
41+
import { pluralize } from "apic/strings";
42+
43+
const value = pluralize("property");
44+
```
45+
46+
### singular
47+
48+
```js
49+
import { singular } from "apic/strings";
50+
51+
const value = singular("properties");
52+
```

docs/docs/cli/overview.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ It mainly validates your API schema file, runs it against the rules you have spe
66

77
## CLI Architecture
88

9-
[image-to-be-added-cli-arch]
9+
![cli-architecture](/img/cli-arch.png)
1010

1111
### Config
1212

@@ -40,6 +40,14 @@ plugins:
4040
4141
</details>
4242
43+
:::info
44+
45+
Rules section points towards builtin apic rules
46+
47+
Where as plugins sections points towards user defined rules
48+
49+
:::
50+
4351
### Rules
4452
4553
Rules are the validations executed over a schema file.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Status Code Checks
2+
3+
## Desc
4+
5+
1. Rule Name: status_code_check
6+
2. Category: quality
7+
8+
Checks whether there is any invalid status code. Also can be used only allow particular set of status code in an API.
9+
10+
## Options
11+
12+
| Name | Desc | Required | Type | Default |
13+
| -------------------- | ---------------------------------------- | -------- | -------- | ------- |
14+
| allowed_status_codes | status code that are only allowed in api | false | String[] | [ ] |
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Body In Get Request
2+
3+
## Desc
4+
5+
1. Rule Name: body_in_get_req
6+
2. Category: security
7+
8+
Check whether there is body in a GET request.
9+
10+
## Options
11+
12+
None

0 commit comments

Comments
 (0)