diff --git a/examples/docs/complex-properties-reflocalfiledef-properties-third-property.md b/examples/docs/complex-properties-reflocalfiledef-properties-third-property.md new file mode 100644 index 00000000..991d4381 --- /dev/null +++ b/examples/docs/complex-properties-reflocalfiledef-properties-third-property.md @@ -0,0 +1,44 @@ +# Third property Schema + +```txt +https://example.com/schemas/complex#/properties/reflocalfiledef/properties/third +``` + + + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ------------ | :---------------- | --------------------- | ------------------- | ---------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | [complex.schema.json\*](../generated-schemas/complex.schema.json "open original schema") | + +## third Type + +unknown ([Third property](complex-properties-reflocalfiledef-properties-third-property.md)) + +# Third property Properties + +| Property | Type | Required | Nullable | Defined by | +| :---------- | -------- | -------- | -------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | +| [baz](#baz) | `string` | Optional | cannot be null | [Extending](extending-definitions-third-property-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") | + +## baz + +This property has a unique name to demonstrate it's uniqueness. + + +`baz` + +- is optional +- Type: `string` ([BAAAZ!](extending-definitions-third-property-properties-baaaz.md)) +- cannot be null +- defined in: [Extending](extending-definitions-third-property-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") + +### baz Type + +`string` ([BAAAZ!](extending-definitions-third-property-properties-baaaz.md)) + +### baz Examples + +```json +"I'm just a humble example" +``` diff --git a/examples/docs/complex-properties-reflocalfiledef-properties-third.md b/examples/docs/complex-properties-reflocalfiledef-properties-third.md new file mode 100644 index 00000000..494ba6a7 --- /dev/null +++ b/examples/docs/complex-properties-reflocalfiledef-properties-third.md @@ -0,0 +1,44 @@ +# Untitled undefined type in Complex References Schema + +```txt +https://example.com/schemas/complex#/properties/reflocalfiledef/properties/third +``` + + + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ------------ | :---------------- | --------------------- | ------------------- | ---------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | [complex.schema.json\*](../generated-schemas/complex.schema.json "open original schema") | + +## third Type + +unknown + +# undefined Properties + +| Property | Type | Required | Nullable | Defined by | +| :---------- | -------- | -------- | -------------- | :------------------------------------------------------------------------------------------------------------------------------------------ | +| [baz](#baz) | `string` | Optional | cannot be null | [Extending](extending-definitions-third-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") | + +## baz + +This property has a unique name to demonstrate it's uniqueness. + + +`baz` + +- is optional +- Type: `string` ([BAAAZ!](extending-definitions-third-properties-baaaz.md)) +- cannot be null +- defined in: [Extending](extending-definitions-third-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") + +### baz Type + +`string` ([BAAAZ!](extending-definitions-third-properties-baaaz.md)) + +### baz Examples + +```json +"I'm just a humble example" +``` diff --git a/examples/docs/complex-properties-reflocalfiledef-properties.md b/examples/docs/complex-properties-reflocalfiledef-properties.md new file mode 100644 index 00000000..1e11cb24 --- /dev/null +++ b/examples/docs/complex-properties-reflocalfiledef-properties.md @@ -0,0 +1,16 @@ +# Untitled undefined type in Complex References Schema + +```txt +https://example.com/schemas/complex#/properties/reflocalfiledef/properties +``` + + + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | ---------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [complex.schema.json\*](../generated-schemas/complex.schema.json "open original schema") | + +## properties Type + +unknown diff --git a/examples/docs/complex-properties-reflocalfiledef.md b/examples/docs/complex-properties-reflocalfiledef.md new file mode 100644 index 00000000..3ddd3f71 --- /dev/null +++ b/examples/docs/complex-properties-reflocalfiledef.md @@ -0,0 +1,38 @@ +# Untitled object in Complex References Schema + +```txt +https://example.com/schemas/complex#/properties/reflocalfiledef +``` + + + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ------------ | :---------------- | --------------------- | ------------------- | ---------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | [complex.schema.json\*](../generated-schemas/complex.schema.json "open original schema") | + +## reflocalfiledef Type + +`object` ([Details](complex-properties-reflocalfiledef.md)) + +# undefined Properties + +| Property | Type | Required | Nullable | Defined by | +| :-------------- | -------- | -------- | -------------- | :------------------------------------------------------------------------------------------------------------------------------------------- | +| [third](#third) | `object` | Optional | cannot be null | [Complex References](extending-definitions-third.md "https://example.com/schemas/complex#/properties/reflocalfiledef/properties/third") | + +## third + + + + +`third` + +- is optional +- Type: `object` ([Details](extending-definitions-third.md)) +- cannot be null +- defined in: [Complex References](extending-definitions-third.md "https://example.com/schemas/complex#/properties/reflocalfiledef/properties/third") + +### third Type + +`object` ([Details](extending-definitions-third.md)) diff --git a/examples/docs/complex-properties-refnestedobj-properties-refobj.md b/examples/docs/complex-properties-refnestedobj-properties-refobj.md index bbefca57..3c42fda9 100644 --- a/examples/docs/complex-properties-refnestedobj-properties-refobj.md +++ b/examples/docs/complex-properties-refnestedobj-properties-refobj.md @@ -17,9 +17,9 @@ https://example.com/schemas/complex#/properties/refnestedobj/properties/refobj # undefined Properties -| Property | Type | Required | Nullable | Defined by | -| :---------- | -------- | -------- | -------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [foo](#foo) | `object` | Optional | cannot be null | [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refnestedobj/properties/refobj/properties/foo") | +| Property | Type | Required | Nullable | Defined by | +| :---------- | -------- | -------- | -------------- | :---------------------------------------------------------------------------------------------------------------------------------- | +| [foo](#foo) | `object` | Optional | cannot be null | [Complex References](simple.md "https://example.com/schemas/simple#/properties/refnestedobj/properties/refobj/properties/foo") | ## foo @@ -29,10 +29,10 @@ This is a _very_ simple example of a JSON schema. There is only one property. `foo` - is optional -- Type: `object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +- Type: `object` ([Simple](simple.md)) - cannot be null -- defined in: [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refnestedobj/properties/refobj/properties/foo") +- defined in: [Complex References](simple.md "https://example.com/schemas/simple#/properties/refnestedobj/properties/refobj/properties/foo") ### foo Type -`object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +`object` ([Simple](simple.md)) diff --git a/examples/docs/complex-properties-refobj.md b/examples/docs/complex-properties-refobj.md index 0a2471b6..0616db4d 100644 --- a/examples/docs/complex-properties-refobj.md +++ b/examples/docs/complex-properties-refobj.md @@ -17,9 +17,9 @@ https://example.com/schemas/complex#/properties/refobj # undefined Properties -| Property | Type | Required | Nullable | Defined by | -| :---------- | -------- | -------- | -------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [foo](#foo) | `object` | Optional | cannot be null | [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refobj/properties/foo") | +| Property | Type | Required | Nullable | Defined by | +| :---------- | -------- | -------- | -------------- | :---------------------------------------------------------------------------------------------------------- | +| [foo](#foo) | `object` | Optional | cannot be null | [Complex References](simple.md "https://example.com/schemas/simple#/properties/refobj/properties/foo") | ## foo @@ -29,10 +29,10 @@ This is a _very_ simple example of a JSON schema. There is only one property. `foo` - is optional -- Type: `object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +- Type: `object` ([Simple](simple.md)) - cannot be null -- defined in: [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refobj/properties/foo") +- defined in: [Complex References](simple.md "https://example.com/schemas/simple#/properties/refobj/properties/foo") ### foo Type -`object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +`object` ([Simple](simple.md)) diff --git a/examples/docs/complex-properties-simple.md b/examples/docs/complex-properties-simple.md new file mode 100644 index 00000000..f1e28908 --- /dev/null +++ b/examples/docs/complex-properties-simple.md @@ -0,0 +1,42 @@ +# Simple Schema + +```txt +https://example.com/schemas/simple#/properties/refnamed +``` + +This is a _very_ simple example of a JSON schema. There is only one property. + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ------------ | :---------------- | --------------------- | ------------------- | ---------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | [complex.schema.json\*](../generated-schemas/complex.schema.json "open original schema") | + +## refnamed Type + +`object` ([Simple](complex-properties-simple.md)) + +# Simple Properties + +| Property | Type | Required | Nullable | Defined by | +| :-------- | -------- | -------- | -------------- | :----------------------------------------------------------------------------------------- | +| [id](#id) | `string` | Optional | cannot be null | [Simple](simple-properties-id.md "https://example.com/schemas/simple#/properties/id") | + +## id + +A unique identifier given to every addressable thing. + + +`id` + +- is optional +- Type: `string` +- cannot be null +- defined in: [Simple](simple-properties-id.md "https://example.com/schemas/simple#/properties/id") + +### id Type + +`string` + +### id Constraints + +**URI**: the string must be a URI, according to [RFC 3986](https://tools.ietf.org/html/rfc3986 "check the specification") diff --git a/examples/docs/complex.md b/examples/docs/complex.md index bf4ccaf4..cb0e7e37 100644 --- a/examples/docs/complex.md +++ b/examples/docs/complex.md @@ -17,19 +17,21 @@ This is an example schema that uses types defined in other schemas. # Complex References Properties -| Property | Type | Required | Nullable | Defined by | -| :---------------------------- | --------- | -------- | -------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [refabstract](#refabstract) | `object` | Required | cannot be null | [Complex References](abstract-definitions-first.md "https://example.com/schemas/complex#/properties/refabstract") | -| [refnamed](#refnamed) | `object` | Optional | cannot be null | [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refnamed") | -| [refrefed](#refrefed) | `object` | Optional | cannot be null | [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refrefed") | -| [refobj](#refobj) | `object` | Optional | cannot be null | [Complex References](complex-properties-refobj.md "https://example.com/schemas/complex#/properties/refobj") | -| [refnestedobj](#refnestedobj) | `object` | Optional | cannot be null | [Complex References](complex-properties-refnestedobj.md "https://example.com/schemas/complex#/properties/refnestedobj") | -| [or](#or) | Merged | Optional | cannot be null | [Complex References](complex-properties-or.md "https://example.com/schemas/complex#/properties/or") | -| [and](#and) | Merged | Optional | cannot be null | [Complex References](complex-properties-and.md "https://example.com/schemas/complex#/properties/and") | -| [xor](#xor) | Merged | Optional | cannot be null | [Complex References](complex-properties-xor.md "https://example.com/schemas/complex#/properties/xor") | -| `int.*` | `integer` | Optional | cannot be null | [Complex References](complex-patternproperties-int.md "https://example.com/schemas/complex#/patternProperties/int.\*") | -| `str.*` | `string` | Optional | cannot be null | [Complex References](complex-patternproperties-str.md "https://example.com/schemas/complex#/patternProperties/str.\*") | -| Additional Properties | `boolean` | Optional | cannot be null | [Complex References](complex-additionalproperties.md "https://example.com/schemas/complex#/additionalProperties") | +| Property | Type | Required | Nullable | Defined by | +| :---------------------------------- | --------- | -------- | -------------- | :--------------------------------------------------------------------------------------------------------------------------------- | +| [refabstract](#refabstract) | `object` | Required | cannot be null | [Complex References](abstract-definitions-first.md "https://example.com/schemas/complex#/properties/refabstract") | +| [refnamed](#refnamed) | `object` | Optional | cannot be null | [Complex References](complex-properties-simple.md "https://example.com/schemas/simple#/properties/refnamed") | +| [refrefed](#refrefed) | `object` | Optional | cannot be null | [Complex References](complex-properties-simple.md "https://example.com/schemas/simple#/properties/refrefed") | +| [refobj](#refobj) | `object` | Optional | cannot be null | [Complex References](complex-properties-refobj.md "https://example.com/schemas/complex#/properties/refobj") | +| [refnestedobj](#refnestedobj) | `object` | Optional | cannot be null | [Complex References](complex-properties-refnestedobj.md "https://example.com/schemas/complex#/properties/refnestedobj") | +| [reflocalfile](#reflocalfile) | `object` | Optional | cannot be null | [Complex References](simple.md "https://example.com/schemas/simple#/properties/reflocalfile") | +| [reflocalfiledef](#reflocalfiledef) | `object` | Optional | cannot be null | [Complex References](complex-properties-reflocalfiledef.md "https://example.com/schemas/complex#/properties/reflocalfiledef") | +| [or](#or) | Merged | Optional | cannot be null | [Complex References](complex-properties-or.md "https://example.com/schemas/complex#/properties/or") | +| [and](#and) | Merged | Optional | cannot be null | [Complex References](complex-properties-and.md "https://example.com/schemas/complex#/properties/and") | +| [xor](#xor) | Merged | Optional | cannot be null | [Complex References](complex-properties-xor.md "https://example.com/schemas/complex#/properties/xor") | +| `int.*` | `integer` | Optional | cannot be null | [Complex References](complex-patternproperties-int.md "https://example.com/schemas/complex#/patternProperties/int.\*") | +| `str.*` | `string` | Optional | cannot be null | [Complex References](complex-patternproperties-str.md "https://example.com/schemas/complex#/patternProperties/str.\*") | +| Additional Properties | `boolean` | Optional | cannot be null | [Complex References](complex-additionalproperties.md "https://example.com/schemas/complex#/additionalProperties") | ## refabstract @@ -55,13 +57,13 @@ This is a _very_ simple example of a JSON schema. There is only one property. `refnamed` - is optional -- Type: `object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +- Type: `object` ([Simple](simple.md)) - cannot be null -- defined in: [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refnamed") +- defined in: [Complex References](simple.md "https://example.com/schemas/simple#/properties/refnamed") ### refnamed Type -`object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +`object` ([Simple](simple.md)) ## refrefed @@ -71,13 +73,13 @@ This is a _very_ simple example of a JSON schema. There is only one property. `refrefed` - is optional -- Type: `object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +- Type: `object` ([Simple](simple.md)) - cannot be null -- defined in: [Complex References](complex-properties-refnestedobj-properties-refobj-properties-simple.md "https://example.com/schemas/simple#/properties/refrefed") +- defined in: [Complex References](simple.md "https://example.com/schemas/simple#/properties/refrefed") ### refrefed Type -`object` ([Simple](complex-properties-refnestedobj-properties-refobj-properties-simple.md)) +`object` ([Simple](simple.md)) ## refobj @@ -111,6 +113,38 @@ This is a _very_ simple example of a JSON schema. There is only one property. `object` ([Details](complex-properties-refnestedobj.md)) +## reflocalfile + +This is a _very_ simple example of a JSON schema. There is only one property. + + +`reflocalfile` + +- is optional +- Type: `object` ([Simple](simple.md)) +- cannot be null +- defined in: [Complex References](simple.md "https://example.com/schemas/simple#/properties/reflocalfile") + +### reflocalfile Type + +`object` ([Simple](simple.md)) + +## reflocalfiledef + + + + +`reflocalfiledef` + +- is optional +- Type: `object` ([Details](complex-properties-reflocalfiledef.md)) +- cannot be null +- defined in: [Complex References](complex-properties-reflocalfiledef.md "https://example.com/schemas/complex#/properties/reflocalfiledef") + +### reflocalfiledef Type + +`object` ([Details](complex-properties-reflocalfiledef.md)) + ## or String or number… diff --git a/examples/docs/extending-definitions-third-properties-baaaz.md b/examples/docs/extending-definitions-third-properties-baaaz.md new file mode 100644 index 00000000..924a8c93 --- /dev/null +++ b/examples/docs/extending-definitions-third-properties-baaaz.md @@ -0,0 +1,22 @@ +# BAAAZ! Schema + +```txt +https://example.com/schemas/extending#/definitions/third/properties/baz +``` + +This property has a unique name to demonstrate it's uniqueness. + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | -------------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [extending.schema.json\*](../generated-schemas/extending.schema.json "open original schema") | + +## baz Type + +`string` ([BAAAZ!](extending-definitions-third-properties-baaaz.md)) + +## baz Examples + +```json +"I'm just a humble example" +``` diff --git a/examples/docs/extending-definitions-third-properties.md b/examples/docs/extending-definitions-third-properties.md new file mode 100644 index 00000000..ef6facad --- /dev/null +++ b/examples/docs/extending-definitions-third-properties.md @@ -0,0 +1,16 @@ +# Untitled undefined type in Extending Schema + +```txt +https://example.com/schemas/extending#/definitions/third/properties +``` + + + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | -------------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [extending.schema.json\*](../generated-schemas/extending.schema.json "open original schema") | + +## properties Type + +unknown diff --git a/examples/docs/extending-definitions-third-property-properties-baaaz.md b/examples/docs/extending-definitions-third-property-properties-baaaz.md new file mode 100644 index 00000000..90575df6 --- /dev/null +++ b/examples/docs/extending-definitions-third-property-properties-baaaz.md @@ -0,0 +1,22 @@ +# BAAAZ! Schema + +```txt +https://example.com/schemas/extending#/definitions/third/properties/baz +``` + +This property has a unique name to demonstrate it's uniqueness. + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | -------------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [extending.schema.json\*](../generated-schemas/extending.schema.json "open original schema") | + +## baz Type + +`string` ([BAAAZ!](extending-definitions-third-property-properties-baaaz.md)) + +## baz Examples + +```json +"I'm just a humble example" +``` diff --git a/examples/docs/extending-definitions-third-property-properties.md b/examples/docs/extending-definitions-third-property-properties.md new file mode 100644 index 00000000..ef6facad --- /dev/null +++ b/examples/docs/extending-definitions-third-property-properties.md @@ -0,0 +1,16 @@ +# Untitled undefined type in Extending Schema + +```txt +https://example.com/schemas/extending#/definitions/third/properties +``` + + + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ----------------------- | :---------------- | --------------------- | ------------------- | -------------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | Unknown identifiability | Forbidden | Allowed | none | [extending.schema.json\*](../generated-schemas/extending.schema.json "open original schema") | + +## properties Type + +unknown diff --git a/examples/docs/extending-definitions-third-property.md b/examples/docs/extending-definitions-third-property.md new file mode 100644 index 00000000..2e88b349 --- /dev/null +++ b/examples/docs/extending-definitions-third-property.md @@ -0,0 +1,44 @@ +# Third property Schema + +```txt +https://example.com/schemas/extending#/allOf/2 +``` + + + + +| Abstract | Extensible | Status | Identifiable | Custom Properties | Additional Properties | Access Restrictions | Defined In | +| :------------------ | ---------- | -------------- | ------------ | :---------------- | --------------------- | ------------------- | -------------------------------------------------------------------------------------------- | +| Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | [extending.schema.json\*](../generated-schemas/extending.schema.json "open original schema") | + +## 2 Type + +unknown ([Third property](extending-definitions-third-property.md)) + +# Third property Properties + +| Property | Type | Required | Nullable | Defined by | +| :---------- | -------- | -------- | -------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | +| [baz](#baz) | `string` | Optional | cannot be null | [Extending](extending-definitions-third-property-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") | + +## baz + +This property has a unique name to demonstrate it's uniqueness. + + +`baz` + +- is optional +- Type: `string` ([BAAAZ!](extending-definitions-third-property-properties-baaaz.md)) +- cannot be null +- defined in: [Extending](extending-definitions-third-property-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") + +### baz Type + +`string` ([BAAAZ!](extending-definitions-third-property-properties-baaaz.md)) + +### baz Examples + +```json +"I'm just a humble example" +``` diff --git a/examples/docs/extending-definitions-third.md b/examples/docs/extending-definitions-third.md index 6445160a..a5f3fce4 100644 --- a/examples/docs/extending-definitions-third.md +++ b/examples/docs/extending-definitions-third.md @@ -1,7 +1,7 @@ -# Untitled undefined type in Extending Schema +# Untitled object in Extending Schema ```txt -https://example.com/schemas/extending#/definitions/third +https://example.com/schemas/extending#/allOf/2 ``` @@ -11,15 +11,15 @@ https://example.com/schemas/extending#/definitions/third | :------------------ | ---------- | -------------- | ------------ | :---------------- | --------------------- | ------------------- | -------------------------------------------------------------------------------------------- | | Can be instantiated | No | Unknown status | No | Forbidden | Allowed | none | [extending.schema.json\*](../generated-schemas/extending.schema.json "open original schema") | -## third Type +## 2 Type -unknown +`object` ([Details](extending-definitions-third.md)) # undefined Properties -| Property | Type | Required | Nullable | Defined by | -| :---------- | -------- | -------- | -------------- | :------------------------------------------------------------------------------------------------------------------------------------ | -| [baz](#baz) | `string` | Optional | cannot be null | [Extending](deepextending-allof-2-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") | +| Property | Type | Required | Nullable | Defined by | +| :---------- | -------- | -------- | -------------- | :------------------------------------------------------------------------------------------------------------------------------------------ | +| [baz](#baz) | `string` | Optional | cannot be null | [Extending](extending-definitions-third-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") | ## baz @@ -29,13 +29,13 @@ This property has a unique name to demonstrate it's uniqueness. `baz` - is optional -- Type: `string` ([BAAAZ!](deepextending-allof-2-properties-baaaz.md)) +- Type: `string` ([BAAAZ!](extending-definitions-third-properties-baaaz.md)) - cannot be null -- defined in: [Extending](deepextending-allof-2-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") +- defined in: [Extending](extending-definitions-third-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") ### baz Type -`string` ([BAAAZ!](deepextending-allof-2-properties-baaaz.md)) +`string` ([BAAAZ!](extending-definitions-third-properties-baaaz.md)) ### baz Examples diff --git a/examples/docs/extending.md b/examples/docs/extending.md index 3668e72f..c50e5970 100644 --- a/examples/docs/extending.md +++ b/examples/docs/extending.md @@ -17,9 +17,9 @@ This is an extending schema. It pulls `definitions` from other schemas. all of -- [Untitled undefined type in Extending](extending-allof-0.md "check type definition") -- [Untitled undefined type in Extending](definitions-definitions-myid.md "check type definition") -- [Untitled undefined type in Extending](extending-allof-2.md "check type definition") +- [Untitled undefined type in Extending](extensible-definitions-second.md "check type definition") +- [MyID](definitions-definitions-myid.md "check type definition") +- [Untitled object in Extending](extending-definitions-third.md "check type definition") # Extending Definitions @@ -31,9 +31,9 @@ Reference this group by using {"$ref":"https://example.com/schemas/extending#/definitions/third"} ``` -| Property | Type | Required | Nullable | Defined by | -| :---------- | -------- | -------- | -------------- | :------------------------------------------------------------------------------------------------------------------------------------ | -| [baz](#baz) | `string` | Optional | cannot be null | [Extending](deepextending-allof-2-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") | +| Property | Type | Required | Nullable | Defined by | +| :---------- | -------- | -------- | -------------- | :------------------------------------------------------------------------------------------------------------------------------------------ | +| [baz](#baz) | `string` | Optional | cannot be null | [Extending](extending-definitions-third-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") | ### baz @@ -43,13 +43,13 @@ This property has a unique name to demonstrate it's uniqueness. `baz` - is optional -- Type: `string` ([BAAAZ!](deepextending-allof-2-properties-baaaz.md)) +- Type: `string` ([BAAAZ!](extending-definitions-third-properties-baaaz.md)) - cannot be null -- defined in: [Extending](deepextending-allof-2-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") +- defined in: [Extending](extending-definitions-third-properties-baaaz.md "https://example.com/schemas/extending#/definitions/third/properties/baz") #### baz Type -`string` ([BAAAZ!](deepextending-allof-2-properties-baaaz.md)) +`string` ([BAAAZ!](extending-definitions-third-properties-baaaz.md)) #### baz Examples diff --git a/examples/generated-schemas/complex.schema.json b/examples/generated-schemas/complex.schema.json index 1a518f1b..2e426c6d 100644 --- a/examples/generated-schemas/complex.schema.json +++ b/examples/generated-schemas/complex.schema.json @@ -1 +1 @@ -{"meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/complex","title":"Complex References","type":"object","description":"This is an example schema that uses types defined in other schemas.","properties":{"refabstract":{"$ref":"https://example.com/schemas/abstract#/definitions/first","version":"1.0.0","testProperty":"test","type":"object","properties":{"foo":{"type":"string","description":"A unique identifier given to every addressable thing.","version":"1.0.0","testProperty":"test"},"nonfoo":{"type":"boolean","const":false,"description":"This is not foo.","version":"1.0.0","testProperty":"test"}}},"refnamed":{"$ref":"https://example.com/schemas/simple","version":"1.0.0","testProperty":"test","meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/simple","title":"Simple","description":"This is a *very* simple example of a JSON schema. There is only one property.","type":"object","properties":{"id":{"type":"string","format":"uri","description":"A unique identifier given to every addressable thing.","version":"1.0.0","testProperty":"test"}}},"refrefed":{"$ref":"https://example.com/schemas/simple","version":"1.0.0","testProperty":"test","meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/simple","title":"Simple","description":"This is a *very* simple example of a JSON schema. There is only one property.","type":"object","properties":{"id":{"type":"string","format":"uri","description":"A unique identifier given to every addressable thing.","version":"1.0.0","testProperty":"test"}}},"refobj":{"type":"object","properties":{"foo":{"$ref":"https://example.com/schemas/simple","version":"1.0.0","testProperty":"test","meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/simple","title":"Simple","description":"This is a *very* simple example of a JSON schema. There is only one property.","type":"object","properties":{"id":{"type":"string","format":"uri","description":"A unique identifier given to every addressable thing.","version":"1.0.0","testProperty":"test"}}}},"version":"1.0.0","testProperty":"test"},"refnestedobj":{"type":"object","properties":{"refobj":{"type":"object","version":"1.0.0","testProperty":"test","properties":{"foo":{"$ref":"https://example.com/schemas/simple","version":"1.0.0","testProperty":"test","meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/simple","title":"Simple","description":"This is a *very* simple example of a JSON schema. There is only one property.","type":"object","properties":{"id":{"type":"string","format":"uri","description":"A unique identifier given to every addressable thing.","version":"1.0.0","testProperty":"test"}}}}}},"version":"1.0.0","testProperty":"test"},"or":{"description":"String or number…","anyOf":[{"type":"string"},{"type":"number","minimum":0}],"version":"1.0.0","testProperty":"test"},"and":{"description":"Number in a range","allOf":[{"type":"number","maximum":10},{"type":"number","minimum":0}],"version":"1.0.0","testProperty":"test"},"xor":{"description":"Exclusive choice.","oneOf":[{"type":"number","maximum":0},{"type":"number","minimum":10}],"version":"1.0.0","testProperty":"test"}},"required":["refabstract"],"additionalProperties":{"type":"boolean"},"patternProperties":{"int.*":{"type":"integer","version":"1.0.0","testProperty":"test"},"str.*":{"type":"string","version":"1.0.0","testProperty":"test"}}} +{"meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/complex","title":"Complex References","type":"object","description":"This is an example schema that uses types defined in other schemas.","properties":{"refabstract":{"$ref":"https://example.com/schemas/abstract#/definitions/first","version":"1.0.0","testProperty":"test"},"refnamed":{"$ref":"https://example.com/schemas/simple","version":"1.0.0","testProperty":"test"},"refrefed":{"$ref":"#/properties/refnamed","version":"1.0.0","testProperty":"test"},"refobj":{"type":"object","properties":{"foo":{"$ref":"https://example.com/schemas/simple","version":"1.0.0","testProperty":"test"}},"version":"1.0.0","testProperty":"test"},"refnestedobj":{"type":"object","properties":{"refobj":{"type":"object","version":"1.0.0","testProperty":"test","properties":{"foo":{"$ref":"https://example.com/schemas/simple","version":"1.0.0","testProperty":"test"}}}},"version":"1.0.0","testProperty":"test"},"reflocalfile":{"$ref":"simple.schema.json#","version":"1.0.0","testProperty":"test"},"reflocalfiledef":{"type":"object","version":"1.0.0","testProperty":"test","properties":{"third":{"$ref":"file://extending.schema.json#/definitions/third","version":"1.0.0","testProperty":"test"}}},"or":{"description":"String or number…","anyOf":[{"type":"string"},{"type":"number","minimum":0}],"version":"1.0.0","testProperty":"test"},"and":{"description":"Number in a range","allOf":[{"type":"number","maximum":10},{"type":"number","minimum":0}],"version":"1.0.0","testProperty":"test"},"xor":{"description":"Exclusive choice.","oneOf":[{"type":"number","maximum":0},{"type":"number","minimum":10}],"version":"1.0.0","testProperty":"test"}},"required":["refabstract"],"additionalProperties":{"type":"boolean"},"patternProperties":{"int.*":{"type":"integer","version":"1.0.0","testProperty":"test"},"str.*":{"type":"string","version":"1.0.0","testProperty":"test"}}} diff --git a/examples/generated-schemas/extending.schema.json b/examples/generated-schemas/extending.schema.json index 6fc62c5a..e410a584 100644 --- a/examples/generated-schemas/extending.schema.json +++ b/examples/generated-schemas/extending.schema.json @@ -1 +1 @@ -{"meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/extending","title":"Extending","description":"This is an extending schema. It pulls `definitions` from other schemas.","type":"object","meta:extensible":true,"meta:extends":["https://example.com/schemas/definitions","https://example.com/schemas/extensible"],"definitions":{"third":{"properties":{"baz":{"type":"string","title":"BAAAZ!","examples":["I'm just a humble example"],"description":"This property has a unique name to demonstrate it's uniqueness.","version":"1.0.0","testProperty":"test"}}}},"allOf":[{"$ref":"https://example.com/schemas/extensible#/definitions/second","properties":{"bar":{"type":"string","examples":["whoo","hoo"],"description":"A horse walks into it.","version":"1.0.0","testProperty":"test"}}},{"$ref":"https://example.com/schemas/definitions#/definitions/myid","properties":{"id":{"type":"string","format":"uri-reference","description":"A unique identifier given to every addressable thing.","version":"1.0.0","testProperty":"test"},"@id":{"type":"string","format":"uri","description":"An `id` with an `@` in front of it. The `@` stands for \"dot com\"","version":"1.0.0","testProperty":"test"},"meta:id":{"type":"string","format":"email","description":"An about ids. It is meta. If you are confused, send an email to the address specified in this property value.","version":"1.0.0","testProperty":"test"}},"required":["@id"]},{"$ref":"#/definitions/third","properties":{"baz":{"type":"string","title":"BAAAZ!","examples":["I'm just a humble example"],"description":"This property has a unique name to demonstrate it's uniqueness.","version":"1.0.0","testProperty":"test"}}}]} +{"meta:license":["Copyright 2017 Adobe Systems Incorporated. All rights reserved.","This file is licensed to you under the Apache License, Version 2.0 (the 'License');","you may not use this file except in compliance with the License. You may obtain a copy","of the License at http://www.apache.org/licenses/LICENSE-2.0"],"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://example.com/schemas/extending","title":"Extending","description":"This is an extending schema. It pulls `definitions` from other schemas.","type":"object","meta:extensible":true,"meta:extends":["https://example.com/schemas/definitions","https://example.com/schemas/extensible"],"definitions":{"third":{"type":"object","properties":{"baz":{"type":"string","title":"BAAAZ!","examples":["I'm just a humble example"],"description":"This property has a unique name to demonstrate it's uniqueness.","version":"1.0.0","testProperty":"test"}}}},"allOf":[{"$ref":"https://example.com/schemas/extensible#/definitions/second"},{"$ref":"https://example.com/schemas/definitions#/definitions/myid"},{"$ref":"#/definitions/third"}]} diff --git a/examples/schemas/complex.schema.json b/examples/schemas/complex.schema.json index cd8de566..fa4aae4c 100644 --- a/examples/schemas/complex.schema.json +++ b/examples/schemas/complex.schema.json @@ -57,6 +57,23 @@ "version": "1.0.0", "testProperty": "test" }, + "reflocalfile": { + "$ref": "simple.schema.json#", + "version": "1.0.0", + "testProperty": "test" + }, + "reflocalfiledef": { + "type": "object", + "version": "1.0.0", + "testProperty": "test", + "properties": { + "third": { + "$ref": "file://extending.schema.json#/definitions/third", + "version": "1.0.0", + "testProperty": "test" + } + } + }, "or": { "description": "String or number…", "anyOf": [ diff --git a/examples/schemas/extending.schema.json b/examples/schemas/extending.schema.json index e5d2fb6f..198b2714 100644 --- a/examples/schemas/extending.schema.json +++ b/examples/schemas/extending.schema.json @@ -17,6 +17,7 @@ ], "definitions": { "third": { + "type": "object", "properties": { "baz": { "type": "string", diff --git a/lib/schemaProxy.js b/lib/schemaProxy.js index c9d64989..2317cc7c 100644 --- a/lib/schemaProxy.js +++ b/lib/schemaProxy.js @@ -10,7 +10,8 @@ * governing permissions and limitations under the License. */ const ghslugger = require('github-slugger'); -const { basename, dirname, resolve } = require('path'); +const path = require('path'); +const { URL } = require('url'); const { formatmeta } = require('./formatInfo'); const symbols = require('./symbols'); const { keyword } = require('./keywords'); @@ -18,7 +19,7 @@ const { keyword } = require('./keywords'); const myslug = Symbol('myslug'); function loadExamples(file, num = 1) { - const examplefile = resolve(dirname(file), basename(file).replace(/\..*$/, `.example.${num}.json`)); + const examplefile = path.resolve(path.dirname(file), path.basename(file).replace(/\..*$/, `.example.${num}.json`)); try { // eslint-disable-next-line import/no-dynamic-require, global-require const example = require(examplefile); @@ -60,12 +61,12 @@ const handler = ({ return []; }; - meta[symbols.resolve] = (target, prop, receiver) => (path) => { - // console.log('trying to resolve', path, 'in', receiver[symbols.filename]); - if (path === undefined) { + meta[symbols.resolve] = (target, prop, receiver) => (proppath) => { + // console.log('trying to resolve', proppath, 'in', receiver[symbols.filename]); + if (proppath === undefined) { return receiver; } - const [head, ...tail] = typeof path === 'string' ? path.split('/') : path; + const [head, ...tail] = typeof proppath === 'string' ? proppath.split('/') : proppath; if ((head === '' || head === undefined) && tail.length === 0) { return receiver; } else if (head === '' || head === undefined) { @@ -77,7 +78,7 @@ const handler = ({ meta[symbols.slug] = (target, prop, receiver) => { if (!receiver[myslug] && !parent && receiver[symbols.filename]) { // eslint-disable-next-line no-param-reassign - receiver[myslug] = slugger.slug(basename(receiver[symbols.filename]).replace(/\..*$/, '')); + receiver[myslug] = slugger.slug(path.basename(receiver[symbols.filename]).replace(/\..*$/, '')); } if (!receiver[myslug]) { const parentslug = parent[symbols.slug]; @@ -113,8 +114,38 @@ const handler = ({ const [uri, pointer] = retval.$ref.split('#'); // console.log('resolving ref', uri, pointer, 'from', receiver[symbols.filename]); const basedoc = uri || receiver[symbols.id]; + let referenced = null; + + // $ref is a URI-reference so basedoc might be an id URI or it might be a path + if (schemas.known[basedoc]) { - const referenced = schemas.known[basedoc][symbols.resolve](pointer); + referenced = schemas.known[basedoc][symbols.resolve](pointer); + } else if (path.parse(basedoc)) { + const basepath = path.dirname(meta[symbols.filename]()); + let reldoc = uri; + + // if uri is a URI then only try to resolve it locally if the scheme is 'file:' + try { + const urlinfo = new URL(uri); + if (urlinfo.protocol === 'file:') { + reldoc = uri.replace(/^file:\/\//, ''); + } else { + reldoc = null; + } + } catch (err) { + // console.log('Error parsing URL - ' + uri); + } + + if (reldoc) { + const refpath = path.resolve(basepath, reldoc); + + if (schemas.files[refpath]) { + referenced = schemas.files[refpath][symbols.resolve](pointer); + } + } + } + + if (referenced !== null) { // inject the referenced schema into the current schema Object.assign(retval, referenced); } else { @@ -154,6 +185,7 @@ module.exports.loader = () => { const schemas = { loaded: [], known: {}, + files: {}, }; const slugger = ghslugger(); @@ -166,6 +198,9 @@ module.exports.loader = () => { // stow away the schema for lookup schemas.known[proxied[keyword`$id`]] = proxied; } + + schemas.files[filename] = proxied; + return proxied; }; }; diff --git a/test/schemaProxy.test.js b/test/schemaProxy.test.js index 1cd380e4..7bfd2853 100644 --- a/test/schemaProxy.test.js +++ b/test/schemaProxy.test.js @@ -203,6 +203,8 @@ describe('Testing Schema Proxy', () => { assert.deepEqual(schemas[2].title, 'Complex References'); assert.equal(schemas[2].properties.refnamed.title, 'Simple'); assert.equal(schemas[2].properties.refrefed.title, 'Simple'); + assert.equal(schemas[2].properties.reflocalfile.title, 'Simple'); + assert.equal(schemas[2].properties.reflocalfiledef.properties.third.properties.baz.title, 'BAAAZ!'); assert.equal(schemas[3].allOf[2].properties.bar.type, 'string');