use of org.zalando.intellij.swagger.traversal.path.PathFinder in project intellij-swagger by zalando.
the class ComponentRefValueCompletion method getSchemaKeys.
private List<Value> getSchemaKeys() {
final PsiFile psiFile = completionHelper.getPsiFile();
final String pathExpression = String.format("$.components.%s", refType);
return new PathFinder().findChildrenByPathFrom(pathExpression, psiFile).stream().map(e -> String.format("#/components/%s/%s", refType, e.getName())).map(StringValue::new).collect(Collectors.toList());
}
use of org.zalando.intellij.swagger.traversal.path.PathFinder in project intellij-swagger by zalando.
the class RootSecurityCompletion method getSecurityDefinitions.
private List<ArrayField> getSecurityDefinitions() {
final PsiFile containingFile = completionHelper.getPsiFile().getContainingFile();
final List<? extends PsiNamedElement> securityDefinitions = new PathFinder().findChildrenByPathFrom("$.securityDefinitions", containingFile);
return securityDefinitions.stream().map(PsiNamedElement::getName).map(ArrayField::new).collect(Collectors.toList());
}
use of org.zalando.intellij.swagger.traversal.path.PathFinder in project intellij-swagger by zalando.
the class LocalRefValueCompletion method getDefinitionKeys.
private List<Value> getDefinitionKeys() {
final PsiFile psiFile = completionHelper.getPsiFile();
final String pathExpression = String.format("$.%s", refType);
return new PathFinder().findChildrenByPathFrom(pathExpression, psiFile).stream().map(e -> String.format("#/%s/%s", refType, e.getName())).map(StringValue::new).collect(Collectors.toList());
}
use of org.zalando.intellij.swagger.traversal.path.PathFinder in project intellij-swagger by zalando.
the class OperationSecurityCompletion method getSecurityDefinitions.
private List<ArrayField> getSecurityDefinitions() {
final PsiFile containingFile = completionHelper.getPsiFile().getContainingFile();
final List<? extends PsiNamedElement> securityDefinitions = new PathFinder().findChildrenByPathFrom("$.securityDefinitions", containingFile);
return securityDefinitions.stream().map(PsiNamedElement::getName).map(ArrayField::new).collect(Collectors.toList());
}
use of org.zalando.intellij.swagger.traversal.path.PathFinder in project intellij-swagger by zalando.
the class DefinitionsInRootReference method resolve.
@Nullable
@Override
public PsiElement resolve() {
final PsiFile referencedFile = getReferencedFile();
if (referencedFile == null) {
return null;
}
String referencedValue = ReferenceValueExtractor.extractValue(originalRefValue);
referencedValue = referencedValue.replace(".", "\\.");
final String pathExpression = String.format("$.%s", referencedValue);
return new PathFinder().findByPathFrom(pathExpression, referencedFile).orElse(null);
}
Aggregations