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

Support bytes as a data type #82

Merged
merged 2 commits into from
Aug 5, 2019
Merged

Support bytes as a data type #82

merged 2 commits into from
Aug 5, 2019

Conversation

relud
Copy link
Collaborator

@relud relud commented Aug 5, 2019

fixes #81

@relud relud requested a review from acmiyaguchi August 5, 2019 21:23
Copy link
Contributor

@acmiyaguchi acmiyaguchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, it's missing an integration test under tests/resources/translate/atomic.json. Could you add the following test?

    {
      "description": [
        "Test that strings can be casted into byte strings"
      ],
      "name": "test_bytes_format",
      "compatible": true,
      "test": {
        "avro": {
          "type": "bytes"
        },
        "bigquery": [
          {
            "mode": "REQUIRED",
            "name": "root",
            "type": "BYTES"
          }
        ],
        "json": {
          "format": "bytes",
          "type": "string"
        }
      }
    }

With that, r+.

src/jsonschema.rs Show resolved Hide resolved
@relud relud force-pushed the bytes branch 2 times, most recently from 15b9966 to 3b2d80a Compare August 5, 2019 21:35
@acmiyaguchi
Copy link
Contributor

Also, here's another thing that could be added to this PR, but doesn't have to.

(Type::Atom(left), Type::Atom(right)) => {
let atom = match (left, right) {
(Atom::Boolean, Atom::Boolean) => Atom::Boolean,
(Atom::Integer, Atom::Integer) => Atom::Integer,
(Atom::Number, Atom::Number)
| (Atom::Integer, Atom::Number)
| (Atom::Number, Atom::Integer) => Atom::Number,
(Atom::String, Atom::String) => Atom::String,
(lhs, rhs) => {

The union of a string and bytes should probably be bytes, for now it'll be dropped. Your thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support bytes as a data type
2 participants