amazon-ion / ion-schema-rust

Rust implementation of Ion Schema
https://amazon-ion.github.io/ion-schema/sandbox
Apache License 2.0
13 stars 6 forks source link

Create named type `range_int_non_negative` #46

Open desaikd opened 2 years ago

desaikd commented 2 years ago

Currently Range::IntegerNonNegative(_) is created using a variable called is_non_negative which is used by all the calls related to range creation. It can be modified to use a named type range_int_non_negative as below:

type::{
  name: range_int_non_negative,
  type: list,
  annotations: required::[range],
  ordered_elements: [
    { one_of: [ int_non_negative, { valid_values: [min] } ] },
    { one_of: [ int_non_negative, { valid_values: [max] } ] },
  ],
  container_length: 2,
}

Reference discussion: https://github.com/amzn/ion-schema-rust/pull/45#discussion_r749586496