Note: as an initial step, investigate if there is already a source for these JSON schemas
Description
Similar to how React components have Typescript interfaces for props that extend the HTMLElement attributes, the JSON schemas should also extend the possible attributes that are passed to the element.
Requirements
The JSON schema should include:
data-* as additionalProperties
all potential aria attributes
all other inherent attributes to that element
Note: be sure to pay attention to extra JSON schema keywords that could prove useful, such as pattern, propertyNames.
These schemas should map to the TypeScript HTMLElement interface to line up more closely with the prop contract for components.
For information on JSON schemas here are a few good resources:
It's not necessary to use any of the extra additions we include for our components such as reactProperties and this schema can stick to the typical JSON schema format.
Currently we use Ajv as our validation package, do add a spec file named html-element.schema.spec.ts and include the Ajv lib as a devDependency with sufficient tests to ensure your schema is correctly checking for all appropriate properties.
Note: as an initial step, investigate if there is already a source for these JSON schemas
Description
Similar to how React components have Typescript interfaces for props that extend the HTMLElement attributes, the JSON schemas should also extend the possible attributes that are passed to the element.
Requirements
The JSON schema should include:
additionalProperties
Note: be sure to pay attention to extra JSON schema keywords that could prove useful, such as
pattern
,propertyNames
.These schemas should map to the TypeScript HTMLElement interface to line up more closely with the prop contract for components.
For information on JSON schemas here are a few good resources:
JSON schemas for HTML use should be placed in the
fast-web-utilities
package. The file name should behtml-element.schema.ts
and be in the same format as other*.ts
JSON schema exports, an example of which can be found here: https://github.com/microsoft/fast-dna/blob/master/packages/fast-components-react-base/src/checkbox/checkbox.schema.tsIt's not necessary to use any of the extra additions we include for our components such as
reactProperties
and this schema can stick to the typical JSON schema format.Currently we use Ajv as our validation package, do add a spec file named
html-element.schema.spec.ts
and include the Ajv lib as adevDependency
with sufficient tests to ensure your schema is correctly checking for all appropriate properties.