Skip to content

Changelog

0.31.6 (Nov 6, 2025)

Scaffolder

  • Don’t overwrite previously scaffolded ZIP files when scaffolding again.

0.31.5 (Oct 30, 2025)

Core

  • Update Kotlin version to 2.2.21.

React

  • The subscribe function of controllers now allows listeners to return cleanup functions.
  • Reworked beforeunload logic (browser confirmation when leaving a page with a “dirty” form) as per MDN recommendations: to minimise the effect on performance, the beforeunload listener should only exist while the form is “dirty”. The previous behaviour might cause issues in Safari (according to a reported bug in a different project).

0.31.4 (Oct 23, 2025)

Scaffolder

  • change-case has become a peer dependency, since it’s expected that it will be used directly by consumers.
  • Improve generation of TypeScript import declarations by preferring import type { … } syntax to import { type … } when all named imports of a module are type imports since the prior doesn’t result in runtime imports being generated.

0.31.3 (Oct 21, 2025)

JS Bindings

  • Correctly publish the package’s license.

React

  • Correctly publish the package’s license.

Scaffolder

  • Fix binary name.
  • Correctly publish the package’s license.

0.31.2 (Oct 16, 2025)

Scaffolder

  • Ensure package is actually side-effect free by not importing CSS styles by default.

0.31.1 (Oct 16, 2025)

JS Bindings

  • Mark package as side-effect free.

React

  • Export package as ESM only, since the core package was already ESM only anyway, making the CJS version unusable.
  • Mark package as side-effect free.

Scaffolder

  • Export package as ESM only, for simplicity sake.
  • Mark package as side-effect free.

0.31.0 (Oct 9, 2025)

All

All packages are now under the “ostack” umbrella and, as such, have been renamed as follows:

Maven Central packages:

  • io.kform:kform-core -> tech.ostack:kform (all imports of the form io.kform.* are now tech.ostack.kform.*)
  • io.kform:kform-js-bindings -> tech.ostack:kform-js-bindings

npm.js packages:

  • @kform/core -> @ostack.tech/kform
  • @kform/react -> @ostack.tech/kform-react
  • @kform/scaffolder -> @ostack.tech/kform-scaffolder

Core

  • Update kt-math version to 0.10.2.

0.30.0 (Sep 17, 2025)

Core

  • Update Kotlin version to 2.2.20.
  • Update kotlinx.datetime version to 0.7.1.
  • Update kotlin-logging version to 7.0.13.

JS Bindings

  • Longs are now exported as bigints to JavaScript, due to the Kotlin version update.

React

  • Support React 19 (currently both 18 and 19 are supported, i.e. no features exclusive to 19 are being used).
  • Add an optional peer dependency to @types/react.
  • Dependency updates.

Scaffolder

  • Use React 19.
  • Add an optional peer dependency to @types/react.

0.29.1 (Jul 16, 2025)

React

  • Fix AtPathError error message (path was missing a closing ').

Scaffolder

  • Add support for configurations:
    • Add configs for specifying where to use the File.Base64Serializer and/or Table.ValuesSerializer.
  • Style tweaks/improvements.

0.29.0 (Jul 10, 2025)

Core

  • Rename ExceptionAtPath exception to AtPathException since exceptions should end in Exception as per Java naming conventions; further allow the exception to receive an optional cause.
  • Rename ValidationExceptionError/LocatedValidationExceptionError issue classes to ValidationFailure/LocatedValidationFailure respectively.
    • Change data of these issues to contain the validation name of the validation that failed, exception name/message and stackTrace of the exception that caused the validation to fail.
    • validation/exception/stackTrace can now be accessed directly as properties of the issues.
    • The code of such issues is now always a stable "validationFailed" rather than the name of the exception.
    • toString has been improved to show the name of the validation and the whole exception message.
  • When validating a form via form utilities or via a FormValidator with validate/validateExternally/isValid, we no longer wrap validation failures in ValidationExceptionError/LocatedValidationExceptionError issues. Instead, exceptions thrown while running validations are “wrapped” in a ValidationFailureException and rethrown, causing these functions/methods to possibly fail where they didn’t before.
    • The original thrown exception can be accessed as the cause of the thrown ValidationFailureException.
    • The FormManager behaviour hasn’t changed, and validation failures still result in special error issues (now ValidationFailure instances) wrapping the thrown exception.
    • These changes were made because validating via form utilities or FormValidator is typically done server-side, were it makes more sense for a validation failure to result in a 500 error being sent to the client than a 400 indicating that something is wrong with user data.

JS Bindings

  • Change bindings appropriately, in respect to the above-mentioned changes.

React

  • Rename PathError to AtPathError, the JS counterpart to AtPathException.
  • Introduce InvalidPathError (as a counterpart to InvalidPathException) and throw it from hooks which were previously throwing PathErrors.

0.28.2 (Jul 8, 2025)

Scaffolder

  • Remove unnecessary encodeToString/decodeFromString imports in scaffolded serializer.
  • Fix incorrect type signature for propertyAnnotations.

0.28.1 (Jul 2, 2025)

Scaffolder

  • Scaffold File properties with the serializer set to File.Base64Serializer.

0.28.0 (Jul 2, 2025)

Core

  • Due to updating the Kotlin and kotlinx.datetime versions, Instant has been removed from kotlinx.datetime and is now part of the standard Kotlin library. The InstantSchema was updated to reflect this. For users: imports to kotlinx.datetime.Instant now become imports to kotlin.time.Instant and currently require opting in.
  • Fix typo in emptyPlaceholderFile function name (was emplyPlaceholderFile).

Scaffolder

  • Tweak the generated serialization code to support pretty printing and rename variable names to be format agnostic.
  • Add support for annotating scaffolded class properties.
    • Annotate scaffolded Instant properties with OptIn(ExperimentalTime::class).

Dependencies

  • Update Kotlin version to 2.2.0.
  • Update kotlinx.datetime version to 0.7.0.
  • Update kotlinx.serialization version to 1.9.0.
  • Update other dependencies to latest versions.

0.27.5 (May 8, 2025)

React

  • Fix issue where the state of a controller was not immediately synchronised with the input passed to the useController hook.

0.27.4 (Apr 30, 2025)

Dependencies

  • Update Kotlin version to 2.1.20.
  • Update other dependencies to latest versions.

0.27.3 (Apr 16, 2025)

React

  • Support string schemas in the useNumericInput hook and numeric utilities.

    This is useful in order to treat “numeric strings” the same way we treat other numeric values.

0.27.2 (Mar 25, 2025)

Scaffolder

  • Force use of latest http-server version when launching the scaffolder.

0.27.1 (Mar 25, 2025)

Scaffolder

  • npx @kform/scaffolder@latest now, by default, opens a browser window with the scaffolder.

0.27.0 (Mar 25, 2025)

Scaffolder

  • This release introduces @kform/scaffolder, a library which can be used to scaffold new KForm forms.
    • Use it as a library to build a (more complete) scaffolder;
    • Or try it as-is by running: npx @kform/scaffolder@latest.

0.26.2 (Jan 23, 2025)

Core

  • Fix computed value not being recomputed when directly setting its value via the form manager. This behaviour may become adjustable in the future.

0.26.1 (Jan 16, 2025)

Core

  • Fix publication issue with the kotlin-reflect dependency.

0.26.0 (Jan 8, 2025)

Core

  • Introduce computed schemas and values:

    • A computed schema is a schema representing a computed value of a certain type: a form value that should equal the result of evaluating a given computation over other values of the form.

      A common example of a computed value would be a field whose value should equal the sum of other form values.

      Example usage:

      data class ItemPurchase(
          val price: Double?,
          val amount: Int?,
          val tax: Float?,
          val total: Double
      )
      
      object Total : ComputedValue<Double> {
          private val ComputedValueContext.price: Double? by dependency("../price")
          private val ComputedValueContext.amount: Int? by dependency("../amount")
          private val ComputedValueContext.tax: Float? by dependency("../tax")
          override suspend fun ComputedValueContext.compute(): Double {
              val totalPrice = (price ?: 0.0) * (amount ?: 0)
              return totalPrice + totalPrice * (tax ?: 0f)
          }
      }
      
      val itemPurchaseSchema = ClassSchema {
          ItemPurchase::price { NullableSchema { DoubleSchema() } }
          ItemPurchase::amount { NullableSchema { IntSchema() } }
          ItemPurchase::tax { NullableSchema { FloatSchema() } }
          ItemPurchase::total { ComputedSchema(Total) { DoubleSchema() } }
      }
      

      Computed schemas automatically include a validation which checks that the form value equals the result of evaluating its computed value.

  • Introduce a SumOf computed value for the common case of computing the sum of all values within a table column:

    ComputedSchema(SumOf("../table", Row::column)) {
        LongSchema()
    }
    
  • Support specifying the initial value of the form manager via an optional constructor argument.

0.25.5 (Dec 16, 2024)

JS Bindings

  • Tweak more exported types with bogus __doNotUseOrImplementIt properties so that they are compatible with type definitions generated by the Kotlin compiler.

0.25.4 (Dec 3, 2024)

JS Bindings

  • Tweak BigInteger/BigDecimal TypeScript definitions to make them compatible with those generated by the Kotlin compiler.
  • Remove unneeded big decimal utility function.

0.25.3 (Dec 2, 2024)

Core

  • Add missing comparable restrictions to big integer/decimal schemas.
  • Tweak schema conversions from other numeric types to big integer/decimal to prevent precision loss.

JS Bindings

  • Fix comparable-bounds validation wrappers to support big integers/decimals.

React

  • Tweak big decimal parsing to prevent precision loss.

0.25.2 (Dec 2, 2024)

React

  • Dependencies (from-exponential/zustand) are no longer incorrectly bundled.
  • Fix issues with our usage of zustand selectors since the update to v5.

0.25.0 (Nov 28, 2024)

Core

  • Provide support for big integers and big decimals via the kt-math library:

    • Introduce two new schemas: BigIntegerSchema and BigDecimalSchema.
    • Use the newly added Scale validation to ensure that BigDecimals have a specific scale. Example usage:

      BigDecimalSchema(Scale(2))
      
    • Provide BigIntegerSerializer and BigDecimalSerializer serializers to serialize BigIntegers and BigDecimals respectively.

    • Provide io.kform.datatypes.BigInteger and io.kform.datatypes.BigDecimal typealiases to org.gciatto.kt.math.BigInteger and org.gciatto.kt.math.BigDecimal respectively, with the above serializers already applied.

JS Bindings

  • Expose bigIntegerSchema and bigDecimalSchema functions to create the aforementioned schemas from JavaScript, as well as the scale validation function.
  • Expose some (mostly internal) utility functions to deal with big integers/decimals.

React

  • Add big integer/big decimal support to the useNumericInput hook.

Dependencies

  • Update Kotlin version to 2.1.0.
  • Update Zustand version to 5.

0.24.7 (Nov 1, 2024)

React

  • Make sure that the result of the issues tracker is immutable.

0.24.6 (Oct 31, 2024)

React

  • Improve issues tracker performance.

0.24.5 (Oct 29, 2024)

Core

  • Retry fix for issue with subscriptions occurring during initialisation/destruction of a form manager.

0.24.4 (Oct 29, 2024)

Core

  • Fix issue with subscriptions occurring during initialisation/destruction of a form manager.

0.24.3 (Oct 24, 2024)

Core

  • The UniqueItemsBy and UniqueItems validations now also report the ids of repeated rows when running on tables: this is done via data properties firstRowId and secondRowId.
  • Introduce Schema<*>.comparePaths function to compare two paths by the order in which fields were defined in the schema.

JS Bindings

  • Expose Schema<*>.comparePaths as compareSchemaPaths.

React

  • Issues tracked by useIssuesTracker are now, by default, sorted via compareSchemaPaths.
    • A new option issuesOrderCompareFn was introduced to make it possible to change/tweak the default ordering.

0.24.2 (Oct 16, 2024)

JS Bindings

  • Adjust type of PromiseCancellationException to include the constructor.

0.24.1 (Oct 16, 2024)

React

  • Rework form submission:
    • Rename previous onFailedSubmit to onInvalidSubmit as the function responsible for handling the case where a form submission fails due to it being invalid.
    • onFailedSubmit still exists, but now handles the case where the submission failed due to other errors (e.g., connectivity problems).
    • Automatically set the form as pristine after a successful submission, unless setPristineOnSuccessfulSubmit is set to false.
    • Add onSuccessfulSubmit, which runs after the form has been successfully submitted and set as pristine (this ensures that the “form unload” confirmation message isn’t triggered in the case where a redirection is intended after submission).
  • Fix the Form component which had some issues introduced in the previously released version.

0.23.2 (Oct 15, 2024)

React

  • Support returning external issues within onSubmit, which are automatically added to the form manager via addExternalIssues.
  • Fix issues in the type signature of the onSubmit/onFailedSubmit functions.

0.23.1 (Oct 2, 2024)

Core

  • Fix bug causing certain validations to not be invalidated on value changes.

Dependencies

  • Update to latest dependencies.

0.23.0 (Sep 12, 2024)

Core

  • Schema events are now only emitted after changes to the underlying data have actually been performed.

    Previously, events such as ValueEvent.Change were being emitted just before properties were reassigned, which proved troublesome in a few scenarios. - This introduces some breaking changes to Schema methods which were hopefully not being implemented externally anywhere.

  • Rename test utility classes for use from Java: ValidationIssueAsserts and LocatedValidationIssueAsserts both become TestUtils:

    • ValidationIssueAsserts.assertMatchingIssues becomes TestUtils.assertMatchingIssues;
    • LocatedValidationIssueAsserts.assertMatchingIssues becomes TestUtils.assertMatchingLocatedIssues;
    • Other methods received similar renames.
  • Introduce assertion utilities to check that a collection of issues does not contain a given issue, e.g. assertNotContainsIssue.

    • Projects using assertFails together with assertContainsIssue(s) should migrate to using assertNotContainsIssue(s), since the former may accidentally swallow other errors.
  • Split the form utility function validate into validate and validateExternally (similarly isValid and isValidExternally).

    • validate now only runs internal schema validations, while validateExternally can be used to run external validations.
  • The FormValidator’s validate and isValid methods now receive an optional runCriteria argument to specify when to run internal and/or external validations.

    • The default criteria is still the same as before: external validations run after internal ones iff no errors were found when running the internal validations.
    • Other criteria are especially useful for testing purposes.
  • Async wrappers for using KForm from Java were simplified to use GlobalScope by default.

    • AsyncFormValidator now optionally receives a coroutine scope rather than a coroutine context as constructor argument.

JS Bindings

  • Bindings were updated according to core changes: validate and isValid were updated; validateExternally and isValidExternally were introduced.

React

  • Improve performance by using Zustand internally to manage state.

    When using controllers, rerenders now only happen when users explicitly subscribe to controller state changes via newly provided hooks. Furthermore, these rerenders only occur for the components which actually subscribe to said changes.

    This is an improvement over the previous behaviour where, for example, when using the useForm hook, any change performed on the form would most likely cause a rerender of the whole form, due to state changes within the FormController (the form’s “validating” state would likely change).

    Unfortunately, to support these performance improvements, the hooks API had to break substantially.

    These changes are hopefully mostly relevant to component libraries and should not break most existing user code. However, code like the following will stop working:

    const { touched, dirty } = useController("/path/to/field");
    

    and should be replaced by something similar to:

    const { useTouched, useDirty } = useController("/path/to/field");
    const touched = useTouched();
    const dirty = useDirty();
    
  • Remove observeDescendants property from hooks and provided components. Instead, you should now add /** to the provided path (this aligns the API with what we use in validations):

    As an example, if you previously had something like:

    const controller = useController("/path/to/field", {
        observeDescendants: true,
        ...otherOptions,
    });
    const formattedValue = (
        <FormattedValue path="/path/to/field" observeDescendants {...otherOptions} />
    );
    

    it should now become:

    const controller = useController("/path/to/field/**", { ...otherOptions });
    const formattedValue = <FormattedValue path="/path/to/field/**" {...otherOptions} />;
    

Dependencies

  • Update Kotlin to version 2.0.20.
  • Update kotlinx-datetime to version 0.6.1.
  • Update kotlinx-serialization to version 0.7.2.

0.22.0 (Aug 7, 2024)

JS Bindings

  • Minor type updates to make them more in line with those automatically generated by the Kotlin compiler.
    • Renamed List/Map to KtList/KtMap.

Dependencies

  • Update Kotlin to 2.0.10, as well as other dependencies to their latest versions.

0.21.11 (Aug 1, 2024)

Core

  • Performance improvement: update information on the number of descendants displaying issues in a single action.

0.21.10 (Jul 31, 2024)

Core

  • Add secondary constructor to File to allow creation from Java without specifying a name.
  • Performance improvement: when writing values, invalidate all dependencies, update all stateful validations, and remove all external issues in a single action, instead of scheduling an action for each invalidation/update/removal.

0.21.9 (Jul 4, 2024)

Core

  • Add set, reset, and remove utility functions, as well as their asynchronous counterparts for the JVM target.
  • Fix infinite loop in hasAsync and getAsync implementations.

JS Bindings

  • Provide bindings for the set, reset, and remove utility functions.

0.21.8 (Jul 4, 2024)

JS Bindings

  • Provide utility function to get the next row id of a table.

0.21.6 (Jul 2, 2024)

Core

  • Fix error removing external issue of already removed value.

0.21.4 (Jun 26, 2024)

Core

  • Fix missing API dependency on JS target.

0.21.2 (Jun 18, 2024)

Core

  • Add addDependency and addExternalContextDependency methods to the Validation class, which may be called during class initialization instead of relying on property delegation.
    • These methods have the same API and replace those previously defined in JvmValidation and ScopedJvmValidation.
  • Add addObserver method to the StatefulValidation class, serving the same purpose as above.
  • Minor ValidationContext type improvements: dependencySchema/dependencySchemaOrNull functions now receive a type argument.

0.21.1 (Jun 13, 2024)

Core

  • Add utility functions convertTableRowIndicesToIds which convert paths where table rows are indexed by their index into path where said rows are indexed by their id in the corresponding table within a provided form value of a provided form schema.

    These functions are especially useful when tables are being encoded and decoded as lists (e.g. via Table.ValuesSerializer and there is a need to convert paths between one representation and the other: this is the often case when needing to add external validation issues obtained from a server.

  • Add utility functions convertTableRowIdsToIndices, which does the opposite of what was described above.

    This is useful when transforming paths into human-readable names where it makes more sense to reference a table row by its index than by its internal id.

JS Bindings

  • Provide bindings for the functions described above with names: convertPathTableRowIndicesToIds, convertPathTableRowIdsToIndices, convertIssueTableRowIndicesToIds, and convertIssuesTableRowIndicesToIds.
  • Minor type improvements (define default unknown types for most type arguments).

Dependencies

  • Reupdate dependencies as the previous downgrades didn’t make a difference regarding the problem they were trying to work around.

0.21.0 (Jun 11, 2024)

Core

  • Add static invoke methods to create LocatedValidationIssues given their severity.
  • Better JVM API: rename static invoke methods to create on the JVM.
  • Set kotlinx-datetime as a compile-only dependency since it is an optional feature that is only needed for projects using temporal values/schemas.
    • This means that projects using temporal schemas (InstantSchema, LocalDateSchema, LocalDateTimeSchema) may now have to directly depend on kotlinx-datetime if they weren’t already.

Dependencies

  • Tweak dependency versions in order to hopefully prevent conflicts when KForm is used alongside other libraries.

0.20.5 (May 30, 2024)

Core

  • Fix errors occurring when attempting to access the state of destroyed values.

0.20.4 (May 30, 2024)

Core

  • When children are destroyed, properly set their state within their parent as null when the parent value isn’t a collection.
  • Remove extraneous $ character from the result of ValidationChange.toString().

0.20.3 (May 9, 2024)

Dependencies

  • Update to latest versions.

0.20.2 (May 9, 2024)

JS Bindings

  • Fix JavaScript bindings and types for UniqueItemsBy validations (which were not supporting Table values).

React

  • Minor useInput hook improvement: prevent value from being set in the storage when it hasn’t changed.

0.20.1 (April 10, 2024)

Core

  • Fix infinite recursion in the NotEmpty validation due to a faulty isEmpty implementation.

0.20.0 (April 4, 2024)

Core

  • Revamp default offered validations (such as Required, MinLength, etc.) to fix inconsistencies, improve usability, and increase compatibility with how they affect form inputs via schema restrictions. Some of these changes can be, unfortunately, breaking, and require some code to be changed:

    • Required no longer simply checks whether a value is null. It now also checks whether the value is false or empty (for strings, arrays, collections, etc.). This makes it more consistent with web inputs and also matches typical expectations: the Required validation can now be thought of as representing the (∗) icon typically found in UI forms to denote required fields.

      Required has become the semantically correct way of representing that a value must be filled by the user in the form. As such, previous use of NotEmpty, MinLength(1), MinSize(1), and MustEqual(true) should likely be replaced with Required. See the notes on the documentation of Required to better understand when to use each validation.

      New functions named isMissing/isNotMissing were added, which implement the logic used by Required to check if a value is missing. These functions can be freely used in custom validations (or elsewhere) to match the notion of “required” used by Required.

    • Length/MinLength and Size/MinSize no longer forbid empty values. This means that an empty string is a valid value according to MinLength(5), and that an empty list is a valid value according to MinSize(5).

      Although this might seem odd at first, it makes it more consistent with how web input validations work and, more importantly, makes it easier to specify validations of the following kind, which previously required custom validations: - Text field X is not required but, if filled, must have exactly (or at least) 4 characters. - Checkbox group Y is not required but, if filled, at least 3 options must be ticked.

      This change means that code that is currently using MinLength(1) or MinSize(1) to make a field required will no longer work, and either Required (preferred) or NotEmpty should be used instead (see documentation of Required/NotEmpty to decide which one to use).

    • GreaterThan/LessThan were renamed to ExclusiveMin/ExclusiveMax.

      This makes the names more consistent with the Min/Max validations and other validation libraries.

    • Unique/UniqueBy were renamed to UniqueItems/UniqueItemsBy to better describe what the validations do, since “unique” by itself is more often used on each column of a table than on the table itself. This also makes the naming more consistent with other validation libraries.

    • AllowedMimeTypes and AllowedFileExtensions were merged into a single validation named Accepts. Besides making the validation more consistent with web inputs, it makes it possible to specify both file extensions and mime types, which wasn’t possible before, since only one of the two validations should be used at once.

      Similarly to the accept attribute of web inputs, accepted file names should now start with a full stop (.). Example usage:

      Accepts("image/*", "application/pdf", ".doc", ".docx")
      
    • A new NotBlank validation was created to check that a non-empty string is not blank.

    • Default issue codes emitted by the default validations were renamed to better explain what went wrong, rather than the name of validation that triggered them. The new codes were inspired by the error names of web validations:
      • Required: default issue code renamed from "required" to "valueMissing".
      • NotEmpty: default issue code renamed from "notEmpty" to "valueMissing".
      • MustEqual/MustNotEqual/OneOf/NotOneOf: default issues codes renamed from "disallowedValue" to "valueDisallowed".
      • Min/Max: default issue codes renamed from "min"/"max" to "rangeUnderflow"/"rangeOverflow".
      • ExclusiveMin/ExclusiveMax: default issues codes (with GreaterThan/LessThan) renamed from "greaterThan"/"lessThan"to "rangeUnderflow"/"rangeOverflow".
      • Length/MinLength/MaxLength: default issue codes renamed from "length"/"minLength"/"maxLength" to "lengthMismatch"/"tooShort"/"tooLong".
      • Size/MinSize/MaxSize: default issue codes renamed from "size"/"minSize"/"maxSize" to "sizeMismatch"/"tooSmall"/"tooLarge".
      • Matches/MatchesEmail: default issue codes renamed from "match"/"invalidEmail" to "patternMismatch"/"emailPatternMismatch".
      • Accepts: default issue codes (with AllowedMimeTypes/AllowedFileExtensions) renamed from "disallowedMimeType"/"disallowedFileExtension" to "fileTypeMismatch".
      • UniqueItems/UniqueItemsBy: default issues codes (with Unique/UniqueBy) renamed from "repeatedElements" to "itemsRepeated".

JS Bindings

  • Expose the core’s PathMultimap implementation.

0.19.2 (March 11, 2024)

JS Bindings

  • Add missing schema restrictions to JavaScript-only schemas.

0.19.1 (March 11, 2024)

Core

  • Fix CharSchema not being able to initialise values from Chars.

0.19.0 (March 7, 2024)

Core

  • Rename Table.Serializer to Table.RowsSerializer and add a new serializer named Table.ValuesSerializer which only serialises a table’s values. Whilst Table.RowsSerializer serialises a table as a map of row ids to row values, Table.ValuesSerializer serialises it as a list of row values.
  • Be more lenient on the kind of values accepted by a schema when a value is being initialised. This affects the type of values that can be provided when setting a value via FormManager.set. This is especially useful when calling FormManager.set via JavaScript, as we can now, for example, provide a regular JavaScript number when setting a Long value, as it will be coerced to Long by the LongSchema.
  • Expose simple restrictions such as required, min, or max within the type information (TypeInfo) of a schema. These are automatically computed based on the validations provided to a schema and can be used by client applications to, for example, provide properties to input fields.

    This makes it easier to automatically mark fields as required when a Required validation was provided, among other behaviours.

JS Bindings

  • Provide access to the schema type information restrictions.

React

  • Remove schemaMin/schemaMax from the controller returned by useNumericInput since the exposed schema restrictions can now be accessed and cover the same use-case.
  • Remove unused type parameter from certain types of input controllers.
  • Rename the schemaMinMax function to numericTypeMinMax and the properties of the returned object from schemaMin/schemaMax to simply min/max.

0.18.1 (February 15, 2024)

React

  • Add getClone function to the controller.

0.18.0 (January 30, 2024)

JS Bindings

  • Fix ValidateOptions type by setting each property as optional.
  • Expose utility functions to transform Kotlin maps into JS objects and vice versa.

React

  • Rename hooks and related components to make them simpler to use and more consistent:
    • useFormValue -> useController
    • useFormValueOutput -> useFormatter
    • useFormValueInput -> useInput
    • useNumericFormValueInput -> useNumericInput
    • useTemporalFormValueInput -> useTemporalInput
    • useListableFormValueInput -> useListableInput
    • useFileFormValueInput -> useFileInput
    • Output -> FormattedValue
    • The names of the types related to each hook have also been changed.
  • Introduce useFormattedValue: a new hook the wraps useFormatter (old useFormValueOutput) and returns a pair with the formatted value and its controller, for the common use case of storing a form’s value within React’s state.

    • This allows the following code to be changed:

      // Before:
      const [name, setName] = React.useState<string>();
      const controller = useFormValueOutput<string>("/name", { setFormattedValue: setName });
      
      // After:
      const [name, controller] = useFormattedValue<string>("/name");
      
  • Fix type issue with hooks such as useController (old useFormValue) where types within the hook’s options weren’t being automatically inferred unless observeDescendants was provided.

0.17.2 (January 3, 2024)

Core

  • Fix bug occurring when checking the validity of validation dependency paths ending in a recursive wildcard.

0.17.1 (January 3, 2024)

Core

  • Fix issue with the type checking of table dependencies within validations.

Dependencies

  • Update dependencies to latest versions.

0.17.0 (January 2, 2024)

Core

  • Types of validation dependencies are now validated at runtime, during construction of a FormManager or FormValidator, or manually via the validateSchemaValidations/validateExternalValidations functions.
  • Introduce standalone form utility functions: validatePath, validateSchemaValidations, validateExternalValidations, isValidPath, schemaInfo, schema, valueInfo, has, get, getClone, validate, and isValid.
    • These utility functions are available from Java via the FormUtils class.
  • Introduce future-returning variants of the async utility functions, available from Java via AsyncFormUtils.
  • Remove the TSchema type argument from FormValidator, as it is mostly useless to make the API nicer to use.
  • Remove non-validation related methods from the FormValidator, e.g. schema or get. Utility functions should be used instead in scenarios where they’re needed.
  • Introduce an AsyncFormValidator with future-returning validation methods for usage from Java.
    • The previous future-returning extension methods on FormValidator were removed.
  • Table no longer extends Collection to prevent method clashes in Java.
    • The Table API was further simplified and made more coherent.

JS Bindings

  • Expose functions wrapping all standalone form utility functions.

Migration

  • If using Kotlin, remove the second type argument of FormValidator.
  • If using Java, migrate usage of FormValidator to AsyncFormValidator:

    • Replace:

      private final FormValidator<YourForm, Schema<YourForm>> validator = new FormValidator<>(/*...*/);
      
      public List<LocatedValidationIssue> validate(YourForm form) throws ExecutionException, InterruptedException {
          return FormValidators.validateAsync(validator, form /*, ...*/).get();
      }
      

      with:

      private final AsyncFormValidator<YourForm> validator = new AsyncFormValidator<>(/*...*/);
      
      public List<LocatedValidationIssue> validate(YourForm form) throws ExecutionException, InterruptedException {
          return validator.validate(form /*, ...*/).get();
      }
      
  • When using tables, if you were previously relying on Table being a Collection (e.g., by iterating directly on it, or using Kotlin stdlib Collection extension functions such as map or sumOf), access the values property of the table instead.

    • E.g., instead of table.map { it * 2 }, use table.values.map { it * 2 }.
    • The ids or rows properties can also be used instead of values as appropriate.

0.16.4 (November 13, 2023)

Core

  • Fix AbstractSimpleSchema by allowing the schema to possibly represent nullable values.

0.16.3 (November 13, 2023)

Core

  • Make the AnySchema generic, making it more ergonomic to use.

0.16.2 (November 6, 2023)

Core

  • Introduce MustNotEqual validation, as a counterpart to MustEqual.
  • Remove equalsFn argument in MustEquals function.
  • Make it possible to construct certain validations via varargs, for a more ergonomic usage: these include AllowedMimeTypes, AllowedFileExtensions, OneOf, and NotOneOf.
    • E.g., instead of OneOf(listOf(1, 2, 3)), one can simply write OneOf(1, 2, 3).

Dependencies

  • Update Kotlin to version 1.9.20.

0.16.1 (October 30, 2023)

React

  • Fix bug when using useFormValueOutput together with observeDescendants.

0.16.0 (October 26, 2023)

Core

  • Reorganize certain KForm concepts by changing their namespaces:
    • Paths, as a core concept, are moved from the paths namespace to the root namespace.
    • KForm datatypes such as Table and File are moved to the datatypes namespace.
  • Make the whole API easier to use by also accepting paths as strings in most places where a Path instance was previously required (e.g., in FormManager methods).
  • Add overloads to JVM async form validator methods to avoid having to manually specify the default path.

Dependencies

  • Updates Node.js usage to version 20.

Migration

  • Find/replace the following globally on a project:
    • import io.kform.File -> import io.kform.datatypes.File
    • import io.kform.collections. -> import io.kform.datatypes.
    • import io.kform.paths. -> import io.kform.