Process examples in request bodies
package io.swagger.v3.parser.processors;
import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.examples.Example;
import io.swagger.v3.oas.models.media.MediaType;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.parameters.RequestBody;
@@ -18,11 +19,13 @@ import static io.swagger.v3.parser.util.RefUtils.isAnExternalRefFormat;
public class RequestBodyProcessor {
private final SchemaProcessor schemaProcessor;
private final ExternalRefProcessor externalRefProcessor;
+ private final ExampleProcessor exampleProcessor;
private final ResolverCache cache;
private final OpenAPI openAPI;
public RequestBodyProcessor(ResolverCache cache, OpenAPI openAPI) {
schemaProcessor = new SchemaProcessor(cache,openAPI);
+ exampleProcessor = new ExampleProcessor(cache,openAPI);
this.externalRefProcessor = new ExternalRefProcessor(cache, openAPI);
this.cache = cache;
this.openAPI = openAPI;
@@ -44,6 +47,11 @@ public class RequestBodyProcessor {
schemaProcessor.processSchema(schema);
}
}
+ if(mediaType.getExamples() != null) {
+ for(Example ex: mediaType.getExamples().values()){
+ exampleProcessor.processExample(ex);
+ }
+ }
}
}
}
