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

Enhance model and APIs with "desiredProperties" for Features #697

Closed
thjaeckle opened this issue Jun 18, 2020 · 0 comments · Fixed by #865
Closed

Enhance model and APIs with "desiredProperties" for Features #697

thjaeckle opened this issue Jun 18, 2020 · 0 comments · Fixed by #865
Milestone

Comments

@thjaeckle
Copy link
Member

thjaeckle commented Jun 18, 2020

Actual issue for implementing the model discussed first in #125 and now being part of #696

The latest proposal is the following JSON structure containing the "desiredProperties" needed for #696:

{
  "thingId": "org.eclipse.ditto:my-thermostat-1",
  "policyId": "org.eclipse.ditto:my-thermostat-1",
  "features": {
    "Thermostat": {
      "definition": [ "org.eclipse.ditto:Thermostat:1.0.0" ],
      "properties": {
        "status": {
          "measured-temperature": 20
        },
        "configuration": {
          "target-temperature": 20.0
        }
      },
      "desiredProperties": {
        "configuration": {
          "target-temperature": 22.0
        }
      }
    }
  }
}

Explanation:

  • aside to properties the new Ditto managed field desiredProperties is added
  • the same definition applies for both properties and desiredProperties
    • however, inside desiredProperties all mandatory properties defined by the definition are optional
  • once a desiredProperties property is set (e.g. by a backend application or mobile app), the actual device has the task to apply that and reflect the applied desiredProperties property in the same one below the properties object
  • when desiredProperties is not existing or is empty, all desired property changes were applied, none are pending

The pros/cons of this approach (other formats were already discussed in #125) are:

+:

  • same definition is shared for properties and desired
    • (future topic relevant for schema validation): however, for desired the "required" properties defined in the Vorto model probably have all to be optional
  • defines fine grained which deltas should be sent downlink
  • policy may be written in a way which defines different access rights for properties/desiredProperties
  • search can use desiredProperties and/or reported properties (even in combination)
  • reduced unneeded payload duplication (besides properties hierarchy structure in JSON)
  • no need for a desired channel in addition to twin/live - that would be "just" another JsonPointer path in the twin

-:

  • is currently NOT possible by convention before implementing the model enhancement

Interim format until model is implemented

In order to mitigate the negative point, that this format is not usable in the meantime until the Ditto model was enhanced, the following interim format is suggested:

Click to see the interim format
{
"thingId": "org.eclipse.ditto:my-thermostat-1",
"policyId": "org.eclipse.ditto:my-thermostat-1",
"features": {
  "Thermostat": {
    "definition": [ "org.eclipse.ditto:Thermostat:1.0.0" ],
    "properties": {
      "~properties": {
        "status": {
          "measured-temperature": 20
        },
        "configuration": {
          "target-temperature": 20.0
       }
      },
      "~desiredProperties": {
        "configuration": {
          "target-temperature": 22.0
        }
      }
    }
  }
}
}

All API calls would work very similar to the future structure. Partial GET/PUT semantics are similarly supported.

The character prefix "~" is used to mark that this is the preliminary convention and this allows a simpler migration towards the target format.

Migration is later possible by:

  • rewriting all paths: "properties/~properties" → "properties" and "properties/~desiredProperties" → "desiredProperties"

A script could optionally migrate existing things/policies from the interim format to the actual one once implemented.

@thjaeckle thjaeckle added this to the 1.3.0 milestone Aug 26, 2020
@thjaeckle thjaeckle modified the milestones: 1.3.0, 1.4.0 Sep 16, 2020
@thjaeckle thjaeckle changed the title Enhance model and APIs with "desired" feature properties Enhance model and APIs with "desiredProperties" for Features Oct 15, 2020
@thjaeckle thjaeckle removed this from the 1.4.0 milestone Oct 23, 2020
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Implements desired properties as new element of a Feature on pair with the existing properties.

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
… opreations

Adds commands/commandsResponses for the CRUD operations via twin channel on desired FeatureProperties.
Also adds exceptions for failing CRUD operations.
Live commands/commandResponse to be implemented.

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Adds the events for CRUD on Feature's desired properties.

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Adds live commands and command-answer-builders for desired properties of features.

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Adds EventStrategies for the desired properties of a feature.
Fixes a setDesiredProperties which accidentally set the normal properties.

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Minor fixes as part of review for desired properties in protocol-adapter

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch-si.com>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch-si.com>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch-si.com>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch-si.com>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch-si.com>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Implement supported schema versions for desired commands.
Before cruding desired properties in API 1 lead to 500 response.
This fixes the behaviour to the expected 404 and prevents an internal server error.

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Fixed review change requests by @jufickel-b

Part of eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Fix review change requests by @joosdavid

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Fix review change requests by @joosdavid

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Fix review findings by @joosdavid

Part of issue eclipse-ditto#697

Signed-off-by: David Schwilk <david.schwilk@bosch.io>
ghost pushed a commit to bosch-io/ditto that referenced this issue Oct 30, 2020
Change since annotations from 1.4.0 to 1.5.0 since desired properties will assumably released with a later Ditto version.

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Added desired properties examples to sidebar.

Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Added bundled docs.
Updated readme.

Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off-by: Joos David (IOC/PAP-TH) <david.joos@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off by: David Joos <david.joos@bosch.io>

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
reviewed documentation for desired properties and swagger refactoring by @joosdavid

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Part of issue eclipse-ditto#697

Signed-off-by: David Joos <david.joos@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
reviewed documentation for desired properties and swagger refactoring by @joosdavid

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Adjust to request by @jufickel-b

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Adjust to request by @jufickel-b

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Adjust to request by @jufickel-b

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Adjust to request by @jufickel-b

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Adjust to request by @jufickel-b

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Adjust to request by @jufickel-b

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 4, 2020
Adjust to request by @jufickel-b

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 5, 2020
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 5, 2020
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 5, 2020
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 5, 2020
This enables to query by exists on Feature's properties and desired properties by adding FiledExpressions for the properties without it's subpath.

Part of issue eclipse-ditto#697
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 6, 2020
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk pushed a commit to bosch-io/ditto that referenced this issue Nov 6, 2020
* Fixed typos in Javadoc comments.
* Removed superfluous `final` keywords from interfaces.
* Removed superfluous method overwrites from interfaces.
* Widened interfaces by using `CharSequence` instead of `String` as parameter type.
* Adjusted some code formatting.

Signed-off-by: Juergen Fickel <juergen.fickel@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 6, 2020
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 6, 2020
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
DerSchwilk added a commit to bosch-io/ditto that referenced this issue Nov 6, 2020
Signed-off-by: David Schwilk <david.schwilk@bosch.io>
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 a pull request may close this issue.

1 participant