Skip to content

It is unclear where json-schema syntax can be used #24

Description

@fhirter

from the rules object of the example it is not clear where standard json-schema syntax can be used and library syntax is needed.

It seems that when, then, otherwise, is, actions are keywords from the library, while this oject in is is json-schema.

const rules = {
  dailyTemp: {
    when: [
      {
        weather: {
          params: {
            query: '{{city}}',
            appId: '{{apiKey}}',
            units: '{{units}}',
          },
          path: 'main.temp',
          is: {
            type: 'number',
            minimum: '{{hotTemp}}',
          },
        },
      },
    ],
    then: {
      actions: [
        {
          type: 'log',
          params: { message: 'Quite hot out today!' },
        },
      ],
    },
    otherwise: {
      actions: [
        {
          type: 'log',
          params: { message: 'Brrr, bundle up!' },
        },
      ],
    },
  },
};

If this is correct, a simple rule could be written as:

const rules = {
  simple: {
    when: [
      {
        weather: {},
          is: {
            type: 'object',
            properties {
               temp: {
                 type: 'number'
               }
            }
          },
        },
      },
    ],
}

Is this correct?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions