use of com.github.javaparser.utils.SourceRoot in project flow by vaadin.
the class OpenAPIObjectGenerator method init.
private void init() {
if (javaSourcePaths == null || configuration == null) {
throw new IllegalStateException("Java source path and configuration should not be null");
}
openApiModel = createBasicModel();
nonEndpointMap = new HashMap<>();
endpointExposedMap = new HashMap<>();
qualifiedNameToPath = new HashMap<>();
pathItems = new TreeMap<>();
usedTypes = new HashMap<>();
generatedSchema = new HashSet<>();
endpointsJavadoc = new HashMap<>();
schemaGenerator = new SchemaGenerator(this);
needsDeferrableImport = false;
ParserConfiguration parserConfiguration = createParserConfiguration();
javaSourcePaths.stream().map(path -> new SourceRoot(path, parserConfiguration)).forEach(sourceRoot -> parseSourceRoot(sourceRoot, this::findEndpointExposed));
javaSourcePaths.stream().map(path -> new SourceRoot(path, parserConfiguration)).forEach(sourceRoot -> parseSourceRoot(sourceRoot, this::process));
for (Map.Entry<String, GeneratorType> entry : new ArrayList<>(usedTypes.entrySet())) {
List<Schema> schemas = createSchemasFromQualifiedNameAndType(entry.getKey(), entry.getValue());
schemas.forEach(schema -> {
if (qualifiedNameToPath.get(schema.getName()) != null) {
schema.addExtension(EXTENSION_VAADIN_FILE_PATH, qualifiedNameToPath.get(schema.getName()));
}
openApiModel.getComponents().addSchemas(schema.getName(), schema);
});
}
addTagsInformation();
}
Aggregations