Open FirelightFlagboy opened 2 years ago
Ensure that minor versions are compatible to each other (i.e.: v1.1 with v1.3).
Just to be sure: we don't need to test v1.1 against v1.3, (but only v1.1 against v1.2, then v1.2 against v1.3)
I guess it's the same thing when test a major version: considering we have versions v1.0 v1.1 v2.0 v2.1, we only need to a single v2 version against a single v1 (typically last v2 against last v1) to ensure there is breaking changes between the two
From the example above, we have the field human_handle that is present in version ~=1.1 but not in version >=2.0
That's interesting: it seemed clear to me that "introduced_in": [{ "major": 1, "minor": 1 },]
meant this field is present in ~=1.1 and 2.0 (I expected that if the field disappear an a major version 2, this version should have it own full schema and not share it with version 1)
So we may want of a more explicit way to describe this. For instance if the introduced_in
only accept a single value (i.e. "introduced_in": { "major": 1, "minor": 1 }
, then it's obvious that the field is optional in major version 1 and always present in major version 2 (and if we want to remove the field from major version 2, we must have a separated schema which is explicit)
For protocol scheme
I think the introduced_in
field should also be present for nested_types
's fields
For type scheme
For the moment we don't have a versionning for type scheme (we consider we should never break compat, otherwise encrypted data would no longer be readable). But we can consider we are currently in major version 1 in order to have a json format similar to what is done for protocol scheme. And obviously tests for type scheme should only allow a v1 major version !
I've updated the issue body:
Field
that is used everywhere, so it's now used in nested_types
introduced_in
now don't take a list, but a fixed major/minor
I've updated the issue body:
introduced_in
is now a string-pattern
introduced_in
One thing that appear to be missing is how to we separate the different major version of an protocol.
mod ping {
enum Ping {
V1(PingV1V2),
V2(PingV1V2),
V3(PingV3)
}
struct PingV1V2 {
// ...
}
struct PingV3 {
// ...
}
}
mod ping {
mod v1v2 {
struct Ping {
// ...
}
// ...
}
mod v1 {
pub use super::v1v2::Ping;
// ...
}
mod v2 {
pub use super::v1v2::Ping;
// ...
}
mod v3 {
struct Ping {
// ...
}
// ...
}
}
mod v1 {
mod ping {
struct Ping {
// ...
}
// ...
}
// ...
}
mod v2 {
mod ping {
struct Ping {
// ...
}
// ...
}
// ...
}
mod v3 {
mod ping {
struct Ping {
// ...
}
// ...
}
// ...
}
So it appear that the proposal Protocol using module to separate major version.
is preferred
I've updated the original issue with the following change:
TypeScheme
that was previously called ProtocolScheme
due to a bad copy/paste.introduced_in
for ProtocolScheme
& TypeScheme
.
This field only server for documentation purpose for when a scheme is added during minor bumpI've update the original issue with the following change:
Protocol
& Type
to prefer the use of key/value instead of array keyed by an internal value. This change is to prevent by design duplication of values
Rust protocol schema testing
v1
againstv2
).v1.1
withv1.3
).TODOS
MAJOR-ENEMIES
MINOR-ALLIES
SQUASH-UNRELEASED
STABLE-RELEASE
introduced_in
Assumption
3
if the version2
don't exist. Same if version1
don't exist)Change in the json schemes
Some change are required in the json schemes:
majors_versions
introduced_in
that replace the fieldintroduced_in_revision
For protocol scheme
Example protocol scheme
From the example above, we have the field
human_handle
that is present on versions>=1.1
(including2.*
)For type scheme
Example type scheme
From the example above, we have the field
foo
that's is present on versions>=1.1
(including2.*
)Testing the scheme
Testing retro-compatibility
We want to verify how a new version is compared to the previous versions.
Testing retro-compatibility on major versions (
MAJOR-ENEMIES
)When creating a new major version e.g.
2.0
, we MUST check if this version is not compatible with the previous version1.*
Testing retro-compatibility on minor versions (
MINOR-ALLIES
)When creating a new minor version e.g.
1.3
, we MUST check if this version is compatible with the previous version1.2
.Testing multiple unreleased version (
SQUASH-UNRELEASED
)During the development process, we may need to edit the api protocol but we don't want to have multiple unreleased version.
If we haven't release the version
2.1
, we don't need to create the version2.2
.Testing readonly older released version (
STABLE-RELEASE
)We want to check if we aren't editing a previously released api version.
For that we will need to have a list of released versions and check if those weren't edited
Testing
introduced_in
We MUST check the value in
introduced_in
, the value must respond to the following criteria:MajorMinorString
major
part MUST be listed inmajor_versions
minor
part MUST be>0