Skip to content

Uploading OpenAPI Files

To create an API target in the web portal:

  1. Navigate to https://app.nightvision.net.
  2. Click on Targets in the left sidebar.
How to find Targets.
How to find Targets.
  1. Click on the New Target button on the right.
Create a new target.
Create a new target.
  1. In the Add New Target form, select “API Target” and enter the following details, then click Create Target:
    1. Target Name: nv-firing-range
    2. Base URL: https://javaspringvulny.nvtest.io:9000/
    3. OpenAPI URL: https://raw.githubusercontent.com/ff14-advanced-market-search/temp-fe/main/openapi-spec.yml
The Add New Target form.
Upload an OpenAPI file to create an API Target.

Create API Targets with a Public OpenAPI file (CLI)

Section titled “Create API Targets with a Public OpenAPI file (CLI)”

If the OpenAPI file is available on the public internet, you can create targets via the CLI and specify the URL where the OpenAPI file can be downloaded:

Terminal window
# Option 1: Create the target without an OpenAPI specification (attach it later)
nightvision target create nv-firing-range-public https://firing-range.saddlebagexchange.com --type API
# Option 2: Create the target and attach an OpenAPI specification
nightvision target create nv-firing-range-public \
--swagger-url https://raw.githubusercontent.com/ff14-advanced-market-search/temp-fe/main/openapi-spec.yml \
--type API

Create API Targets and Upload an OpenAPI file (CLI)

Section titled “Create API Targets and Upload an OpenAPI file (CLI)”

You can create an API Target and specify the OpenAPI file at creation time, instead of attaching the OpenAPI specification later.

Terminal window
# Option 1: Create the target without an OpenAPI specification (attach it later)
nightvision target create broken-flask-api http://localhost:4000 --type API
# Option 2: Create the target and attach an OpenAPI specification
nightvision target create broken-flask-api \
--swagger-file openapi-spec.yml --type API

Upload OpenAPI Files to an Existing Target (CLI)

Section titled “Upload OpenAPI Files to an Existing Target (CLI)”

If you have an existing OpenAPI file, you can update the target:

Terminal window
nightvision target update broken-flask-api \
--swagger-file openapi-spec.yml

Use Source Intelligence for a Target (CLI)

Section titled “Use Source Intelligence for a Target (CLI)”

If you’ve updated your code or want Source Intelligence to regenerate the API documentation, append --target to your openapi extract command:

Terminal window
nightvision openapi extract . --target broken-flask-api --lang python

To try Source Intelligence before you create a target, or to review an OpenAPI file before attaching it, use the --no-target flag (CLI 0.19.0 or later) in place of --target:

Terminal window
nightvision openapi extract . --lang python --no-target