Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release-postman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:
inputs:
atlas_prod_base_url:
description: 'Base URL of Atlas.'
description: Base URL of Atlas
required: true
type: string
secrets: # all secrets are passed explicitly in this workflow
Expand Down
37 changes: 22 additions & 15 deletions tools/postman/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# Postman Collections from OpenAPI

This folder contains the code required to generate the MongoDB Atlas Postman collections from the MongoDB OpenAPI Specification. All scripts can be run locally if the environment variables for POSTMAN_API_KEY, WORKSPACE_ID, BASE_URL, and SLACK_WEBHOOK_URL are set
Folder contains the code required to generate the [MongoDB Atlas Postman collections](https://www.postman.com/mongodb-devrel?tab=collections).
Collections are generated from from the MongoDB OpenAPI Specification.

## Purpose of the project

Scripts allow for the generation of Postman collections from OpenAPI specifications. This allows
the [DevRel Postman workspace](https://www.postman.com/mongodb-devrel) to stay up to date with the latest version of the
the [DevRel Postman workspace](https://www.postman.com/mongodb-devrel?tab=collections) to stay up to date with the latest version of the
API.

Process of updating involves:

1. Fetching OpenAPI file
2. Converting OpenAPI file to Postman Collection
3. Updating information about the Collection
4. Uploading the Collection to Postman

## Postman folder structure

- `openapi` - Where the OpenAPI Spec, version information, and fork files are stored
- `tmp` - Where the Postman Collection is generated and the temporary working files are stored
- `scripts` - Where the Bash scripts are stored
- `validation` - Where the files for spectral validation of the generated collection is stored

## Postman Collection Generation Workflow

```mermaid
Expand Down Expand Up @@ -48,6 +44,20 @@ flowchart TD

5. **Upload Collection to Postman**: Use the Postman API to upload the Collection to Postman.

## Limitations

Our Postman collection generation has several limitations, meaning some manual user actions may be necessary during setup:

- Only a single content-type header is supported generation, meaning users may have to manually update this header if the API supports more than one; see docs links on endpoint level
- Only a single auth scheme is supported during generation, meaning users may have to update their auth on the collection level or endpoint level if not selecting the default

## Postman folder structure

- `openapi` - Where the OpenAPI Spec, version information, and fork files are stored
- `tmp` - Where the Postman Collection is generated and the temporary working files are stored
- `scripts` - Where the Bash scripts are stored
- `validation` - Where the files for spectral validation of the generated collection is stored

## Local setup and validation

### Prerequisites
Expand All @@ -64,6 +74,7 @@ To test the scripts locally, you should set up the required environment variable
BASE_URL=""
WORKSPACE_ID=""
POSTMAN_API_KEY=""
SLACK_WEBHOOK_URL=""
```

Run `make load-env` to set your required and overriding env vars.
Expand All @@ -78,10 +89,6 @@ Once env vars are configured, the setup scripts can be run locally using the Mak
- `make transform_collection`
- `make upload_collection`

## Automatic updates

### Limitations

Our Postman collection generation has several limitations, meaning some manual user actions may be necessary during setup:

- Only a single content-type header is supported generation, meaning users may have to manually update this header if the API supports more than one; see docs links on endpoint level
- Only a single auth scheme is supported during generation, meaning users may have to update their auth on the collection level or endpoint level if not selecting the default
Postman collection is regerented automatically by github action [`release-spec.yml`](../../.github/workflows/release-spec.yml)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regenerated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I have it fixed in follow up PR along with more content about the jobs

Loading