Git Product home page Git Product logo

senml's People

Contributors

dborovcanin avatar drasko avatar manuio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

senml's Issues

Allow SenML without Value in Base Record in line with RFC 8428 spec

According to the RFC 8428 spec, it seems to be valid to not have a Value in the Base Record of a JSON SenML record. Please see Section 5.1.7, first example. However, the Mainflux SenML transformer requires a Value field to be present in each SenML Record.

Meaning the following SenML is invalid according to Mainflux:

[
  {
    "bn": "urn:dev:ow:10e2073a01080063:",
    "bt": 1648560975
  },
  {
    "n": "temperature",
    "u": "Cel",
    "v": 18.3
  },
  {
    "n": "humidity",
    "u": "%RH",
    "v": 42
  }
]

But this is valid (first and second Records are merged):

[
  {
    "bn": "urn:dev:ow:10e2073a01080063:",
    "bt": 1648560975,
    "n": "temperature",
    "u": "Cel",
    "v": 18.3
  },
  {
    "n": "humidity",
    "u": "%RH",
    "v": 42
  }
]

You can see in the following Validate function that an ErrNoValues is thrown if a Value is not present:
https://github.com/mainflux/senml/blob/78a09af66021636e0974f768118d54a9674ed7ff/senml.go#L230-L232

Can you update the Mainflux SenML Validator to be in line with the RFC 8428 spec?

The pack struct not use in json message format.

Hello, as I see the SenML use ' []senml.Record', not use 'senml.Pack', I found the definition of senml.Pack below:

// Pack consists of SenML records array.
type Pack struct {
XMLName *bool json:"_,omitempty" xml:"sensml"
Xmlns string json:"_,omitempty" xml:"xmlns,attr"
Records []Record xml:"senml"
}
Why not use this struct's json-Marshal?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.