Search in sources :

Example 1 with Operation

use of io.swagger.models.apideclaration.Operation in project swagger-parser by swagger-api.

the class ApiDeclarationParser method readApis.

List<Api> readApis(List<Map<String, Object>> om, MessageBuilder messages) {
    List<Api> output = new ArrayList<Api>();
    for (Map<String, Object> o : om) {
        Api op = new Api();
        String path = readString(o.get("path"));
        if (path != null) {
            op.setPath(path);
        } else {
            messages.append(new Message("ApiDeclaration.apis", "path is missing", Severity.ERROR));
        }
        Object operations = o.get("operations");
        if (operations instanceof List) {
            List<Operation> ops = readOperations((List<Map<String, Object>>) operations, messages);
            op.setOperations(ops);
        }
        output.add(op);
    }
    return output;
}
Also used : Message(io.swagger.report.Message) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Api(io.swagger.models.apideclaration.Api) Operation(io.swagger.models.apideclaration.Operation) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Api (io.swagger.models.apideclaration.Api)1 Operation (io.swagger.models.apideclaration.Operation)1 Message (io.swagger.report.Message)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1