Search in sources :

Example 1 with OpenAPIFile

use of com.devonfw.cobigen.openapiplugin.model.OpenAPIFile in project cobigen by devonfw.

the class OpenAPIInputReader method getInputObjects.

@Override
public List<Object> getInputObjects(Object input, Charset inputCharset) {
    List<Object> inputs = new LinkedList<>();
    List<Path> paths = new LinkedList<>();
    if (input instanceof OpenAPIFile) {
        OpenApi3 astOpenApi = ((OpenAPIFile) input).getAST();
        inputs.addAll(extractComponents(astOpenApi));
        for (String key : astOpenApi.getPaths().keySet()) {
            Path path = astOpenApi.getPaths().get(key);
            paths.add(path);
        }
        inputs.addAll(extractComponentsFromPaths(paths, astOpenApi));
        List<EntityDef> entityDefs = new ArrayList<>();
        for (Object obj : inputs) {
            if (obj instanceof EntityDef) {
                entityDefs.add((EntityDef) obj);
            }
        }
        for (EntityDef entityDef : entityDefs) {
            entityDef.setAllEntityDefs(entityDefs);
        }
    }
    return inputs;
}
Also used : Path(com.reprezen.kaizen.oasparser.model3.Path) OpenAPIFile(com.devonfw.cobigen.openapiplugin.model.OpenAPIFile) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) OpenApi3(com.reprezen.kaizen.oasparser.model3.OpenApi3) EntityDef(com.devonfw.cobigen.openapiplugin.model.EntityDef)

Aggregations

EntityDef (com.devonfw.cobigen.openapiplugin.model.EntityDef)1 OpenAPIFile (com.devonfw.cobigen.openapiplugin.model.OpenAPIFile)1 OpenApi3 (com.reprezen.kaizen.oasparser.model3.OpenApi3)1 Path (com.reprezen.kaizen.oasparser.model3.Path)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1