Skip to content

Validate the default value for prop and data against to the given type #312

@Malian

Description

@Malian

The current implementation allows the following code:

prop title, :string, default: 0

We could check that the default value respects the type string at compile time and raise a CompilationError if the default value does not match the given type.

We should be able to perform this validation for the following types:

  • :list
  • :boolean
  • :string
  • :time
  • :date
  • :datetime
  • :naive_datetime
  • :number
  • :integer
  • :decimal
  • :map
  • :fun
  • :atom
  • :module
  • :keyword
  • :struct
  • :tuple
  • :pid
  • :port
  • :reference
  • :bitstring
  • :range
  • :mapset
  • :regex
  • :uri
  • :path

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions