Skip to content

Commit

Permalink
Open object for semtypes
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasavila00 committed May 10, 2024
1 parent fc38d9b commit 846fad4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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
9 changes: 7 additions & 2 deletions packages/beff-core/src/subtyping/to_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,14 @@ impl<'a, 'b> SchemerContext<'a, 'b> {
}

let rest = if mt.rest.is_empty(self.ctx.0) {
None
panic!("rest should not be empty, all records are open")
} else {

Check failure on line 188 in packages/beff-core/src/subtyping/to_schema.rs

View workflow job for this annotation

GitHub Actions / tests

this `else { if .. }` block can be collapsed
Some(Box::new(self.convert_to_schema(&mt.rest, None)))
if mt.rest.is_any() {
None
} else {
let schema = self.convert_to_schema(&mt.rest, None);
Some(Box::new(schema))
}
};

JsonSchema::Object {
Expand Down

0 comments on commit 846fad4

Please sign in to comment.