Skip to content

Commit

Permalink
Open object for semtypes (#193)
Browse files Browse the repository at this point in the history
* Open object for semtypes

* fix it

* insta
  • Loading branch information
lucasavila00 authored May 10, 2024
1 parent fc38d9b commit 9096f72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion packages/beff-core/src/ast/json_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ impl JsonSchema {
} else {
Self::AllOf(BTreeSet::from_iter(vs))
}
// Self::AllOf(BTreeSet::from_iter(vs))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/beff-core/src/subtyping/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'a> ToSemTypeConverter<'a> {
.collect::<Result<_>>()?;
let rest = match rest {
Some(r) => self.to_sem_type(r, builder)?,
None => SemTypeContext::never().into(),
None => SemTypeContext::unknown().into(),
};
Ok(builder.mapping_definition(Rc::new(vs), rest).into())
}
Expand Down
5 changes: 4 additions & 1 deletion packages/beff-core/src/subtyping/to_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,12 @@ impl<'a, 'b> SchemerContext<'a, 'b> {
}

let rest = if mt.rest.is_empty(self.ctx.0) {
panic!("rest should not be empty, all records are open")
} else if mt.rest.is_any() {
None
} else {
Some(Box::new(self.convert_to_schema(&mt.rest, None)))
let schema = self.convert_to_schema(&mt.rest, None);
Some(Box::new(schema))
};

JsonSchema::Object {
Expand Down

0 comments on commit 9096f72

Please sign in to comment.