oav/lib/generator
Mike Harder bf50f770da
[generate-examples] Include Min/Max in default example titles (#1054)
- Fixes #935 
- Uses unique titles when first generating examples
- Still has unrelated bugs where title can be changed when updating existing examples
2024-10-15 15:34:12 -07:00
..
README.md Generate swagger report 2 (#797) 2022-05-23 17:26:14 +08:00
exampleCache.ts Test Scenario Support (#558) 2021-01-18 16:54:38 +08:00
exampleGenerator.ts [generate-examples] Include Min/Max in default example titles (#1054) 2024-10-15 15:34:12 -07:00
exampleRule.ts Test Scenario Support (#558) 2021-01-18 16:54:38 +08:00
mocker.ts Don't generate examples for `password` with a random string (#1042) 2024-07-12 17:38:54 -07:00
swaggerMocker.ts Fix issues about: multipart/form-data, duration, exampleJsonPath, LRO validation and generate (#812) 2022-06-24 17:15:32 +08:00
translator.ts Test Scenario Support (#558) 2021-01-18 16:54:38 +08:00
util.ts Apiscenario (#747) 2022-06-10 15:01:39 +08:00

README.md

What does the tool do? What issues does the tool catch?

Example Generator generates swagger examples according to swagger spec file.

Command usage:

oav generate-examples <spec-path>

Params:
  spec-path          the swagger spec file path


Options:
  --version                      Show version number                          [boolean]
  -l, --logLevel                 Set the logging level for console.
  [choices: "off", "json", "error", "warn", "info", "verbose", "debug", "silly"]
                                                               [default: "info"]
  -f, --logFilepath              Set the log file path. It must be an absolute
                                 filepath. By default the logs will stored in a
                                 timestamp based log file at
                                 "/home/abc/oav_output".
  -p, --pretty                   Pretty print
  -o, --operationIds             String of operation ids split by comma.      [string]
  --payload, --payloadDir        the directory path contains payload.         [string]
  -c, --config                   the readme config path.                      [string]
  --tag, --tagName               the readme tag name.                         [string]
  -h, --help                     Show help                                    [boolean]
  --oe --outputExceptionInReport Show runtime exceptions                      [boolean]

payload file

Payload directory should contain sub folders named by [RP_namespace]/[stable|preview]/[api-version]/[operationId], for example, Microsoft.AppPlatform/stable/2020-07-01/SignalR_Get. Put payload files named by status code under this correspondent folder of operationId.

.
└── SignalR_Get
    └── 200.json
└── SignalR_CreateOrUpdate
    ├── 201.json
    └── 202.json

Payload file should be a valid json file and contains liveRequest && liveResponse. It can be fetched in live validation result from kusto.


{
    "liveRequest": {
        "headers": {},
        "method": "PUT",
        "url": "",
        "body": {},
        "query": {}
    },
    "liveResponse": {
        "statusCode": "202",
        "headers": {
        },
        "body": {}
    }
}