Step 2: Extract fields
Now that you have qaskx-cli installed and setup, the next commands are simple. For the purpose of the tutorial we will use the Pet Store OpenAPI specification.
If you have your own OpenAPI specification you are welcome to try it after you are familiar with the command arguments.
Execute the command below to see the ouput for the Pet Store OpenAPI.
The output is lengthy, and the session will look something like the below.
A better option is to save the details to a file. The save to a file the command is below.
qaskx-cli definition extract --category basic --spec https://petstore3.swagger.io/api/v3/openapi.json
The console output will look something like the below. This is a large list.
______ ___ _______. __ ___ ___ ___
/ __ \ / \ / || |/ / \ \ / /
| | | | / ^ \ | (----`| ' / \ V /
| | | | / /_\ \ \ \ | < > <
| `--' '--. / _____ \ .----) | | . \ / . \
\_____\_____\/__/ \__\ |_______/ |__|\__\ /__/ \__\
qaskx-cli - command line tool
version - 0.0.5
url - https://docs.qaskx.one/qaskx-cli/
copyright - 2023 qaskx.one, usage license limited
HD C:/Users/tom/AppData/Local/Temp/QASKX1214747780/openapifile.json
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 1 username string 0 -1
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 2 firstName string 0 -1
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 3 lastName string 0 -1
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 4 email string 0 -1
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 5 password string 0 -1
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 6 phone string 0 -1
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 7 userStatus integer int32 0 -1 User Status
RP /user/createWithList Creates list of users with given input... POST 200 Successful operation 8 id integer int64 0 -1
RQ /user This can only be done by the logged in... POST 000 Created user object 1 username string 0 0
RQ /user This can only be done by the logged in... POST 000 Created user object 2 firstName string 0 0
RQ /user This can only be done by the logged in... POST 000 Created user object 3 lastName string 0 0
RQ /user This can only be done by the logged in... POST 000 Created user object 4 email string 0 0
RQ /user This can only be done by the logged in... POST 000 Created user object 5 password string 0 0
RQ /user This can only be done by the logged in... POST 000 Created user object 6 phone string 0 0
RQ /user This can only be done by the logged in... POST 000 Created user object 7 userStatus integer int32 0 0 User Status
RQ /user This can only be done by the logged in... POST 000 Created user object 8 id integer int64 0 0
RP /user This can only be done by the logged in... POST default successful operation 1 password string 0 -1
RP /user This can only be done by the logged in... POST default successful operation 2 phone string 0 -1
RP /user This can only be done by the logged in... POST default successful operation 3 userStatus integer int32 0 -1 User Status
RP /user This can only be done by the logged in... POST default successful operation 4 id integer int64 0 -1
RP /user This can only be done by the logged in... POST default successful operation 5 username string 0 -1
RP /user This can only be done by the logged in... POST default successful operation 6 firstName string 0 -1
RP /user This can only be done by the logged in... POST default successful operation 7 lastName string 0 -1
RP /user This can only be done by the logged in... POST default successful operation 8 email string 0 -1
RQ /store/order Place a new order in the store POST 000 1 complete boolean 0 0
RQ /store/order Place a new order in the store POST 000 2 id integer int64 0 0
RQ /store/order Place a new order in the store POST 000 3 petId integer int64 0 0
RQ /store/order Place a new order in the store POST 000 4 quantity integer int32 0 0
RQ /store/order Place a new order in the store POST 000 5 shipDate string date-time 0 0
RQ /store/order Place a new order in the store POST 000 6 status string 0 0 Order Status
RP /store/order Place a new order in the store POST 200 successful operation 1 id integer int64 0 -1
RP /store/order Place a new order in the store POST 200 successful operation 2 petId integer int64 0 -1
RP /store/order Place a new order in the store POST 200 successful operation 3 quantity integer int32 0 -1
RP /store/order Place a new order in the store POST 200 successful operation 4 shipDate string date-time 0 -1
RP /store/order Place a new order in the store POST 200 successful operation 5 status string 0 -1 Order Status
RP /store/order Place a new order in the store POST 200 successful operation 6 complete boolean 0 -1
RQ /pet Add a new pet to the store POST 000 Create a new pet in the store 1 id integer int64 0 0
RQ /pet Add a new pet to the store POST 000 Create a new pet in the store 2 name string 0 0
RQ /pet Add a new pet to the store POST 000 Create a new pet in the store 3 category Category 0 0
RQ /pet Add a new pet to the store POST 000 Create a new pet in the store 4 photoUrls []string 0 0
RQ /pet Add a new pet to the store POST 000 Create a new pet in the store 5 tags []Tag 0 0
RQ /pet Add a new pet to the store POST 000 Create a new pet in the store 6 status string 0 0 pet status in the store
RP /pet Add a new pet to the store POST 200 Successful operation 1 name string 0 -1
RP /pet Add a new pet to the store POST 200 Successful operation 2 category Category 0 -1
RP /pet Add a new pet to the store POST 200 Successful operation 3 photoUrls []string 0 -1
RP /pet Add a new pet to the store POST 200 Successful operation 4 tags []Tag 0 -1
RP /pet Add a new pet to the store POST 200 Successful operation 5 status string 0 -1 pet status in the store
RP /pet Add a new pet to the store POST 200 Successful operation 6 id integer int64 0 -1
RQ /pet Update an existing pet by Id PUT 000 Update an existent pet in the store 1 status string 0 0 pet status in the store
RQ /pet Update an existing pet by Id PUT 000 Update an existent pet in the store 2 id integer int64 0 0
RQ /pet Update an existing pet by Id PUT 000 Update an existent pet in the store 3 name string 0 0
RQ /pet Update an existing pet by Id PUT 000 Update an existent pet in the store 4 category Category 0 0
RQ /pet Update an existing pet by Id PUT 000 Update an existent pet in the store 5 photoUrls []string 0 0
RQ /pet Update an existing pet by Id PUT 000 Update an existent pet in the store 6 tags []Tag 0 0
RP /pet Update an existing pet by Id PUT 200 Successful operation 1 status string 0 -1 pet status in the store
RP /pet Update an existing pet by Id PUT 200 Successful operation 2 id integer int64 0 -1
RP /pet Update an existing pet by Id PUT 200 Successful operation 3 name string 0 -1
RP /pet Update an existing pet by Id PUT 200 Successful operation 4 category Category 0 -1
RP /pet Update an existing pet by Id PUT 200 Successful operation 5 photoUrls []string 0 -1
RP /pet Update an existing pet by Id PUT 200 Successful operation 6 tags []Tag 0 -1
RP /user/{username} GET 200 successful operation 1 username string 0 -1
RP /user/{username} GET 200 successful operation 2 firstName string 0 -1
RP /user/{username} GET 200 successful operation 3 lastName string 0 -1
RP /user/{username} GET 200 successful operation 4 email string 0 -1
RP /user/{username} GET 200 successful operation 5 password string 0 -1
RP /user/{username} GET 200 successful operation 6 phone string 0 -1
RP /user/{username} GET 200 successful operation 7 userStatus integer int32 0 -1 User Status
RP /user/{username} GET 200 successful operation 8 id integer int64 0 -1
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 1 firstName string 0 0
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 2 lastName string 0 0
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 3 email string 0 0
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 4 password string 0 0
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 5 phone string 0 0
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 6 userStatus integer int32 0 0 User Status
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 7 id integer int64 0 0
RQ /user/{username} This can only be done by the logged in... PUT 000 Update an existent user in the store 8 username string 0 0
RP /store/order/{orderId} For valid response try integer IDs wit... GET 200 successful operation 1 status string 0 -1 Order Status
RP /store/order/{orderId} For valid response try integer IDs wit... GET 200 successful operation 2 complete boolean 0 -1
RP /store/order/{orderId} For valid response try integer IDs wit... GET 200 successful operation 3 id integer int64 0 -1
RP /store/order/{orderId} For valid response try integer IDs wit... GET 200 successful operation 4 petId integer int64 0 -1
RP /store/order/{orderId} For valid response try integer IDs wit... GET 200 successful operation 5 quantity integer int32 0 -1
RP /store/order/{orderId} For valid response try integer IDs wit... GET 200 successful operation 6 shipDate string date-time 0 -1
RP /pet/{petId}/uploadImage POST 200 successful operation 1 code integer int32 0 -1
RP /pet/{petId}/uploadImage POST 200 successful operation 2 type string 0 -1
RP /pet/{petId}/uploadImage POST 200 successful operation 3 message string 0 -1
RP /pet/{petId} Returns a single pet GET 200 successful operation 1 id integer int64 0 -1
RP /pet/{petId} Returns a single pet GET 200 successful operation 2 name string 0 -1
RP /pet/{petId} Returns a single pet GET 200 successful operation 3 category Category 0 -1
RP /pet/{petId} Returns a single pet GET 200 successful operation 4 photoUrls []string 0 -1
RP /pet/{petId} Returns a single pet GET 200 successful operation 5 tags []Tag 0 -1
RP /pet/{petId} Returns a single pet GET 200 successful operation 6 status string 0 -1 pet status in the store
SC Category 1 id integer int64 0 -1
SC Category 2 name string 0 -1
SC Tag 1 id integer int64 0 -1
SC Tag 2 name string 0 -1
A better view is possible by saving the results to a file. Execute the command below to save the results to your local directory.
qaskx-cli definition extract --category basic --spec https://petstore3.swagger.io/api/v3/openapi.json --output petstore_extract.csv --verbose
The console output will look something like the below when saving to file.
______ ___ _______. __ ___ ___ ___
/ __ \ / \ / || |/ / \ \ / /
| | | | / ^ \ | (----`| ' / \ V /
| | | | / /_\ \ \ \ | < > <
| `--' '--. / _____ \ .----) | | . \ / . \
\_____\_____\/__/ \__\ |_______/ |__|\__\ /__/ \__\
qaskx-cli - command line tool
version - 0.0.5
url - https://docs.qaskx.one/qaskx-cli/
copyright - 2023 qaskx.one, usage license limited
QX>>> 2024/03/24 21:00:06 Output produced to file 'petstore_extract.csv'
QX>>> 2024/03/24 21:00:06 Completed extract of OpenAPI data
You can view the results using Excel and opening file petstore_extract.csv
That’s how simple it is to produce a listing from an OpenAPI specification. For some more options, lets move onto the next Step.
If you were to set two environment variables as follows. Then your ouput is just the name of the output file, which can be fed into your tool chain as required. Of course your shell script itself can keep track of the file name also.
As powershell:
$env:QASKX_LOGO="false"
$env:QASKX_BARE_CLI="true"As Bash
export QASKX_LOGO="false"
export QASKX_BARE_CLI="true"The the ouput is just the filename. If you used a fully qualified file name then that would be shown.
QX>>> 2024/03/24 21:00:08 Output produced to file 'petstore_extract.csv'