io.swagger.converter.ModelConverterContextImpl Java Examples
The following examples show how to use
io.swagger.converter.ModelConverterContextImpl.
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: TestGenerate.java From sofa-rpc with Apache License 2.0 | 5 votes |
private void doTestGenerateModel() throws NoSuchMethodException { Method someMethod = TestGenerate.class.getMethod("someMethod", SomeParameter.class); Type type = someMethod.getGenericParameterTypes()[0]; ModelResolver converter = new ModelResolver(Json.mapper()); ModelConverterContextImpl context = new ModelConverterContextImpl(converter); Property property = context.resolveProperty(type, null); Assert.assertTrue(property instanceof RefProperty); Assert.assertEquals("#/definitions/SomeParameter", ((RefProperty) property).get$ref()); }
Example #2
Source File: ModelConverters.java From netty-rest with Apache License 2.0 | 5 votes |
public Map<String, Model> read(Type type) { Map<String, Model> modelMap = new HashMap<>(); if (shouldProcess(type)) { ModelConverterContextImpl context = new ModelConverterContextImpl( converters); Model resolve = context.resolve(type); context.getDefinedModels() .entrySet().stream().filter(entry -> entry.getValue().equals(resolve)) .forEach(entry -> modelMap.put(entry.getKey(), entry.getValue())); } return modelMap; }
Example #3
Source File: ModelConverters.java From netty-rest with Apache License 2.0 | 5 votes |
public Map<String, Model> readAll(Type type) { if (shouldProcess(type)) { ModelConverterContextImpl context = new ModelConverterContextImpl( converters); LOGGER.debug("ModelConverters readAll from " + type); context.resolve(type); return context.getDefinedModels(); } return new HashMap<>(); }
Example #4
Source File: ModelConverters.java From netty-rest with Apache License 2.0 | 4 votes |
public Property readAsProperty(Type type) { ModelConverterContextImpl context = new ModelConverterContextImpl( converters); return context.resolveProperty(type, null); }