Conversion to 2.0 (--v2.0), improvements and fixes (#10)

First of all, now you can convert a collection manually exported from Postman UI.

Until this commit, any collection json had to be inside of root 'collection' object. Postman API returns collections in a such way and that was my case. So any collection exported using UI was mistakenly not detected as correct one.

The second thing that it is now possible to convert collections from v2.1 to v2.0 using --v2.0 flag. Even if they are exported via Postman API, of course.

Also some important refactorings are here.
This commit is contained in:
2023-09-17 21:42:06 +08:00
parent 5c85f23514
commit 3c1871ce1f
11 changed files with 296 additions and 26 deletions

21
src/HttpVersion.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace PmConverter;
enum HttpVersion: string
{
case Version10 = '1.0';
case Version11 = '1.1';
case Version2 = '2';
case Version3 = '3';
public static function values(): array
{
return array_combine(
array_column(self::cases(), 'name'),
array_column(self::cases(), 'value'),
);
}
}