Skip to content

Commit 67e359c

Browse files
author
Peter Mucha
committed
fixed postman import for 2.1.0 (more lenient). fixes #204
1 parent 2697324 commit 67e359c

File tree

4 files changed

+12
-20
lines changed

4 files changed

+12
-20
lines changed

milkman-rest/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<plugin>
9696
<groupId>org.jsonschema2pojo</groupId>
9797
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
98-
<version>1.0.1</version>
98+
<version>1.2.1</version>
9999
<configuration>
100100
<sourceDirectory>${basedir}/src/main/schema</sourceDirectory>
101101
<targetPackage>com.milkman.rest.postman.schema</targetPackage>

milkman-rest/src/main/java/milkman/ui/plugin/rest/postman/importers/PostmanImporterV21.java

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
package milkman.ui.plugin.rest.postman.importers;
22

3-
import java.io.IOException;
4-
import java.net.URL;
5-
import java.util.LinkedList;
6-
import java.util.List;
7-
import java.util.UUID;
8-
3+
import co.poynt.postman.model.PostmanEnvValue;
4+
import co.poynt.postman.model.PostmanEnvironment;
95
import com.fasterxml.jackson.core.JsonParseException;
10-
import com.fasterxml.jackson.core.JsonParser;
11-
import com.fasterxml.jackson.core.JsonProcessingException;
126
import com.fasterxml.jackson.core.Version;
137
import com.fasterxml.jackson.databind.DeserializationContext;
148
import com.fasterxml.jackson.databind.DeserializationFeature;
15-
import com.fasterxml.jackson.databind.JsonDeserializer;
169
import com.fasterxml.jackson.databind.JsonMappingException;
1710
import com.fasterxml.jackson.databind.ObjectMapper;
1811
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
1912
import com.fasterxml.jackson.databind.module.SimpleModule;
2013
import com.milkman.rest.postman.schema.v21.ItemGroup;
2114
import com.milkman.rest.postman.schema.v21.PostmanCollection210;
2215
import com.milkman.rest.postman.schema.v21.Url;
23-
24-
import co.poynt.postman.model.PostmanEnvValue;
25-
import co.poynt.postman.model.PostmanEnvironment;
16+
import java.io.IOException;
17+
import java.util.LinkedList;
18+
import java.util.List;
19+
import java.util.UUID;
2620
import milkman.domain.Collection;
2721
import milkman.domain.Environment;
2822
import milkman.domain.Environment.EnvironmentEntry;
@@ -108,7 +102,9 @@ private void convertToDomain(ItemGroup pmItem, List<RequestContainer> requests,
108102

109103
//adding headers
110104
RestHeaderAspect headers = new RestHeaderAspect();
111-
pmItem.getRequest().getHeader().forEach(h -> headers.getEntries().add(new HeaderEntry(UUID.randomUUID().toString(),h.getKey(), h.getValue(), true)));
105+
if (pmItem.getRequest().getHeader() != null) {
106+
pmItem.getRequest().getHeader().forEach(h -> headers.getEntries().add(new HeaderEntry(UUID.randomUUID().toString(),h.getKey(), h.getValue(), true)));
107+
}
112108
request.addAspect(headers);
113109

114110
//adding bodies

milkman-rest/src/main/schema/postman-collection-1.0.0.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -928,11 +928,7 @@
928928
}
929929
},
930930
"rawModeData": {
931-
"type": [
932-
"string",
933-
"null",
934-
"array"
935-
],
931+
"type": "string",
936932
"description": "Contains the raw data (parameters) that Postman sends to the server"
937933
},
938934
"graphqlModeData": {

milkman-rest/src/main/schema/postman-collection-2.1.0.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
"$schema": "http://json-schema.org/draft-07/schema#",
281281
"$id": "#/definitions/description",
282282
"description": "A Description can be a raw text, or be an object, which holds the description along with its format.",
283-
"type": "string"
283+
"type": "any"
284284
},
285285
"event-list": {
286286
"$id": "#/definitions/event-list",

0 commit comments

Comments
 (0)