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

(feature): Add support for default values and validation rules #3640

Merged
merged 23 commits into from
May 20, 2024

Conversation

amckinney
Copy link
Collaborator

@amckinney amckinney commented May 16, 2024

This adds support for default values and validation rules for integer, double, and string types.

The Fern definition looks like the following, where each of the relevant primitive types has a full example:

types:
  Type:
    docs: |
      Defines properties with default values and validation rules.
    properties:
      decimal:
        type: double
        default: 1.1
        validation:
          exclusiveMin: true
          exclusiveMax: false
          min: 1.1
          max: 2.2
          multipleOf: 1.1
      even:
        type: integer
        default: 42
        validation:
          exclusiveMin: false
          exclusiveMax: true
          min: 0
          max: 100
          multipleOf: 2
      name:
        type: string
        default: fern
        validation:
          minLength: 3
          maxLength: 10
          pattern: ^[a-z]+$

@amckinney amckinney marked this pull request as ready for review May 17, 2024 21:57
@amckinney amckinney requested a review from dsinghvi as a code owner May 17, 2024 21:57
@amckinney amckinney merged commit 13df267 into main May 20, 2024
29 checks passed
@amckinney amckinney deleted the amckinney/validation branch May 20, 2024 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants