in oas-validator/oas-validator-style/src/main/java/org/apache/servicecomb/toolkit/oasv/style/validator/tag/TagMustBeReferencedValidator.java [66:95]
private Set<String> getAllOperationsTags(OasValidationContext context) {
Set<String> allTags = context.getAttribute(CACHE_KEY);
if (allTags != null) {
return allTags;
}
allTags = new HashSet<>();
OpenAPI openAPI = context.getOpenAPI();
Paths paths = openAPI.getPaths();
if (paths == null) {
return emptySet();
}
for (Map.Entry<String, PathItem> entry : paths.entrySet()) {
PathItem pathItem = entry.getValue();
List<Operation> operations = pathItem.readOperations();
for (Operation operation : operations) {
List<String> tags = operation.getTags();
if (CollectionUtils.isEmpty(tags)) {
continue;
}
allTags.addAll(tags);
}
}
context.setAttribute(CACHE_KEY, allTags);
return allTags;
}