Search in sources :

Example 41 with Info

use of io.swagger.models.Info in project syndesis by syndesisio.

the class BaseSwaggerConnectorGenerator method determineConnectorName.

@Override
protected final String determineConnectorName(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
    final SwaggerModelInfo modelInfo = parseSpecification(connectorSettings, false);
    if (!modelInfo.getErrors().isEmpty()) {
        throw new IllegalArgumentException("Given Swagger specification contains errors: " + modelInfo);
    }
    final Swagger swagger = modelInfo.getModel();
    final Info info = swagger.getInfo();
    if (info == null) {
        return super.determineConnectorName(connectorTemplate, connectorSettings);
    }
    final String title = info.getTitle();
    if (title == null) {
        return super.determineConnectorName(connectorTemplate, connectorSettings);
    }
    return title;
}
Also used : Swagger(io.swagger.models.Swagger) Info(io.swagger.models.Info)

Example 42 with Info

use of io.swagger.models.Info in project java-chassis by ServiceComb.

the class SwaggerUtils method getInterface.

public static Class<?> getInterface(Swagger swagger) {
    Info info = swagger.getInfo();
    if (info == null) {
        return null;
    }
    String name = getInterfaceName(info.getVendorExtensions());
    if (StringUtils.isEmpty(name)) {
        return null;
    }
    return ReflectUtils.getClassByName(name);
}
Also used : Info(io.swagger.models.Info)

Example 43 with Info

use of io.swagger.models.Info in project java-chassis by ServiceComb.

the class AbstractSwaggerGenerator method correctInfo.

private void correctInfo() {
    Info info = swagger.getInfo();
    if (info == null) {
        info = new Info();
        swagger.setInfo(info);
    }
    if (StringUtils.isEmpty(info.getTitle())) {
        info.setTitle("swagger definition for " + cls.getName());
    }
    if (StringUtils.isEmpty(info.getVersion())) {
        info.setVersion("1.0.0");
    }
    setJavaInterface(info);
}
Also used : Info(io.swagger.models.Info)

Example 44 with Info

use of io.swagger.models.Info in project nutzboot by nutzam.

the class SwaggerServletStarter method init.

public void init(ServletConfig config) throws ServletException {
    PropertiesProxy conf = appContext.getConfigureLoader().get();
    swagger = conf.makeDeep(Swagger.class, "swagger.conf.");
    Info info = conf.makeDeep(Info.class, "swagger.info.");
    swagger.setInfo(info);
    HashSet<Class<?>> classes = new HashSet<>();
    String pkgName = conf.get("swagger.resource.package", appContext.getPackage());
    for (Class<?> klass : Scans.me().scanPackage(pkgName)) {
        classes.add(klass);
    }
    Reader.read(swagger, classes);
}
Also used : PropertiesProxy(org.nutz.ioc.impl.PropertiesProxy) Swagger(io.swagger.models.Swagger) Info(io.swagger.models.Info) HashSet(java.util.HashSet)

Aggregations

Info (io.swagger.models.Info)44 Swagger (io.swagger.models.Swagger)31 Contact (io.swagger.models.Contact)14 Operation (io.swagger.models.Operation)11 Path (io.swagger.models.Path)10 License (io.swagger.models.License)8 QueryParameter (io.swagger.models.parameters.QueryParameter)8 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)8 Test (org.testng.annotations.Test)8 ApiKeyAuthDefinition (io.swagger.models.auth.ApiKeyAuthDefinition)5 BodyParameter (io.swagger.models.parameters.BodyParameter)5 PathParameter (io.swagger.models.parameters.PathParameter)5 Model (io.swagger.models.Model)4 RefModel (io.swagger.models.RefModel)4 Response (io.swagger.models.Response)4 OAuth2Definition (io.swagger.models.auth.OAuth2Definition)4 Parameter (io.swagger.models.parameters.Parameter)4 RefProperty (io.swagger.models.properties.RefProperty)4 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)4