sketch-hq/sketch-document

Incorrect property existence validation for objects

raveclassic opened this issue · 1 comments

Hi,

Looks like current notation for property existence in objects is inconsistent with JSON Schema 7.

Document schema correctly defines pages property as required: https://github.com/sketch-hq/sketch-file-format/blob/d61c8a2e3d81ecfe0890d39e1a48f2add77801cb/schema/document.schema.yaml#L6-L7

However AbstractDocument schema uses a custom field optional: https://github.com/sketch-hq/sketch-file-format/blob/d61c8a2e3d81ecfe0890d39e1a48f2add77801cb/schema/abstract-document.schema.yaml#L2-L3 which is not supported directly by JSON Schema 7. Even more it's not use in the typescript codegen at all:
https://github.com/sketch-hq/sketch-file-format-ts/blob/00fe473753775917324f2f635e6f4bf9af700dc6/scripts/utils.ts#L48-L60

Is such behaviour intentional or am I missing something?

Ahhhh, I see https://github.com/sketch-hq/sketch-file-format#required-properties, so that's intentional. Ok, closing.