ion-cli icon indicating copy to clipboard operation
ion-cli copied to clipboard

Update consumed version of `ion-schema-rust` to support all core types

Open jobarr-amzn opened this issue 3 years ago • 0 comments

The version of ion-schema-rust used here does not seem to support the document core type, described in the Ion schema spec here.

Given this content adapted from the document example in the Ion Schema specification docs:

❯ cat document_example.isl
$ion_schema_1_0
schema_header::{
}

type::{
  name: IonSchema,
  type: document,
  ordered_elements: [
    { type: Header, occurs: optional },
    { type: Type,   occurs: range::[0, max] },
    { type: Footer, occurs: optional },
  ],
}

type::{
  name: Header,
  type: struct,
  annotations: [required::schema_header],
  fields: {
    imports: ImportList,
  },
}

type::{
  name: ImportList,
  type: list
}

type::{
  name: Type,
  type: struct,
  annotations: [required::type],
  fields: {
    name: symbol,
  },
}

type::{
  name: Footer,
  type: struct,
  annotations: [required::schema_footer],
}

schema_footer::{
}

ion-schema-rust fails because there is no known document type:

❯ ion beta schema validate \
--input document_example.isl \
--schema document_example.isl \
--directory . \
--type IonSchema
Error: Could not resolve type reference: "document" does not exist

It looks like document support was added in this PR: https://github.com/amzn/ion-schema-rust/pull/116 .

jobarr-amzn avatar Nov 14 '22 19:11 jobarr-amzn