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

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

Open
fhirter opened this issue Aug 21, 2024 · 0 comments
Open

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

fhirter opened this issue Aug 21, 2024 · 0 comments

Comments

@fhirter
Copy link

fhirter commented Aug 21, 2024

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?

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

No branches or pull requests

1 participant