Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 2.6.0 #104

Merged
merged 16 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,6 @@ gradle-app.setting

# End of https://www.toptal.com/developers/gitignore/api/gradle,intellij

.DS_Store
.DS_Store
.intellijPlatform
.kotlin
1 change: 1 addition & 0 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions .idea/kotlinScripting.xml

This file was deleted.

4 changes: 2 additions & 2 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 2.6.0+jre21
published to:
- [JetBrains marketplace](https://plugins.jetbrains.com/plugin/15673-asyncapi/edit/versions/stable/596939)
- [GitHub](https://github.com/asyncapi/jasyncapi-idea-plugin/releases/new?tag=2.6.0%2Bjre17)

### Added

- IDEA 2024.2
- Yaml single quoted references handling - '#/components/messages/welcomeMessage'
- `.yml` file recognition

## 2.5.0+jre17
published to:
- [JetBrains marketplace](https://plugins.jetbrains.com/plugin/15673-asyncapi/versions/stable/520779)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ cd jasyncapi-idea-plugin

NOTE: This will take a while the first time as it will have to download every single version of IntelliJ IDEA listed in the `runPluginVerifier` section of the `build.gradle.kts` file.
```sh
./gradlew :runPluginVerifier
./gradlew :verifyPlugin
```
... should have no errors
5. install plugin from disk - [JetBrains Instruction](https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk)
Expand Down
203 changes: 100 additions & 103 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.intellij.platform.gradle.tasks.VerifyPluginTask

plugins {
id("org.jetbrains.intellij") version "1.17.4"
id("org.jetbrains.intellij.platform") version "2.0.1"
java
kotlin("jvm") version "2.0.20"
}

group = "com.asyncapi.plugin.idea"
version = "2.5.0+jre17"
version = "2.6.0+jre17"

repositories {
mavenCentral()
intellijPlatform {
jetbrainsRuntime()
defaultRepositories()
}
}

dependencies {
intellijPlatform {
/*
Our developers believe that you likely built the plugin against version 2024.2, which includes
a companion object in this class. As a result, the generated bytecode references it. To ensure compatibility,
the plugin should be built against the lowest supported version, which in this case is 2022.3.

Please adjust the IntelliJ version to 2022.3 in the Gradle build script and try building the plugin again.
*/
intellijIdeaCommunity("2022.3", useInstaller = false) // MUST NOT be changed

// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
bundledPlugins(listOf(
"org.jetbrains.plugins.yaml"
))

pluginVerifier()
jetbrainsRuntime()
instrumentationTools()
testFramework(TestFrameworkType.Platform)
}

implementation("com.fasterxml.jackson.core:jackson-core:2.17.2")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.2")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.2")
Expand All @@ -21,110 +49,79 @@ dependencies {
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.11.0")
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version.set("2024.1")
plugins.set(listOf("yaml"))
}
tasks.getByName<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
sinceBuild.set("223")
untilBuild.set("241.*")
changeNotes.set("""
<h3>Added</h3>
<ul>
<li>IDEA 2024.1</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Incorrect validation of Multi Format Schema and bindings</li>
</ul>
<h3>Changed</h3>
<ul>
<li>2.0.0 schema validation and completion:<ul>
<li>Updated allowed extension name: <code>^x-[\w\d\-\_]+${'$'}</code> was changed to <code>^x-[\w\d\.\x2d_]+${'$'}</code></li>
<li>OpenAPI schema v3</li>
<li>Added <code>schemaFormat</code> to messages to recognize properly non AsyncAPI Schemas</li>
<li>Was updated <code>JsonSchema</code> Draft 07</li>
</ul>
</li>
<li>2.1.0 schema validation and completion:<ul>
<li>OpenAPI schema v3</li>
<li>Added <code>schemaFormat</code> to messages to recognize properly non AsyncAPI Schemas</li>
<li>Was updated <code>JsonSchema</code> Draft 07</li>
</ul>
</li>
<li>2.2.0 schema validation and completion:<ul>
<li>OpenAPI schema v3</li>
<li>Added <code>schemaFormat</code> to messages to recognize properly non AsyncAPI Schemas</li>
<li>Was updated <code>JsonSchema</code> Draft 07</li>
</ul>
</li>
<li>2.3.0 schema validation and completion:<ul>
<li>OpenAPI schema v3</li>
<li>Added <code>schemaFormat</code> to messages to recognize properly non AsyncAPI Schemas</li>
<li>Was updated <code>JsonSchema</code> Draft 07</li>
</ul>
</li>
<li>2.4.0 schema validation and completion:<ul>
<li>OpenAPI schema v3</li>
<li>Added <code>schemaFormat</code> to messages to recognize properly non AsyncAPI Schemas</li>
<li>Was updated <code>JsonSchema</code> Draft 07</li>
</ul>
</li>
<li>2.5.0 schema validation and completion:<ul>
<li>OpenAPI schema v3</li>
<li>Added <code>schemaFormat</code> to messages to recognize properly non AsyncAPI Schemas</li>
<li>Was updated <code>JsonSchema</code> Draft 07</li>
</ul>
</li>
<li>3.0.0 schema validation and completion:<ul>
<li>Bindings:<ul>
<li>Solace:<ul>
<li>server binding 0.4.0</li>
<li>operation binding 0.4.0</li>
</ul>
</li>
<li>HTTP:<ul>
<li>message binding 0.3.0</li>
<li>operation binding 0.3.0</li>
</ul>
</li>
</ul>
</li>
// See https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
intellijPlatform {
instrumentCode = true

pluginConfiguration {
description = providers.fileContents(
layout.projectDirectory.file("src/main/resources/META-INF/description.html")
).asText

changeNotes = """
<h3>Added</h3>
<ul>
<li>IDEA 2024.2</li>
<li>Yaml single quoted references handling - '#/components/messages/welcomeMessage', '../common/messages/welcomeMessage.yml'</li>
<li><code>.yml</code> file recognition</li>
</ul>
</li>
</ul>
""".trimIndent())
""".trimIndent()
}

pluginVerification {
failureLevel = listOf(
VerifyPluginTask.FailureLevel.INVALID_PLUGIN,
VerifyPluginTask.FailureLevel.COMPATIBILITY_PROBLEMS,
VerifyPluginTask.FailureLevel.NOT_DYNAMIC
)

ides {
ides(listOf(
"2022.3",
"2022.3.1",
"2022.3.2",
"2022.3.3",
"2023.1",
"2023.1.1",
"2023.1.2",
"2023.1.3",
"2023.1.4",
"2023.1.5",
"2023.2",
"2023.2.1",
"2023.2.2",
"2023.2.3",
"2023.2.4",
"2023.2.5",
"2023.3",
"2023.3.1",
"2023.3.2",
"2023.3.3",
"2023.3.4",
"2023.3.5",
"2023.3.6",
"2023.3.7",
"2024.1",
"2024.1.1",
"2024.1.2",
"2024.1.3",
"2024.1.4",
"2024.1.5",
"2024.1.6",
"2024.2",
"2024.2.0.1",
"2024.2.0.2",
"2024.2.1"
))
}
}
}

tasks.getByName<org.jetbrains.intellij.tasks.RunPluginVerifierTask>("runPluginVerifier") {
ideVersions.set(listOf(
"2022.3",
"2022.3.1",
"2022.3.2",
"2022.3.3",
"2023.1",
"2023.1.1",
"2023.1.2",
"2023.1.3",
"2023.1.4",
"2023.1.5",
"2023.2",
"2023.2.1",
"2023.2.2",
"2023.2.3",
"2023.2.4",
"2023.2.5",
"2023.3",
"2023.3.1",
"2023.3.2",
"2023.3.3",
"2023.3.4",
"2023.3.5",
"2023.3.6",
"2024.1"
))
verifierVersion.set("1.365")
tasks {
patchPluginXml {
sinceBuild = "223"
untilBuild = "242.*"
}
}

tasks {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class AsyncAPISpecificationHtmlRenderer {

private val urlProvider = service<UrlProvider>()
private val specificationTemplateUrl = "/ui/index.html"
private val specificationTemplateCssUrl = "default(1.2.9).min.css"
private val specificationTemplateJsUrl = "index(1.2.9).js"
private val specificationTemplateCssUrl = "default.min.css"
private val specificationTemplateJsUrl = "index.js"

fun render(request: FullHttpRequest, specificationUrl: String?): String {
specificationUrl ?: return "specification: not found."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ abstract class PsiFileXPath<AsyncAPISpecification: PsiFile> {
*/
fun compileXPath(specificationReference: String): String {
return specificationReference
.removePrefix("\"")
.removePrefix("\"") // double quoted "some text"
.removeSuffix("\"")
.removePrefix("\'") // single quoted 'some text'
.removeSuffix("\'")
.replace("#/", "")
.split("/")
.joinToString(".", "$.", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ object YamlFileXPath: PsiFileXPath<YAMLFile>() {

override fun findText(asyncAPISpecification: YAMLFile?, psiXPath: String, partialMatch: Boolean): List<String> {
return findPsi(asyncAPISpecification, psiXPath, partialMatch).map {
it.text.removePrefix("\"").removeSuffix("\"")
it.text
.removePrefix("\"") // double quoted "some text"
.removeSuffix("\"")
.removePrefix("\'") // single quoted 'some text'
.removeSuffix("\'")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,23 @@ class AsyncAPIFileReference(
}

private fun extractFileLocation(fileReference: String): String? {
return fileReference.removePrefix("\"").removeSuffix("\"").split("#/").firstOrNull()
return fileReference
.removePrefix("\"") // double quoted 'some text'
.removeSuffix("\"")
.removePrefix("\'") // single quoted 'some text'
.removeSuffix("\'")
.split("#/")
.firstOrNull()
}

private fun extractLocalReference(fileReference: String): String? {
return fileReference.removePrefix("\"").removeSuffix("\"").split("#/").getOrNull(1)
return fileReference
.removePrefix("\"") // double quoted 'some text'
.removeSuffix("\"")
.removePrefix("\'") // single quoted 'some text'
.removeSuffix("\'")
.split("#/")
.getOrNull(1)
}

private fun findFile(fileLocation: String): PsiFile? {
Expand Down
Loading
Loading