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

Normalized [previously canonical] format #1007

Closed
fgalan opened this issue Jun 15, 2015 · 5 comments
Closed

Normalized [previously canonical] format #1007

fgalan opened this issue Jun 15, 2015 · 5 comments

Comments

@fgalan
Copy link
Member

fgalan commented Jun 15, 2015

In order to ease the programming of clients that need a uniform format for attributes, an option could be passed to the GET operations that render that information, so attribute and metadata will be using always an structure with value, type and metadata (in the case of attributes) or value and type (in the case of metadata).

E.g. non-canonical:

         {
            "type": "Car",
            "id": "P-9873-K",
            "colour": "red",
            "speed": {
                "value": 100,
                "type": "number",
                "accuracy": 2,
                "timestamp": {
                    "value": "2015-06-04T07:20:27.378Z",
                    "type": "date"
                }
            }
         }

would be:

         {
            "type": "Car",
            "id": "P-9873-K",
            "colour": {
              "value": "red",
              "type": ""
            }
            "speed": {
                "value": 100,
                "type": "number",
                "accuracy": {
                   "value": 2,
                   "type": "number",
                "timestamp": {
                    "value": "2015-06-04T07:20:27.378Z",
                    "type": "date"
                }
            }
         }
@fgalan fgalan added the APIv2 label Jun 15, 2015
@fgalan
Copy link
Member Author

fgalan commented Jun 15, 2015

One possiblity so clients can specify they want the info in cannonical way is to use the cannonical option, e.g.:

GET /v2/entities?options=canonical

@kzangeli kzangeli changed the title Cannonical format Canonical format Jul 9, 2015
@fgalan
Copy link
Member Author

fgalan commented Jul 15, 2015

This pseudo-test harness should be taken into account when implementing this issue (only the part related with canonical model):

https://gist.github.com/fgalan/d39b016be45d2591a6e7

@fgalan
Copy link
Member Author

fgalan commented Jul 17, 2015

Another posibility for the options parameter would be oma, as the structures returned are close to the one used by the OMA spec, e.g.:

GET /v2/entities?options=oma

@fgalan fgalan changed the title Canonical format Normalized [previously canonical] format Jul 25, 2015
@fgalan
Copy link
Member Author

fgalan commented Jul 25, 2015

Better terms has been suggested:

  • normalized (instead of canonical)
  • compact, for meaning the opposed to normalized.

@fgalan fgalan added the backlog label Aug 13, 2015
@fgalan fgalan added this to the 0.24.0 milestone Aug 14, 2015
@fgalan fgalan modified the milestones: 0.24.0, 0.26.0 Sep 8, 2015
@fgalan
Copy link
Member Author

fgalan commented Sep 21, 2015

The changes mentioned in #1259 will implement this in a different way. Closing.

@fgalan fgalan closed this as completed Sep 21, 2015
@fgalan fgalan removed this from the 0.26.0 milestone Sep 21, 2015
fisuda pushed a commit to fisuda/fiware-orion that referenced this issue Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant