Skip to content

Commit

Permalink
refactor: rename AsyncAPISchemaIndexer to AsyncAPISpecificationIndexer
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakisan committed Dec 10, 2023
1 parent c5cd3c2 commit 7c9625e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AsyncAPISpecificationIndex: FileBasedIndexExtension<String, Set<String>>()

override fun getName(): ID<String, Set<String>> = asyncapiIndexId

override fun getIndexer(): DataIndexer<String, Set<String>, FileContent> = AsyncAPISchemaIndexer()
override fun getIndexer(): DataIndexer<String, Set<String>, FileContent> = AsyncAPISpecificationIndexer()

override fun getKeyDescriptor(): KeyDescriptor<String> = EnumeratorStringDescriptor.INSTANCE

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.jetbrains.yaml.psi.YAMLFile
/**
* @author Pavel Bodiachevskii
*/
class AsyncAPISchemaIndexer: DataIndexer<String, Set<String>, FileContent> {
class AsyncAPISpecificationIndexer: DataIndexer<String, Set<String>, FileContent> {

private val asyncAPISpecificationRecognizer = service<AsyncAPISpecificationRecognizer>()

Expand All @@ -21,16 +21,16 @@ class AsyncAPISchemaIndexer: DataIndexer<String, Set<String>, FileContent> {
return index
}

val asyncapiSchema = when(inputData.psiFile) {
val asyncapiSpecification = when(inputData.psiFile) {
is JsonFile -> inputData.psiFile as JsonFile
is YAMLFile -> inputData.psiFile as YAMLFile
else -> null
}
asyncapiSchema ?: return index
asyncapiSpecification ?: return index

index[AsyncAPISpecificationIndex.asyncapi] = setOf(inputData.file.path)
var foundReferences = emptySet<String>()
AsyncAPISpecificationReferencesCollector(asyncapiSchema, inputData.file.parent).collectFiles().forEach { (referenceType, references) ->
AsyncAPISpecificationReferencesCollector(asyncapiSpecification, inputData.file.parent).collectFiles().forEach { (referenceType, references) ->
index[referenceType] = references

foundReferences = foundReferences.plus(references)
Expand Down

0 comments on commit 7c9625e

Please sign in to comment.