Skip to content

Commit

Permalink
Feat: Add Import-postman-collection command
Browse files Browse the repository at this point in the history
* Initial simple REST mapper

* Add Basic Collection Importing

* Add postman collection import support

* Remove Inspector command and code as it's sunset

* Merge branch 'main' into import-postman-collection

* chore: fix merge issue

* Validate collection to ensure v2.1
  • Loading branch information
frankkilcommins authored Feb 1, 2024
1 parent 8f2a0bb commit 5b4354b
Show file tree
Hide file tree
Showing 13 changed files with 2,194 additions and 926 deletions.
2 changes: 1 addition & 1 deletion .github/gitversion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 0.4
next-version: 0.5
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: '{InformationalVersion}'
Expand Down
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Simple utility CLI for importing data into SwaggerHub Explore.
> `export-spaces` Export SwaggerHub Explore spaces to filesystem
>
> `import-spaces` Import SwaggerHub Explore spaces from a file
>
> `import-postman-collection` Import Postman Collection from a file into SwaggerHub Explore

### Prerequisites
Expand Down Expand Up @@ -139,6 +141,42 @@ From SwaggerHub Explore, navigate to your browser development tools, locate the
> Please note - the current `import-spaces` does not support importing KAFKA APIs
### Running the `import-postman-collection` command

**Command Options**
```
_____ _ ____ _ _
| ____| __ __ _ __ | | ___ _ __ ___ / ___| | | (_)
| _| \ \/ / | '_ \ | | / _ \ | '__| / _ \ | | | | | |
| |___ > < | |_) | | | | (_) | | | | __/ _ | |___ | | | |
|_____| /_/\_\ | .__/ |_| \___/ |_| \___| (_) \____| |_| |_|
|_|
```
**Description:**
> Import SwaggerHub Explore spaces from a file
**Usage:**
> Explore.CLI import-spaces [options]
**Options:**
> `-ec`, `--explore-cookie` <explore-cookie> (REQUIRED) A valid and active SwaggerHub Explore session cookie
> `-fp`, `--file-path` <file-path> (REQUIRED) The path to the file used for importing data
> `-v`, `--verbose` Include verbose output during processing
> `-?`, `-h`, `--help` Show help and usage information
**Note** - the format for SwaggerHub Explore cookies is as follows: `"cookie-name=cookie-value; cookie-name=cookie-value"`

>Example: `"SESSION=5a0a2e2f-97c6-4405-b72a-299fa8ce07c8; XSRF-TOKEN=3310cb20-2ec1-4655-b1e3-4ab76a2ac2c8"`
> **Notes:**
> - Compatible with Postman Collections v2.1
> - Nested collections get flattened into a single Explore space
> - GraphQL collections/requests not supported
> - Environments, Authorization data (not including explicit headers), Pre-request Scripts, Tests are not included in import
## More Information on SwaggerHub Explore
- For SwaggerHub Explore info, see - https://swagger.io/tools/swaggerhub-explore/
Expand Down
39 changes: 39 additions & 0 deletions explore-cli.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{91156892-0E82-463A-9EE0-74C0C52183C9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Explore.Cli", "src\Explore.Cli\Explore.Cli.csproj", "{7620B78C-50A4-4B9D-A2E9-ECFF012CAC8B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{80DA4196-73E3-43FF-BF1F-E4779C246124}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Explore.Cli.Tests", "test\Explore.Cli.Tests\Explore.Cli.Tests.csproj", "{453AAC82-60C9-4282-A301-909D9B7B91B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7620B78C-50A4-4B9D-A2E9-ECFF012CAC8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7620B78C-50A4-4B9D-A2E9-ECFF012CAC8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7620B78C-50A4-4B9D-A2E9-ECFF012CAC8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7620B78C-50A4-4B9D-A2E9-ECFF012CAC8B}.Release|Any CPU.Build.0 = Release|Any CPU
{453AAC82-60C9-4282-A301-909D9B7B91B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{453AAC82-60C9-4282-A301-909D9B7B91B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{453AAC82-60C9-4282-A301-909D9B7B91B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{453AAC82-60C9-4282-A301-909D9B7B91B2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7620B78C-50A4-4B9D-A2E9-ECFF012CAC8B} = {91156892-0E82-463A-9EE0-74C0C52183C9}
{453AAC82-60C9-4282-A301-909D9B7B91B2} = {80DA4196-73E3-43FF-BF1F-E4779C246124}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {46BE36A8-9E60-457F-97F1-F0933F220729}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions src/Explore.Cli/ExploreContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,22 @@ public class Parameter
[JsonPropertyName("name")]
public string? Name { get; set; }

[JsonPropertyName("schema")]
public Schema? Schema { get; set; }

[JsonPropertyName("examples")]
public Examples? Examples { get; set; }


}

public class Schema
{
[JsonPropertyName("type")]
public string? type { get; set; }
}


public class Examples
{
[JsonPropertyName("example")]
Expand Down
125 changes: 0 additions & 125 deletions src/Explore.Cli/InspectorContracts.cs

This file was deleted.

Loading

0 comments on commit 5b4354b

Please sign in to comment.