From 66932cd42bbbf86a13ecfc47a0986ecd897535eb Mon Sep 17 00:00:00 2001 From: nlam-atlassian Date: Mon, 21 Oct 2024 13:34:08 +1100 Subject: [PATCH] Incorrectly removed `hasDefault` previously (#45) When bumping to the lastest `prosemirror-model`, I incorrectly removed `AttributesSpec.hasDefault` but we need this because of the differences of how TS vs Kotlin works. Also made a tweak to the release process, so that the name of the release is the version number. --- .github/workflows/publish.yml | 2 +- model/config/ktlint/baseline.xml | 122 +++++++++--------- .../com/atlassian/prosemirror/model/Schema.kt | 3 +- .../prosemirror/testbuilder/AdfSchema.kt | 4 +- version.properties | 2 +- 5 files changed, 68 insertions(+), 65 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dadeb54..7008ef4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -52,7 +52,7 @@ jobs: uses: actions/create-release@v1 id: create_release with: - release_name: ${{ steps.version.outputs.version }} + release_name: ${{ steps.read-properties.outputs.projectVersion }} tag_name: ${{ steps.read-properties.outputs.projectVersion }} body: "Release ${{ steps.read-properties.outputs.projectVersion }}" env: diff --git a/model/config/ktlint/baseline.xml b/model/config/ktlint/baseline.xml index f177809..21a9070 100644 --- a/model/config/ktlint/baseline.xml +++ b/model/config/ktlint/baseline.xml @@ -465,7 +465,7 @@ - + @@ -475,66 +475,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt index 20ded3e..190d825 100644 --- a/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt +++ b/model/src/commonMain/kotlin/com/atlassian/prosemirror/model/Schema.kt @@ -370,7 +370,7 @@ class Attribute( get() = !this.hasDefault init { - this.hasDefault = options.default != null //Object.prototype.hasOwnProperty.call(options, "default") + this.hasDefault = options.hasDefault //Object.prototype.hasOwnProperty.call(options, "default") this.default = options.default this.validate = options.validateString?.let { validateType(typeName, attrName, it) } @@ -638,6 +638,7 @@ interface AttributeSpec { // that have no default must be provided whenever a node or mark of a type that has them is // created. val default: Any? + val hasDefault: Boolean // A function or type name used to validate values of this // attribute. This will be used when deserializing the attribute // from JSON, and when running [`Node.check`](#model.Node.check). diff --git a/test-builder/src/commonMain/kotlin/com/atlassian/prosemirror/testbuilder/AdfSchema.kt b/test-builder/src/commonMain/kotlin/com/atlassian/prosemirror/testbuilder/AdfSchema.kt index f49bd39..d5a760d 100644 --- a/test-builder/src/commonMain/kotlin/com/atlassian/prosemirror/testbuilder/AdfSchema.kt +++ b/test-builder/src/commonMain/kotlin/com/atlassian/prosemirror/testbuilder/AdfSchema.kt @@ -45,8 +45,10 @@ data class MarkSpecImpl( data class AttributeSpecImpl( override val default: Any?, + override val hasDefault: Boolean, override val validateString: String? = null, override val validateFunction: ((value: Any?) -> Unit)? = null ) : AttributeSpec { - constructor() : this(null) + constructor(default: Any?, validateString: String? = null) : this(default, true, validateString) + constructor() : this(null, false) } diff --git a/version.properties b/version.properties index 37f9215..90c1ae3 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -projectVersion=1.1.2 +projectVersion=1.1.3