Skip to content

Commit 7b21bc0

Browse files
authored
Merge pull request #228 from SalesforceCommerceCloud/oas-support
@W-17701650@ Add support for OAS
2 parents 795c36a + 642c2e8 commit 7b21bc0

File tree

19 files changed

+4115
-469
lines changed

19 files changed

+4115
-469
lines changed

README.md

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Raml Toolkit <!-- omit in toc -->
22

3-
A collection of raml tools for commerce cloud and beyond
3+
A collection of RAML and OAS tools for commerce cloud and beyond
4+
5+
**Note:** Running some OAS commands requires that oasdiff is installed. Install oasdiff according to https://github.com/oasdiff/oasdiff#installation
46

57
[![CircleCI][circleci-image]][circleci-url]
68

@@ -26,13 +28,67 @@ npm install -g @commerce-apps/raml-toolkit
2628

2729
## Usage
2830

29-
The npm installs the binaries as both `raml-toolkit` and `ramlint` and they can be used interchangeably. You can always run with `--help` to get available options, currently the options are as follows.
31+
Npm installs the binaries as both `raml-toolkit` and `ramlint` and they can be used interchangeably. You can always run with `--help` to get available options, currently the options are as follows.
3032

31-
### Commands
33+
## Commands
3234

3335
**Note:** Some commands require environment variables to be set. This can be done using a [.env file](https://www.npmjs.com/package/dotenv#rules) in your working directory (the directory from which you run `raml-toolkit`).
3436

35-
<!-- commands -->
37+
### Commands for OAS
38+
39+
- [`raml-toolkit generate`](#raml-toolkit-generate)
40+
- [`raml-toolkit diff BASE NEW -s oas`](#raml-toolkit-diff-base-new-s-oas)
41+
- [`raml-toolkit download`](#raml-toolkit-download)
42+
43+
#### `raml-toolkit generate`
44+
45+
A wrapper command for `openapi-generator-cli generate`
46+
47+
```txt
48+
USAGE
49+
$ raml-toolkit generate -i OAS_spec_file -o output_dir -t templates_dir
50+
51+
OPTIONS
52+
-i, --inputSpec=OAS_spec_file Format of the output. Defaults to JSON if --out-file is specified,
53+
otherwise text.
54+
55+
-o, --outputDir=output_dir The directory to place the generated API
56+
57+
-t, --templateDir=template_dir The directory with the mustache templates for generating the API
58+
59+
-c, --configFile=config_file A yaml file containing configurations for openapi-generator-cli. A default configuration will be used if this is not provided.
60+
61+
-g, --generator The generator. Defaults to `typescript-fetch`
62+
63+
--skipValidateSpec Generate API without validating the spec. Defaults to false.
64+
```
65+
66+
#### `raml-toolkit diff BASE NEW -s oas`
67+
68+
**Note:** This command requires that oasdiff is installed. Install oasdiff according to https://github.com/oasdiff/oasdiff#installation
69+
70+
```txt
71+
USAGE
72+
$ raml-toolkit diff BASE NEW -s oas
73+
74+
ARGUMENTS
75+
BASE The base API spec file or directory
76+
NEW The new API spec file or directory
77+
78+
OPTIONS
79+
-f, --format=(json|console) Format of the output. Defaults to JSON if --out-file is specified,
80+
otherwise text.
81+
82+
-o, --out-file=out-file File to store the computed difference
83+
84+
--dir Find the differences for files in two directory trees
85+
86+
-s, --spec Toggles OAS mode. Set this to `oas`. Otherwise, the command will run the RAML version
87+
```
88+
89+
### Commands for RAML
90+
91+
<!-- commands for RAML -->
3692
- [`raml-toolkit diff BASE NEW`](#raml-toolkit-diff-base-new)
3793
- [`raml-toolkit download`](#raml-toolkit-download)
3894
- [`raml-toolkit lint [FILENAME]`](#raml-toolkit-lint-filename)

config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
additionalProperties:
2+
paramNaming: original

openapitools.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
3+
"spaces": 2,
4+
"generator-cli": {
5+
"version": "7.13.0"
6+
}
7+
}

0 commit comments

Comments
 (0)