I want to convert given Swagger 2.0 file to RAML.
I used swagger2raml provided in https://github.com/8x8Cloud/swagger2raml which is not converting it. I also checked RESTLET but i don't know which API's to use.
Can someone please help on this? I need a Java based solution.
you can get the Restlet Framework version 2.3.3, and use the following code. You will need:
the org.restlet.ext.apispark extension and its dependencies
import org.raml.emitter.RamlEmitter;
import org.raml.model.Raml;
import org.restlet.ext.apispark.internal.conversion.TranslationException;
import org.restlet.ext.apispark.internal.conversion.raml.RamlTranslator;
import org.restlet.ext.apispark.internal.conversion.swagger.v2_0.SwaggerUtils;
import org.restlet.ext.apispark.internal.model.Definition;
public class TestConversion {
public static void main(String[] args) throws TranslationException {
Definition definition = SwaggerUtils.getDefinition(
"/tmp/refImpl.swagger", null, null);
Raml raml = RamlTranslator.getRaml(definition);
RamlEmitter re = new RamlEmitter();
System.out.println(re.dump(raml));
}
}