Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#32717 from chharvey/fix32249
Browse files Browse the repository at this point in the history
[json-schema] allow `$schema` property to be string
  • Loading branch information
PranavSenthilnathan authored Feb 1, 2019
2 parents fc95d6d + a9866c6 commit 1c372bb
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions types/json-schema/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,29 @@ export type JSONSchema4TypeName = 'string' | 'number' | 'integer' | 'boolean'
*/
export type JSONSchema4Type = any[] | boolean | number | null | object | string

/**
* Meta schema
*
* Recommended values:
* - 'http://json-schema.org/schema#'
* - 'http://json-schema.org/hyper-schema#'
* - 'http://json-schema.org/draft-04/schema#'
* - 'http://json-schema.org/draft-04/hyper-schema#'
* - 'http://json-schema.org/draft-03/schema#'
* - 'http://json-schema.org/draft-03/hyper-schema#'
*
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
*/
export type JSONSchema4Version = string;

/**
* JSON Schema V4
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
*/
export interface JSONSchema4 {
id?: string
$ref?: string
$schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#'
| 'http://json-schema.org/draft-04/schema#' | 'http://json-schema.org/draft-04/hyper-schema#'
| 'http://json-schema.org/draft-03/schema#' | 'http://json-schema.org/draft-03/hyper-schema#'
| string
$schema?: JSONSchema4Version

/**
* This attribute is a string that provides a short description of the
Expand Down Expand Up @@ -210,6 +222,19 @@ export type JSONSchema6TypeName = 'string' | 'number' | 'integer' | 'boolean' |

export type JSONSchema6Type = any[] | boolean | number | null | object | string

/**
* Meta schema
*
* Recommended values:
* - 'http://json-schema.org/schema#'
* - 'http://json-schema.org/hyper-schema#'
* - 'http://json-schema.org/draft-06/schema#'
* - 'http://json-schema.org/draft-06/hyper-schema#'
*
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
*/
export type JSONSchema6Version = string;

/**
* JSON Schema V6
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01
Expand All @@ -218,8 +243,7 @@ export type JSONSchema6Definition = JSONSchema6 | boolean;
export interface JSONSchema6 {
$id?: string
$ref?: string
$schema?: 'http://json-schema.org/schema#' | 'http://json-schema.org/hyper-schema#' |
'http://json-schema.org/draft-06/schema#' | 'http://json-schema.org/draft-06/hyper-schema#'
$schema?: JSONSchema6Version

/**
* Must be strictly greater than 0.
Expand Down Expand Up @@ -502,12 +526,16 @@ export interface JSONSchema7Array extends Array<JSONSchema7Type> {}

/**
* Meta schema
*
* Recommended values:
* - 'http://json-schema.org/schema#'
* - 'http://json-schema.org/hyper-schema#'
* - 'http://json-schema.org/draft-07/schema#'
* - 'http://json-schema.org/draft-07/hyper-schema#'
*
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
*/
export type JSONSchema7Version = 'http://json-schema.org/schema#'
| 'http://json-schema.org/hyper-schema#'
| 'http://json-schema.org/draft-07/schema#'
| 'http://json-schema.org/draft-07/hyper-schema#';
export type JSONSchema7Version = string;

/**
* JSON Schema v7
Expand Down

0 comments on commit 1c372bb

Please sign in to comment.