Skip to content
This repository has been archived by the owner on Jun 2, 2023. It is now read-only.

Large set of changes (see details) #53

Merged
merged 13 commits into from
Aug 18, 2016
Merged

Large set of changes (see details) #53

merged 13 commits into from
Aug 18, 2016

Conversation

tjaffri
Copy link
Contributor

@tjaffri tjaffri commented Aug 17, 2016

There are a few large fixes in here. See below:

  1. Resolves Node package naming conventions #50 - Node package naming conventions. All the package.json files are now in this format.
  2. Resolves Create org.OpenT2T.Sample.SuperPopular.Thermostat schema in OCF format #44 - Thermostat schema in OCF format after many discussions across @jeanpa, @arjun-msft and @jasongin. Thanks everyone for your help!
  3. Resolves Add basic OCF schemas #46 - Basic OCF schemas. These are checked in under the oic.r.* namespaces, and are referenced from the Thermostat schema.
  4. Partial fixes for Modify the Wink Thermostat Translator to be aligned with OCF format #45 - Thermostat translator in OCF format. The Get and Post are currently stubbed out, since I needed to fix Wink thermostat translator fails with a redirect to the Wink homepage #52 first (added that to this PR below as well). Next, will fill out the Get and Post which should be straightforward with the new wink helper (v2 api).
  5. Resolves Update the directory structure of translators repo to use reverse URI based names for translators #43 - reverse URI based names for translators. Thanks everyone for the feedback in that regard.

Sorry this is such a large merge... but needed multiple rounds of feedback of the holistic design. Will try to make future PRs atomic and easier to review one at a time.

Note: Given how large this commit is and all the interim "work in progress" commits, I suggest whoever does the merge does a "squash commits" so we don't pollute the commit history.

tjaffri added 11 commits August 15, 2016 14:50
…me limited only to the wink thermostat translator (and thermostat schema). This is work in progress with discussions across various folks, and impacts #43 and #45
…d ocf schema files and updated the README for Wink Thermostat. Have not run test automation yet... that's the next step.
Using the schema name as ResURI, and add ID to GET QueryString. This will make it easier to implement RAML in a cloud service that implements accessing this schema.
Also fixed the test scripts and package.json to make the tests work, and use the updating naming conventions in the opent2t library.
Fixed thingTranslator naming conventions to match what opent2t library expects, and updated RAML conventions to map to function names in thingTranslator.

Test automation is currently failing, but due to an actual issue with the wink translator! So the test is actually working, but the translator is legitmately failing. That will be addressed separately as part of #52.
As part of this, I have moved the wink helper to the v2 api and signficantly cleaned it up. I have fixed the wink thermostat translator, but now the other wink translators need to be fixed as well. I will follow up with subsequent checkins to resolve as part of #40.
<property name="targetTemperatureLow" type="d" access="readwrite">
<description>Minimum target temperature (in Celsius).</description>
</property>

Copy link
Contributor

Choose a reason for hiding this comment

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

change units to fahrenheit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I stuck with Celsius on purpose.... that's the SI unit. May be a little un-american of me, perhaps :)

For what it's worth, the Wink API (for which we are writing the first translator) also uses Celsius units: http://docs.winkapiv2.apiary.io/#reference/device/thermostats

#ByDesign

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with using Celsius units here, as long as the type is decimal not integer so there is no loss of precision when converting on either side.

Note the OCF thermostat schema that we've been discussing actually specifies the units in the property JSON.

(I am an American, and I think non-metric units are silly and old-fashioned.)

Copy link
Contributor

Choose a reason for hiding this comment

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

so we should fix the schemas to "units": "C" ?


In reply to: 75194786 [](ancestors = 75194786)

Copy link
Contributor

Choose a reason for hiding this comment

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

There's not much point in making changes to the AllJoyn schemas now, until we decide whether and how we are going to align the AllJoyn schemas with OCF. Maybe we will even auto-convert them from OCF.


In reply to: 75208998 [](ancestors = 75208998,75194786)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sanjaiganesh I think this is #ByDesign. If you disagree, please file a bug.

@sanjaiganesh
Copy link
Contributor

    "optimist": "0.6.1",

Are we not adding 'files' field ? Is it not required ?


Refers to: org.opent2t.sample.windowshade.superpopular/org.opent2t.test.windowshade/js/package.json:10 in 0f69203. [](commit_id = 0f69203, deletion_comment = False)

@sanjaiganesh
Copy link
Contributor

sanjaiganesh commented Aug 17, 2016

:shipit:

@tjaffri
Copy link
Contributor Author

tjaffri commented Aug 17, 2016

@sanjaiganesh per the discussion in #51 we should put that in the build script rather than include files inside the package.json as a fixed entry. Please file a separate tracking issue if you are concerned.

@jasongin
Copy link
Contributor

    "optimist": "0.6.1",

Any use of "files" or "main" in the package.json here is going to be wrong because of how the package.json file is in the wrong directory. Both properties will be automatically generated/overwritten by the build script anyway.


In reply to: 240483336 [](ancestors = 240483336)


Refers to: org.OpenT2T.WindowShade.SuperPopular.Sample/org.OpenT2T.Test.WindowShade/js/package.json:10 in 0f69203. [](commit_id = 0f69203, deletion_comment = False)

@@ -3,9 +3,9 @@
<!-- associated voice handler -->
<voice id="" />
<!-- associated schema -->
<schema id="org.OpenT2T.Thermostat.SuperPopular.Sample" />
<schema id="org.opent2t.sample.thermostat.superpopular" />
<!-- associated onboarding module -->
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we intending to support both a single element at the top level as well as one or more elements under a element? The parsing code in my lib PR currently only supports the latter, but I can change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This nest thermostat translator has not been updated as part of this PR (none of the other translators have been updated either). So let's ignore whatever that says (other than renaming/casing changes of course).

The Wink Thermostat is under review here. Issue #36 tracks updating all the other translators (Once we agree on this one I can do a series of PRs modifying all the other translators one by one following the same pattern)

@jasongin
Copy link
Contributor

This class follows the AllJoyn schema, which is not in sync with the RAML schema of the same name. Since the schema .js file references the RAML version, this translator is not consistent with that.


Refers to: org.opent2t.sample.thermostat.superpopular/com.nest.thermostat/js/thingTranslator.js:91 in 0f69203. [](commit_id = 0f69203, deletion_comment = False)

var delay = require('delay')

// This boilerplate code is copied from transpiled typescript AVA test code, which enables usage of 'yield' keyword.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm concerned that this, and the use of __awaiter and yield below, makes the test code look far more complicated than it needs to be. We want other developers to be able to copy this test code to use for writing tests for translators they develop. If we're not using TypeScript, then we should just write the test code in normal ES6 syntax with .then() callbacks instead of awaits.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is .js file. I felt this was looking clean and we really want us to use a test runner like ava, for all its benefits. when we setup lab, we know how many total test cases and how many passed etc.. May be we can simplify this by removing this boilerplate code and fixing it.


In reply to: 75198452 [](ancestors = 75198452)

Copy link
Contributor

Choose a reason for hiding this comment

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

We can have all those benefits while using normal .then() callbacks instead of this __awaiter which is messy and unfamiliar to people. AVA doesn't require TypeScript or await.


In reply to: 75208579 [](ancestors = 75208579,75198452)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a great discussion, but I'm hoping we don't need to block this PR for this. @sanjaiganesh I added issue #55 to track this... perhaps you could take a stab at it? For this PR I think this is #WontFix and we can clean it up later (very soon hopefully, perhaps tomorrow/friday).

@tjaffri
Copy link
Contributor Author

tjaffri commented Aug 17, 2016

@jasongin as long as you see my note about the nest thermostat translator being out of scope for this PR, I think I have addressed all feedback so far.

Do you guys have more feedback?

@jasongin
Copy link
Contributor

:shipit:

1 similar comment
@sanjaiganesh
Copy link
Contributor

:shipit:

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

Successfully merging this pull request may close these issues.

5 participants