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

Add an explicit v0 version of the protocol #16797

Merged
merged 5 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@

package io.airbyte.protocol.models;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import io.airbyte.commons.json.Jsons;
import io.airbyte.protocol.models.AirbyteMessage.Type;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand Down Expand Up @@ -33,4 +36,16 @@ void testJsonSchemaType() {
}
}

@Test
void testVersionedObjectsAccessibility() {
final var message = new io.airbyte.protocol.models.AirbyteMessage()
.withType(Type.SPEC);
final var messageV0 = new io.airbyte.protocol.models.v0.AirbyteMessage()
.withType(io.airbyte.protocol.models.v0.AirbyteMessage.Type.SPEC);

// This only works as long as the default version and v0 are equal
final var deserializedMessage = Jsons.deserialize(Jsons.serialize(message), io.airbyte.protocol.models.v0.AirbyteMessage.class);
assertEquals(messageV0, deserializedMessage);
}

}