Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioned internal references #14

Open
bedeho opened this issue Sep 21, 2019 · 2 comments
Open

Versioned internal references #14

bedeho opened this issue Sep 21, 2019 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@bedeho
Copy link
Member

bedeho commented Sep 21, 2019

Currently, it is not possible to require that reference to some entity in a class has to support some specific schema versions. It makes sense to allow expressing this more harsh constraint, and it will be a requirement when wanting to introduce certain new types of schema upgrades.

A simple way could be to change Internal(ClassId) to Internal(ClassId, Option<VersionConstraint>) in PropertyType, where VersionConstraint can be something like

enum VersionConstraint {
Exactly(u16),
AtLeast(u16)
}
@bedeho bedeho added the good first issue Good for newcomers label Sep 21, 2019
@siman
Copy link
Contributor

siman commented Sep 25, 2019

What about more flexible guards?

enum SchemaVersionConstraint {
  Gt(u16),
  Ge(u16),
  Eq(u16),
  Le(u16),
  Lt(u16),
}

// ... in PropertyType struct:
// where the first constraint is for lower bound
// and the second constraint is for upper bound:
Internal(ClassId, Option<SchemaVersionConstraint>, Option<SchemaVersionConstraint>)

Or more verbose version:

enum SchemaVersionConstraint {
  GreaterThanOrEqual(u16),
  GreaterThan(u16),
  Equal(u16),
  LessThan(u16),
  LessThanOrEqual(u16),
}

@siman siman added the enhancement New feature or request label Sep 25, 2019
@bedeho
Copy link
Member Author

bedeho commented Sep 25, 2019

I am not sure if it makes sense to have upper bounds? Is there a use case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants