io.swagger.converter.ModelConverters Java Examples
The following examples show how to use
io.swagger.converter.ModelConverters.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Reader.java From dorado with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") private void addResponse(Operation operation, ApiResponse apiResponse, JsonView jsonView) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders(), jsonView); Map<String, Object> examples = parseExamples(apiResponse.examples()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); response.setExamples(examples); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType, jsonView); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
Example #2
Source File: JaxrsParameterExtension.java From swagger-maven-plugin with Apache License 2.0 | 6 votes |
private FormParameter extractFormParameter(Type type, String defaultValue, FormParam param) { FormParameter formParameter = new FormParameter().name(param.value()); if (!Strings.isNullOrEmpty(defaultValue)) { formParameter.setDefaultValue(defaultValue); } Property schema = ModelConverters.getInstance().readAsProperty(type); if (schema != null) { formParameter.setProperty(schema); } String parameterType = formParameter.getType(); if (parameterType == null || parameterType.equals("ref") || parameterType.equals("array")) { formParameter.setType("string"); } return formParameter; }
Example #3
Source File: JaxrsParameterExtension.java From swagger-maven-plugin with Apache License 2.0 | 6 votes |
private CookieParameter extractCookieParameter(Type type, String defaultValue, CookieParam param) { CookieParameter cookieParameter = new CookieParameter().name(param.value()); if (!Strings.isNullOrEmpty(defaultValue)) { cookieParameter.setDefaultValue(defaultValue); } Property schema = ModelConverters.getInstance().readAsProperty(type); if (schema != null) { cookieParameter.setProperty(schema); } String parameterType = cookieParameter.getType(); if (parameterType == null || parameterType.equals("ref") || parameterType.equals("array")) { cookieParameter.setType("string"); } return cookieParameter; }
Example #4
Source File: JaxrsParameterExtension.java From swagger-maven-plugin with Apache License 2.0 | 6 votes |
private HeaderParameter extractHeaderParam(Type type, String defaultValue, HeaderParam param) { HeaderParameter headerParameter = new HeaderParameter().name(param.value()); if (!Strings.isNullOrEmpty(defaultValue)) { headerParameter.setDefaultValue(defaultValue); } Property schema = ModelConverters.getInstance().readAsProperty(type); if (schema != null) { headerParameter.setProperty(schema); } String parameterType = headerParameter.getType(); if (parameterType == null || parameterType.equals("ref") || parameterType.equals("array")) { headerParameter.setType("string"); } return headerParameter; }
Example #5
Source File: JaxrsParameterExtension.java From swagger-maven-plugin with Apache License 2.0 | 6 votes |
private PathParameter extractPathParam(Type type, String defaultValue, PathParam param) { PathParameter pathParameter = new PathParameter().name(param.value()); if (!Strings.isNullOrEmpty(defaultValue)) { pathParameter.setDefaultValue(defaultValue); } Property schema = ModelConverters.getInstance().readAsProperty(type); if (schema != null) { pathParameter.setProperty(schema); } String parameterType = pathParameter.getType(); if (parameterType == null || parameterType.equals("ref")) { pathParameter.setType("string"); } return pathParameter; }
Example #6
Source File: JaxrsParameterExtension.java From swagger-maven-plugin with Apache License 2.0 | 6 votes |
private QueryParameter extractQueryParam(Type type, String defaultValue, QueryParam param) { QueryParameter queryParameter = new QueryParameter().name(param.value()); if (!Strings.isNullOrEmpty(defaultValue)) { queryParameter.setDefaultValue(defaultValue); } Property schema = ModelConverters.getInstance().readAsProperty(type); if (schema != null) { queryParameter.setProperty(schema); } String parameterType = queryParameter.getType(); if (parameterType == null || parameterType.equals("ref")) { queryParameter.setType("string"); } return queryParameter; }
Example #7
Source File: SpringSwaggerExtension.java From swagger-maven-plugin with Apache License 2.0 | 6 votes |
private Property readAsPropertyIfPrimitive(Type type) { if (com.github.kongchen.swagger.docgen.util.TypeUtils.isPrimitive(type)) { return ModelConverters.getInstance().readAsProperty(type); } else { String msg = String.format("Non-primitive type: %s used as request/path/cookie parameter", type); log.warn(msg); // fallback to string if type is simple wrapper for String to support legacy code JavaType ct = constructType(type); if (isSimpleWrapperForString(ct.getRawClass())) { log.warn(String.format("Non-primitive type: %s used as string for request/path/cookie parameter", type)); return new StringProperty(); } } return null; }
Example #8
Source File: ExtendedSwaggerReader.java From msf4j with Apache License 2.0 | 6 votes |
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
Example #9
Source File: AbstractOperationGenerator.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
protected void fillBodyParameter(Swagger swagger, Parameter parameter, Type type, List<Annotation> annotations) { // so strange, for bodyParameter, swagger return a new instance // that will cause lost some information // so we must merge them BodyParameter newBodyParameter = (BodyParameter) io.swagger.util.ParameterProcessor.applyAnnotations( swagger, parameter, type, annotations); // swagger missed enum data, fix it ModelImpl model = SwaggerUtils.getModelImpl(swagger, newBodyParameter); if (model != null) { Property property = ModelConverters.getInstance().readAsProperty(type); if (property instanceof StringProperty) { model.setEnum(((StringProperty) property).getEnum()); } } mergeBodyParameter((BodyParameter) parameter, newBodyParameter); }
Example #10
Source File: ControllerReaderExtension.java From jboot with Apache License 2.0 | 6 votes |
private static Map<String, Property> parseResponseHeaders(Swagger swagger, ReaderContext context, ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; for (ResponseHeader header : headers) { final String name = header.name(); if (StringUtils.isNotEmpty(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<String, Property>(); } final Class<?> cls = header.response(); if (!ReflectionUtils.isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { final Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(header.description()); responseHeaders.put(name, responseProperty); appendModels(swagger, cls); } } } } return responseHeaders; }
Example #11
Source File: DubboReaderExtension.java From swagger-dubbo with Apache License 2.0 | 6 votes |
private static Map<String, Property> parseResponseHeaders(ReaderContext context, ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; for (ResponseHeader header : headers) { final String name = header.name(); if (StringUtils.isNotEmpty(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<String, Property>(); } final Class<?> cls = header.response(); if (!ReflectionUtils.isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { final Property responseProperty = ContainerWrapper.wrapContainer( header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(header.description()); responseHeaders.put(name, responseProperty); appendModels(context.getSwagger(), cls); } } } } return responseHeaders; }
Example #12
Source File: Reader.java From proteus with Apache License 2.0 | 6 votes |
private void addResponse(Operation operation, ApiResponse apiResponse) { Map<String, Property> responseHeaders = parseResponseHeaders(apiResponse.responseHeaders()); Response response = new Response().description(apiResponse.message()).headers(responseHeaders); if (apiResponse.code() == 0) { operation.defaultResponse(response); } else { operation.response(apiResponse.code(), response); } if (StringUtils.isNotEmpty(apiResponse.reference())) { response.schema(new RefProperty(apiResponse.reference())); } else if (!isVoid(apiResponse.response())) { Type responseType = apiResponse.response(); final Property property = ModelConverters.getInstance().readAsProperty(responseType); if (property != null) { response.schema(ContainerWrapper.wrapContainer(apiResponse.responseContainer(), property)); appendModels(responseType); } } }
Example #13
Source File: RpcReaderExtension.java From sofa-rpc with Apache License 2.0 | 6 votes |
private static Map<String, Property> parseResponseHeaders(ReaderContext context, ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; for (ResponseHeader header : headers) { final String name = header.name(); if (StringUtils.isNotEmpty(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<String, Property>(); } final Class<?> cls = header.response(); if (!ReflectionUtils.isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { final Property responseProperty = ContainerWrapper.wrapContainer( header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(header.description()); responseHeaders.put(name, responseProperty); appendModels(context.getSwagger(), cls); } } } } return responseHeaders; }
Example #14
Source File: Test.java From elepy with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws JsonProcessingException { final var read = ModelConverters.getInstance().read(User.class); final var elepy_model = new OpenAPI() .info(new Info() .title("Elepy Model") .version("3.0") ) .paths(new Paths()) .paths(createPathsFromModel(ModelUtils.createDeepSchema(User.class))) ; read.forEach(elepy_model::schema); final var objectMapper = new ObjectMapper(); objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); System.out.println(objectMapper.writeValueAsString(elepy_model).replaceAll("SIMPLE", "simple")); }
Example #15
Source File: RpcReaderExtension.java From sofa-rpc with Apache License 2.0 | 6 votes |
private Parameter readParam(Swagger swagger, Type type, Class<?> cls, ApiParam param) { PrimitiveType fromType = PrimitiveType.fromType(type); final Parameter para = null == fromType ? new BodyParameter() : new QueryParameter(); Parameter parameter = ParameterProcessor.applyAnnotations(swagger, para, type, null == param ? new ArrayList<Annotation>() : Collections.<Annotation> singletonList(param)); if (parameter instanceof AbstractSerializableParameter) { final AbstractSerializableParameter<?> p = (AbstractSerializableParameter<?>) parameter; if (p.getType() == null) { p.setType(null == fromType ? "string" : fromType.getCommonName()); } p.setRequired(p.getRequired() || cls.isPrimitive()); } else { //hack: Get the from data model paramter from BodyParameter BodyParameter bp = (BodyParameter) parameter; bp.setIn("body"); Property property = ModelConverters.getInstance().readAsProperty(type); final Map<PropertyBuilder.PropertyId, Object> args = new EnumMap<PropertyBuilder.PropertyId, Object>( PropertyBuilder.PropertyId.class); bp.setSchema(PropertyBuilder.toModel(PropertyBuilder.merge(property, args))); } return parameter; }
Example #16
Source File: Reader.java From dorado with Apache License 2.0 | 5 votes |
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers, JsonView jsonView) { Map<String, Property> responseHeaders = null; if (headers != null) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new LinkedHashMap<String, Property>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls, jsonView); if (property != null) { Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
Example #17
Source File: Reader.java From proteus with Apache License 2.0 | 5 votes |
private void appendModels(Type type) { final Map<String, Model> models = ModelConverters.getInstance().readAll(type); for (Map.Entry<String, Model> entry : models.entrySet()) { swagger.model(entry.getKey(), entry.getValue()); } }
Example #18
Source File: JaxrsReader.java From swagger-maven-plugin with Apache License 2.0 | 5 votes |
private Map<String, Model> readAllModels(Type responseClassType) { Map<String, Model> modelMap = ModelConverters.getInstance().readAll(responseClassType); if (modelMap != null) { handleJsonTypeInfo(responseClassType, modelMap); } return modelMap; }
Example #19
Source File: SwaggerFilter.java From hawkular-metrics with Apache License 2.0 | 5 votes |
public SwaggerFilter() { ModelConverters modelConverters = ModelConverters.getInstance(); modelConverters.addConverter(new ParamModelConverter(Tags.class, () -> { return new StringFormatProperty("tag-list"); })); modelConverters.addConverter(new ParamModelConverter(Duration.class, () -> { return new StringFormatProperty("duration"); })); }
Example #20
Source File: PlayReader.java From swagger-play with Apache License 2.0 | 5 votes |
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; if (headers != null && headers.length > 0) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
Example #21
Source File: TestRBeanSwaggerModel.java From datacollector with Apache License 2.0 | 5 votes |
@Test public void testAllTypes() { Map<String, Model> modelMap = ModelConverters.getInstance() .read(TypeToken.of(RAllTypes.class).getType()); Model rAllTypes = modelMap.get(RAllTypes.class.getSimpleName()); Assert.assertNotNull(rAllTypes); Map<String, Class<? extends Property>> expectedProperties = ImmutableMap.<String, Class<? extends Property>>builder() .put("id", StringProperty.class) .put("rChar", StringProperty.class) .put("rDate", LongProperty.class) .put("rTime", LongProperty.class) .put("rDatetime", LongProperty.class) .put("rLong", LongProperty.class) .put("rDouble", DoubleProperty.class) .put("rDecimal", DecimalProperty.class) .put("rEnum", StringProperty.class) .put("rSubBean", RefProperty.class) .put("rSubBeanList", ArrayProperty.class) .build(); Assert.assertEquals(expectedProperties.size(), rAllTypes.getProperties().size()); expectedProperties.forEach( (k, v) -> Assert.assertEquals(v, rAllTypes.getProperties().get(k).getClass()) ); StringProperty rEnumProperty = ((StringProperty)rAllTypes.getProperties().get("rEnum")); Assert.assertTrue( new HashSet<>(rEnumProperty.getEnum()) .containsAll(Arrays.stream(Alphabet.values()).map(Enum::name).collect(Collectors.toSet())) ); RefProperty refProperty = (RefProperty) rAllTypes.getProperties().get("rSubBean"); Assert.assertEquals(refProperty.getSimpleRef(), RSubBean.class.getSimpleName()); ArrayProperty arrayProperty = (ArrayProperty) rAllTypes.getProperties().get("rSubBeanList"); Assert.assertEquals(((RefProperty)arrayProperty.getItems()).getSimpleRef(), RSubBean.class.getSimpleName()); }
Example #22
Source File: ExtendedSwaggerReader.java From msf4j with Apache License 2.0 | 5 votes |
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; if (headers != null && headers.length > 0) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new HashMap<>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { Property responseProperty = ContainerWrapper .wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
Example #23
Source File: SwaggerModel.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public SwaggerModel(final ApplicationVersion applicationVersion, final List<SwaggerContributor> contributors) { this.applicationVersion = checkNotNull(applicationVersion); this.contributors = checkNotNull(contributors); // filter banned types from model, such as Groovy's MetaClass ModelConverters.getInstance().addConverter(new ModelFilter()); this.reader = new Reader(createSwagger()); }
Example #24
Source File: SwaggerAnnotationsReader.java From mdw with Apache License 2.0 | 5 votes |
private SwaggerAnnotationsReader(Swagger swagger) { this.swagger = swagger; ModelConverters.getInstance().addConverter(new SwaggerModelConverter() { protected boolean shouldIgnoreClass(Type type) { if (type instanceof SimpleType && JSONObject.class.equals(((SimpleType)type).getRawClass())) { return true; } return super.shouldIgnoreClass(type); } }); }
Example #25
Source File: SwaggerUtils.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public static void setParameterType(Swagger swagger, Type type, AbstractSerializableParameter<?> parameter) { addDefinitions(swagger, type); Property property = ModelConverters.getInstance().readAsProperty(type); if (isComplexProperty(property)) { // cannot set a simple parameter(header, query, etc.) as complex type String msg = String .format("not allow complex type for %s parameter, type=%s.", parameter.getIn(), type.getTypeName()); throw new IllegalStateException(msg); } parameter.setProperty(property); }
Example #26
Source File: SwaggerUtils.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public static void addDefinitions(Swagger swagger, Type paramType) { Map<String, Model> models = ModelConverters.getInstance().readAll(paramType); for (Entry<String, Model> entry : models.entrySet()) { if (null != swagger.getDefinitions()) { Model tempModel = swagger.getDefinitions().get(entry.getKey()); if (null != tempModel && !tempModel.equals(entry.getValue())) { LOGGER.warn("duplicate param model: " + entry.getKey()); throw new IllegalArgumentException("duplicate param model: " + entry.getKey()); } } swagger.addDefinition(entry.getKey(), entry.getValue()); } }
Example #27
Source File: Reader.java From proteus with Apache License 2.0 | 5 votes |
private Map<String, Property> parseResponseHeaders(ResponseHeader[] headers) { Map<String, Property> responseHeaders = null; if (headers != null) { for (ResponseHeader header : headers) { String name = header.name(); if (!"".equals(name)) { if (responseHeaders == null) { responseHeaders = new LinkedHashMap<>(); } String description = header.description(); Class<?> cls = header.response(); if (!isVoid(cls)) { final Property property = ModelConverters.getInstance().readAsProperty(cls); if (property != null) { Property responseProperty = ContainerWrapper.wrapContainer(header.responseContainer(), property, ContainerWrapper.ARRAY, ContainerWrapper.LIST, ContainerWrapper.SET); responseProperty.setDescription(description); responseHeaders.put(name, responseProperty); appendModels(cls); } } } } } return responseHeaders; }
Example #28
Source File: DefaultResponseTypeProcessor.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Override public Model process(SwaggerGenerator swaggerGenerator, OperationGenerator operationGenerator, Type genericResponseType) { Type responseType = extractResponseType(swaggerGenerator, operationGenerator, genericResponseType); if (responseType == null || ReflectionUtils.isVoid(responseType)) { return null; } if (responseType instanceof Class && Part.class.isAssignableFrom((Class<?>) responseType)) { responseType = Part.class; } SwaggerUtils.addDefinitions(swaggerGenerator.getSwagger(), responseType); Property property = ModelConverters.getInstance().readAsProperty(responseType); return new PropertyModelConverter().propertyToModel(property); }
Example #29
Source File: DubboReaderExtension.java From swagger-dubbo with Apache License 2.0 | 4 votes |
private static void appendModels(Swagger swagger, Type type) { final Map<String, Model> models = ModelConverters.getInstance().readAll(type); for (Map.Entry<String, Model> entry : models.entrySet()) { swagger.model(entry.getKey(), entry.getValue()); } }
Example #30
Source File: WebAPI.java From Web-API with MIT License | 4 votes |
@Listener public void onPreInitialization(GamePreInitializationEvent event) { WebAPI.instance = this; Timings.STARTUP.startTiming(); Platform platform = Sponge.getPlatform(); spongeApi = platform.getContainer(Component.API).getVersion().orElse(null); spongeGame = platform.getContainer(Component.GAME).getVersion().orElse(null); spongeImpl = platform.getContainer(Component.IMPLEMENTATION).getVersion().orElse(null); pluginList = Sponge.getPluginManager().getPlugins().stream() .map(p -> p.getId() + ": " + p.getVersion().orElse(null)) .collect(Collectors.joining("; \n")); // Create our config directory if it doesn't exist if (!Files.exists(configPath)) { try { Files.createDirectories(configPath); } catch (IOException e) { e.printStackTrace(); } } // Reusable sync executor to run code on main server thread syncExecutor = Sponge.getScheduler().createSyncExecutor(this); asyncExecutor = Sponge.getScheduler().createAsyncExecutor(this); // Register custom serializers TypeSerializers.getDefaultSerializers().registerType( TypeToken.of(WebHook.class), new WebHookSerializer()); TypeSerializers.getDefaultSerializers().registerType( TypeToken.of(UserPermissionStruct.class), new UserPermissionStructSerializer()); TypeSerializers.getDefaultSerializers().registerType( TypeToken.of(PermissionStruct.class), new PermissionStructSerializer()); // Setup services this.blockService = new BlockService(); this.cacheService = new CacheService(); this.linkService = new LinkService(); this.messageService = new InteractiveMessageService(); this.securityService = new SecurityService(); this.serializeService = new SerializeService(); this.serverService = new ServerService(); this.servletService = new ServletService(); this.webHookService = new WebHookService(); this.userService = new UserService(); // Register services ServiceManager serviceMan = Sponge.getServiceManager(); serviceMan.setProvider(this, BlockService.class, blockService); serviceMan.setProvider(this, CacheService.class, cacheService); serviceMan.setProvider(this, LinkService.class, linkService); serviceMan.setProvider(this, InteractiveMessageService.class, messageService); serviceMan.setProvider(this, SecurityService.class, securityService); serviceMan.setProvider(this, SerializeService.class, serializeService); serviceMan.setProvider(this, ServerService.class, serverService); serviceMan.setProvider(this, ServletService.class, servletService); serviceMan.setProvider(this, WebHookService.class, webHookService); serviceMan.setProvider(this, UserService.class, userService); // Register events of services EventManager evenMan = Sponge.getEventManager(); evenMan.registerListeners(this, cacheService); evenMan.registerListeners(this, linkService); evenMan.registerListeners(this, webHookService); // Swagger setup stuff ModelConverters.getInstance().addConverter(new SwaggerModelConverter()); Timings.STARTUP.stopTiming(); }