Skip to content

Commit

Permalink
Add suggestions from review
Browse files Browse the repository at this point in the history
  • Loading branch information
TharmiganK committed Oct 14, 2024
1 parent cc81587 commit d30a43e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Ballerina Constraint Library
[![GitHub Last Commit](https://img.shields.io/github/last-commit/ballerina-platform/module-ballerina-constraint.svg?label=Last%20Commit)](https://github.com/ballerina-platform/module-ballerina-constraint/commits/master)
[![GitHub issues](https://img.shields.io/github/issues/ballerina-platform/ballerina-standard-library/module/constraint.svg?label=Open%20Issues)](https://github.com/ballerina-platform/ballerina-standard-library/labels/module%2Fconstraint)

The Ballerina `constraint` library facilitates APIs to do validations on the Ballerina types further with the use of annotations.
The Ballerina `constraint` library provides annotations to add constraints to Ballerina types and API to validate the values with respect to the constraints defined in the respective types.

### Constraint annotations

This library provides the following annotations to validate the values that have been assigned to Ballerina types.
This library provides the following annotations on Ballerina types to validate the values created with the respective types.

| Ballerina Type | Annotation | Supported Constraints |
|-----------------------------------|----------------------|------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -23,7 +23,7 @@ This library provides the following annotations to validate the values that have
| `any[]` | `@constraint:Array` | `length`, `minLength`, `maxLength` |
| `constraint:Date` | `@constraint:Date` | `option` - `PAST` or `FUTURE` or `PAST_OR_PRESENT` or `FUTURE_OR_PRESENT` |

The following example demonstrates how to apply constraint annotations to Ballerina types.
The following example demonstrates how to apply constraint annotations to types.

```ballerina
@constraint:String { pattern: re `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$` }
Expand All @@ -46,9 +46,9 @@ public type Person record {|

### Constraint validation

The `validate` function in this library can be used to validate the values that have been assigned to Ballerina types with respect to the constraints defined using the annotations.
The `validate` function in this library can be used to validate the values with respect to the constraints defined in the respective types.

The following example demonstrates how to validate the values assigned to a Ballerina type.
The following example demonstrates how to validate a value with respect to constraints in the type. The respective type is automatically inferred from the expression context.

```ballerina
public function main() returns error? {
Expand Down
10 changes: 5 additions & 5 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Overview

This module provides features to validate the values that have been assigned to Ballerina types.
This module provides features to validate the values with respect to the constraints defined to the respective Ballerina types.

The Ballerina `constraint` module facilitates APIs to do validations on the Ballerina types further with the use of annotations.

### Constraint annotations

This library provides the following annotations to validate the values that have been assigned to Ballerina types.
This library provides the following annotations on Ballerina types to validate the values created with the respective types.

| Ballerina Type | Annotation | Supported Constraints |
|-----------------------------------|----------------------|------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -17,7 +17,7 @@ This library provides the following annotations to validate the values that have
| `any[]` | `@constraint:Array` | `length`, `minLength`, `maxLength` |
| `constraint:Date` | `@constraint:Date` | `option` - `PAST` or `FUTURE` or `PAST_OR_PRESENT` or `FUTURE_OR_PRESENT` |

The following example demonstrates how to apply constraint annotations to Ballerina types.
The following example demonstrates how to apply constraint annotations to types.

```ballerina
@constraint:String { pattern: re `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$` }
Expand All @@ -40,9 +40,9 @@ public type Person record {|

### Constraint validation

The `validate` function in this library can be used to validate the values that have been assigned to Ballerina types with respect to the constraints defined using the annotations.
The `validate` function in this library can be used to validate the values with respect to the constraints defined in the respective types.

The following example demonstrates how to validate the values assigned to a Ballerina type.
The following example demonstrates how to validate a value with respect to constraints in the type. The respective type is automatically inferred from the expression context.

```ballerina
public function main() returns error? {
Expand Down
10 changes: 5 additions & 5 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Package overview

This package provides features to validate the values that have been assigned to Ballerina types.
This package provides features to validate the values with respect to the constraints defined to the respective Ballerina types.

The Ballerina `constraint` package facilitates APIs to do validations on the Ballerina types further with the use of annotations.

### Constraint annotations

This library provides the following annotations to validate the values that have been assigned to Ballerina types.
This library provides the following annotations on Ballerina types to validate the values created with the respective types.

| Ballerina Type | Annotation | Supported Constraints |
|-----------------------------------|----------------------|------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -17,7 +17,7 @@ This library provides the following annotations to validate the values that have
| `any[]` | `@constraint:Array` | `length`, `minLength`, `maxLength` |
| `constraint:Date` | `@constraint:Date` | `option` - `PAST` or `FUTURE` or `PAST_OR_PRESENT` or `FUTURE_OR_PRESENT` |

The following example demonstrates how to apply constraint annotations to Ballerina types.
The following example demonstrates how to apply constraint annotations to types.

```ballerina
@constraint:String { pattern: re `^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$` }
Expand All @@ -40,9 +40,9 @@ public type Person record {|

### Constraint validation

The `validate` function in this library can be used to validate the values that have been assigned to Ballerina types with respect to the constraints defined using the annotations.
The `validate` function in this library can be used to validate the values with respect to the constraints defined in the respective types.

The following example demonstrates how to validate the values assigned to a Ballerina type.
The following example demonstrates how to validate a value with respect to constraints in the type. The respective type is automatically inferred from the expression context.

```ballerina
public function main() returns error? {
Expand Down
2 changes: 1 addition & 1 deletion docs/spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Edition_: Swan Lake

## Introduction
This is the specification for the Constraint standard library of [Ballerina language](https://ballerina.io/), which
provides APIs to validate the values that have been assigned to Ballerina types.
provides annotations to add constraints to Ballerina types and API to validate the values with respect to the constraints defined in the respective types.

The Constraint library specification has evolved and may continue to evolve in the future. The released versions of the
specification can be found under the relevant GitHub tag.
Expand Down

0 comments on commit d30a43e

Please sign in to comment.