use of org.zalando.intellij.swagger.traversal.path.PathFinder in project intellij-swagger by zalando.
the class SecurityScopeNameValueCompletion method getSecurityDefinitionByName.
private List<Value> getSecurityDefinitionByName(final String securityDefinitionName) {
final PsiFile containingFile = completionHelper.getPsiFile().getContainingFile();
final List<? extends PsiNamedElement> securityDefinitions = new PathFinder().findChildrenByPathFrom("$.securityDefinitions", containingFile);
return securityDefinitions.stream().filter(e -> securityDefinitionName.equals(completionHelper.getKeyNameOfObject(e).orElse(null))).map(completionHelper::getSecurityScopesIfOAuth2).flatMap(Collection::stream).map(StringValue::new).collect(Collectors.toList());
}
Aggregations