@@ -83,6 +83,58 @@ public class OpenAPIV3ParserTest {
83
83
protected int serverPort = getDynamicPort ();
84
84
protected WireMockServer wireMockServer ;
85
85
86
+ @ Test
87
+ public void testIssue1644_NullValue () throws Exception {
88
+ ParseOptions options = new ParseOptions ();
89
+ String issue1644 = "openapi: 3.0.0\n " +
90
+ "info:\n " +
91
+ " title: Operations\n " +
92
+ " version: 0.0.0\n " +
93
+ "paths:\n " +
94
+ " \" /operations\" :\n " +
95
+ " post:\n " +
96
+ " parameters:\n " +
97
+ " - name: param0\n " +
98
+ " schema:\n " +
99
+ " type: string\n " +
100
+ " responses:\n " +
101
+ " default:\n " +
102
+ " description: None\n " ;
103
+ SwaggerParseResult result = new OpenAPIV3Parser ().readContents (issue1644 , null , options );
104
+
105
+ Assert .assertNotNull (result );
106
+ Assert .assertNotNull (result .getOpenAPI ());
107
+ assertEquals (result .getMessages ().size (),1 );
108
+ assertTrue (result .getMessages ().contains ("attribute paths.'/operations'(post).parameters.[param0].in is missing" ));
109
+ assertFalse (result .getMessages ().contains ("attribute paths.'/operations'(post).parameters.[param0].in is not of type `string`" ));
110
+ }
111
+
112
+ @ Test
113
+ public void testIssue1644_EmptyValue () throws Exception {
114
+ ParseOptions options = new ParseOptions ();
115
+ String issue1644 = "openapi: 3.0.0\n " +
116
+ "info:\n " +
117
+ " title: Operations\n " +
118
+ " version: 0.0.0\n " +
119
+ "paths:\n " +
120
+ " \" /operations\" :\n " +
121
+ " post:\n " +
122
+ " parameters:\n " +
123
+ " - name: param0\n " +
124
+ " in: ''\n " +
125
+ " schema:\n " +
126
+ " type: string\n " +
127
+ " responses:\n " +
128
+ " default:\n " +
129
+ " description: None\n " ;
130
+ SwaggerParseResult result = new OpenAPIV3Parser ().readContents (issue1644 , null , options );
131
+
132
+ Assert .assertNotNull (result );
133
+ Assert .assertNotNull (result .getOpenAPI ());
134
+ assertEquals (result .getMessages ().size (),1 );
135
+ assertTrue (result .getMessages ().contains ("attribute paths.'/operations'(post).parameters.[param0].in is not of type `string`" ));
136
+ }
137
+
86
138
87
139
@ Test
88
140
public void testEmptyStrings_False () throws Exception {
0 commit comments