Skip to content

Commit

Permalink
Make the generated JSON Schema a little more pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
ddbeck committed Jul 26, 2024
1 parent 2bb0da7 commit bfaf30b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 68 deletions.
122 changes: 56 additions & 66 deletions schemas/data.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,62 @@
},
"by_compat_key": {
"additionalProperties": {
"$ref": "#/definitions/interface-types.ts-1307-1979-types.ts-0-2314"
"additionalProperties": false,
"properties": {
"baseline": {
"description": "Whether the feature is Baseline (low substatus), Baseline (high substatus), or not (false)",
"enum": [
"high",
"low",
false
],
"type": [
"string",
"boolean"
]
},
"baseline_high_date": {
"description": "Date the feature achieved Baseline high status",
"type": "string"
},
"baseline_low_date": {
"description": "Date the feature achieved Baseline low status",
"type": "string"
},
"support": {
"additionalProperties": false,
"description": "Browser versions that most-recently introduced the feature",
"properties": {
"chrome": {
"type": "string"
},
"chrome_android": {
"type": "string"
},
"edge": {
"type": "string"
},
"firefox": {
"type": "string"
},
"firefox_android": {
"type": "string"
},
"safari": {
"type": "string"
},
"safari_ios": {
"type": "string"
}
},
"type": "object"
}
},
"required": [
"baseline",
"support"
],
"type": "object"
},
"description": "Statuses for each key in the feature's compat_features list, if applicable. Not available to the npm release of web-features.",
"type": "object"
Expand Down Expand Up @@ -230,71 +285,6 @@
"snapshots"
],
"type": "object"
},
"interface-types.ts-1307-1979-types.ts-0-2314": {
"additionalProperties": false,
"properties": {
"baseline": {
"description": "Whether the feature is Baseline (low substatus), Baseline (high substatus), or not (false)",
"enum": [
"high",
"low",
false
],
"type": [
"string",
"boolean"
]
},
"baseline_high_date": {
"description": "Date the feature achieved Baseline high status",
"type": "string"
},
"baseline_low_date": {
"description": "Date the feature achieved Baseline low status",
"type": "string"
},
"by_compat_key": {
"additionalProperties": {
"$ref": "#/definitions/interface-types.ts-1307-1979-types.ts-0-2314"
},
"description": "Statuses for each key in the feature's compat_features list, if applicable. Not available to the npm release of web-features.",
"type": "object"
},
"support": {
"additionalProperties": false,
"description": "Browser versions that most-recently introduced the feature",
"properties": {
"chrome": {
"type": "string"
},
"chrome_android": {
"type": "string"
},
"edge": {
"type": "string"
},
"firefox": {
"type": "string"
},
"firefox_android": {
"type": "string"
},
"safari": {
"type": "string"
},
"safari_ios": {
"type": "string"
}
},
"type": "object"
}
},
"required": [
"baseline",
"support"
],
"type": "object"
}
}
}
7 changes: 5 additions & 2 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type browserIdentifier = "chrome" | "chrome_android" | "edge" | "firefox" | "fir

type BaselineHighLow = "high" | "low";

interface SupportStatus {
interface Status {
/** Whether the feature is Baseline (low substatus), Baseline (high substatus), or not (false) */
baseline: BaselineHighLow | false;
/** Date the feature achieved Baseline low status */
Expand All @@ -43,8 +43,11 @@ interface SupportStatus {
support: {
[K in browserIdentifier]?: string;
};
}

interface SupportStatus extends Status {
/** Statuses for each key in the feature's compat_features list, if applicable. Not available to the npm release of web-features. */
by_compat_key?: Record<string, SupportStatus>
by_compat_key?: Record<string, Status>
}

/** Specification URL
Expand Down

0 comments on commit bfaf30b

Please sign in to comment.