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

Issue with loading type definition that uses type references from the following part of schema #114

Closed desaikd closed 2 years ago

desaikd commented 2 years ago

There is a bug in loading schema that has a definition which uses a type reference from the following part of the schema.

Example:

type:: {
  name: a,
  type: b // <--- this is defined in the following part of schema
},
type::{
  name: b,
  type: int
}

The above schema throws following error:

UnresolvableSchemaError { description: "Could not resolve type reference: \"b\" does not exist" }

This is because it doesn't keep track of following part of schema where other type definitions are defined.