alexa-samples / alexa-smarthome

Resources for Alexa Smart Home developers.
https://alexa.design/smarthome
Other
687 stars 336 forks source link

Fixes for schema broken by commit 276150255d1843021dcd8b47809c0f79a6660517 #189

Closed pebender closed 8 months ago

pebender commented 2 years ago

Using git bisect, this is the first commit where the schema is broken according to both https://www.jsonschemavalidator.net and ajv (https://github.com/ajv-validator/ajv)

pebender commented 2 years ago

I have created 7 patches that make the schema validate against draft-04, draft-06, draft-07 and draft-2019-09. Since the schema is autogenerated and I don't have access to the generator, I decided patches were the best approach to convey what might need to change in the generator.

Patches 00, 01 and 02 fix bugs. Patch 03 removes exclusiveMinimum and exclusiveMaximum because they are doing nothing and fail against draft-05 and beyond. Patch 04 and 05 remove some unnecessary (04 and 05) and broken (05) OpenAPI extensions that are not part of any of the draft specifications. Patch 06 chances the schema version from draft-04 to draft-2019-09.

The patches can be found at https://github.com/pebender/alexa-for-lg-webos-tv/tree/main/src/common/smart-home-skill/alexa_smart_home_message_schema

aszk commented 1 year ago

Could you tell me what is the issue?

aszk commented 8 months ago

Closing due to inactivity.

pebender commented 5 months ago

The problem is that the generated JSON in alexa_smart_home_message_schema.json is broken. As I mentioned above in my first comment, it fails with two different validators. As a result of it not working with the AJV validator is that it cannot be use to easily validate discovery messages. The patches I referenced above are what I had to change to get it to work.