Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.
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
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ public List<Parameter> processParameters(List<Parameter> parameters) {

}

for (Parameter parameter : processedPathLevelParameters) {
Schema schema = parameter.getSchema();
if(schema != null){
schemaProcessor.processSchema(schema);
}
}

return processedPathLevelParameters;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import io.swagger.v3.oas.models.parameters.RequestBody;
import io.swagger.v3.parser.ResolverCache;
import io.swagger.v3.parser.models.RefFormat;
import mockit.FullVerifications;
import mockit.Injectable;
import mockit.Mocked;
import mockit.StrictExpectations;
import mockit.*;
import org.testng.annotations.Test;


Expand Down Expand Up @@ -44,7 +41,18 @@ public void testProcessParameters_TypesThatAreNotRefOrBody(@Injectable final Hea
@Injectable final CookieParameter cookieParameter,
@Injectable final PathParameter pathParameter) throws Exception {
expectedModelProcessorCreation();

new Expectations() {
{
headerParameter.getSchema();
result = null;
queryParameter.getSchema();
result = null;
cookieParameter.getSchema();
result = null;
pathParameter.getSchema();
result = null;
}
};
final List<Parameter> processedParameters = new ParameterProcessor(cache, openAPI)
.processParameters(Arrays.<Parameter>asList(headerParameter,
queryParameter,
Expand Down Expand Up @@ -78,6 +86,12 @@ public void testProcessParameters_RefToHeader(
Parameter refParameter = new Parameter().$ref(ref);

expectLoadingRefFromCache(ref, RefFormat.INTERNAL, resolvedHeaderParam);
new Expectations() {
{
resolvedHeaderParam.getSchema();
result = null;
}
};

final List<Parameter> processedParameters = new ParameterProcessor(cache, openAPI)
.processParameters(Arrays.<Parameter>asList(refParameter));
Expand Down Expand Up @@ -132,8 +146,6 @@ private void expectedModelProcessorCreation() {
new SchemaProcessor(cache, openAPI);
times = 1;
result = modelProcessor;


}};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,20 @@ public void testRefAdditionalProperties() throws Exception {
OpenAPI openAPI = new OpenAPIV3Parser().read("src/test/resources/relative/additionalProperties.yaml");

Assert.assertNotNull(openAPI);
Assert.assertTrue(openAPI.getComponents().getSchemas().size() == 3);
Assert.assertEquals(4, openAPI.getComponents().getSchemas().size());
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("link-object"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("rel-data"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("result"));
Assert.assertNotNull(openAPI.getComponents().getSchemas().get("SomeId"));

PathItem pathItem = openAPI.getPaths().get("/issue749");
Assert.assertNotNull(pathItem);
List<Parameter> parameters = pathItem.getGet().getParameters();
Assert.assertNotNull(parameters);
Assert.assertEquals(parameters.size(), 1);
Assert.assertEquals(parameters.get(0).getName(), "i");
Assert.assertNotNull(parameters.get(0).getSchema());
Assert.assertEquals(parameters.get(0).getSchema().get$ref(), "#/components/schemas/SomeId");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,18 @@ paths:
content:
application/json:
schema:
"$ref": "./globals.yaml#/components/schemas/result"
"$ref": "./globals.yaml#/components/schemas/result"
"/issue749":
get:
parameters:
- name: i
in: query
description: param i
required: true
style: form
explode: true
schema:
$ref: ./someid-schema.yaml#/SomeId
responses:
'204':
description: No content result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SomeId:
type: integer
format: int32
description: My value 123
example: 123