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

Change ISL model to retain order of non-ISL(open content) and ISL values #147

Open desaikd opened 1 year ago

desaikd commented 1 year ago

Current implementation model of ISL doesn't store the relative order for ISL and non ISL contents. The following can not be differentiated with current implementation:

$foo
$bar
type::{ name: foo, codepoint_length: 1 }

and

type::{ name: foo, codepoint_length: 1 }
$foo
$bar

In order to preserve this relative order IslSchema should be changed to contain a vector of enums where the enum can have either ISL or non ISL(open content). A possible enum could look like following:

enum IslContent {
     TyepDef(TyepDef),
     OpenContent(Element),
}

Reference comment: https://github.com/amazon-ion/ion-schema-rust/pull/145#discussion_r1092819029