@@ -1807,16 +1807,20 @@ extension JSONSchema: Decodable {
18071807
18081808 if let ref = try ? JSONReference< JSONSchema> ( from: decoder) {
18091809 let coreContext = try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1810- self = . reference( ref, coreContext)
1810+ self = . init ( warnings : coreContext . warnings , schema : . reference( ref, coreContext) )
18111811 return
18121812 }
18131813
18141814 let container = try decoder. container ( keyedBy: SubschemaCodingKeys . self)
18151815
18161816 if container. contains ( . allOf) {
1817- var schema : JSONSchema = . all(
1818- of: try container. decode ( [ JSONSchema ] . self, forKey: . allOf) ,
1819- core: try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1817+ let coreContext = try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1818+ var schema : JSONSchema = . init(
1819+ warnings: coreContext. warnings,
1820+ schema: . all(
1821+ of: try container. decode ( [ JSONSchema ] . self, forKey: . allOf) ,
1822+ core: coreContext
1823+ )
18201824 )
18211825 if schema. subschemas. contains ( where: { $0. nullable } ) {
18221826 schema = schema. nullableSchemaObject ( )
@@ -1827,9 +1831,13 @@ extension JSONSchema: Decodable {
18271831 }
18281832
18291833 if container. contains ( . anyOf) {
1830- var schema : JSONSchema = . any(
1831- of: try container. decode ( [ JSONSchema ] . self, forKey: . anyOf) ,
1832- core: try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1834+ let coreContext = try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1835+ var schema : JSONSchema = . init(
1836+ warnings: coreContext. warnings,
1837+ schema: . any(
1838+ of: try container. decode ( [ JSONSchema ] . self, forKey: . anyOf) ,
1839+ core: coreContext
1840+ )
18331841 )
18341842 if schema. subschemas. contains ( where: { $0. nullable } ) {
18351843 schema = schema. nullableSchemaObject ( )
@@ -1840,9 +1848,12 @@ extension JSONSchema: Decodable {
18401848 }
18411849
18421850 if container. contains ( . oneOf) {
1843- var schema : JSONSchema = . one(
1844- of: try container. decode ( [ JSONSchema ] . self, forKey: . oneOf) ,
1845- core: try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1851+ let coreContext = try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1852+ var schema : JSONSchema = . init( warnings: coreContext. warnings,
1853+ schema: . one(
1854+ of: try container. decode ( [ JSONSchema ] . self, forKey: . oneOf) ,
1855+ core: coreContext
1856+ )
18461857 )
18471858 if schema. subschemas. contains ( where: { $0. nullable } ) {
18481859 schema = schema. nullableSchemaObject ( )
@@ -1853,9 +1864,12 @@ extension JSONSchema: Decodable {
18531864 }
18541865
18551866 if container. contains ( . not) {
1856- let schema : JSONSchema = . not(
1857- try container. decode ( JSONSchema . self, forKey: . not) ,
1858- core: try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1867+ let coreContext = try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1868+ let schema : JSONSchema = . init( warnings: coreContext. warnings,
1869+ schema: . not(
1870+ try container. decode ( JSONSchema . self, forKey: . not) ,
1871+ core: coreContext
1872+ )
18591873 )
18601874
18611875 self = schema
@@ -1915,34 +1929,48 @@ extension JSONSchema: Decodable {
19151929 let value : Schema
19161930 if typeHint == . null {
19171931 let coreContext = try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1932+ _warnings += coreContext. warnings
19181933 value = . null( coreContext)
19191934
19201935 } else if typeHint == . integer || typeHint == . number || ( typeHint == nil && !numericOrIntegerContainer. allKeys. isEmpty) {
19211936 if typeHint == . integer {
1922- value = . integer( try CoreContext < JSONTypeFormat . IntegerFormat > ( from: decoder) ,
1937+ let coreContext = try CoreContext < JSONTypeFormat . IntegerFormat > ( from: decoder)
1938+ _warnings += coreContext. warnings
1939+ value = . integer( coreContext,
19231940 try IntegerContext ( from: decoder) )
19241941 } else {
1925- value = . number( try CoreContext < JSONTypeFormat . NumberFormat > ( from: decoder) ,
1942+ let coreContext = try CoreContext < JSONTypeFormat . NumberFormat > ( from: decoder)
1943+ _warnings += coreContext. warnings
1944+ value = . number( coreContext,
19261945 try NumericContext ( from: decoder) )
19271946 }
19281947
19291948 } else if typeHint == . string || ( typeHint == nil && !stringContainer. allKeys. isEmpty) {
1930- value = . string( try CoreContext < JSONTypeFormat . StringFormat > ( from: decoder) ,
1949+ let coreContext = try CoreContext < JSONTypeFormat . StringFormat > ( from: decoder)
1950+ _warnings += coreContext. warnings
1951+ value = . string( coreContext,
19311952 try StringContext ( from: decoder) )
19321953
19331954 } else if typeHint == . array || ( typeHint == nil && !arrayContainer. allKeys. isEmpty) {
1934- value = . array( try CoreContext < JSONTypeFormat . ArrayFormat > ( from: decoder) ,
1955+ let coreContext = try CoreContext < JSONTypeFormat . ArrayFormat > ( from: decoder)
1956+ _warnings += coreContext. warnings
1957+ value = . array( coreContext,
19351958 try ArrayContext ( from: decoder) )
19361959
19371960 } else if typeHint == . object || ( typeHint == nil && !objectContainer. allKeys. isEmpty) {
1938- value = . object( try CoreContext < JSONTypeFormat . ObjectFormat > ( from: decoder) ,
1961+ let coreContext = try CoreContext < JSONTypeFormat . ObjectFormat > ( from: decoder)
1962+ _warnings += coreContext. warnings
1963+ value = . object( coreContext,
19391964 try ObjectContext ( from: decoder) )
19401965
19411966 } else if typeHint == . boolean {
1942- value = . boolean( try CoreContext < JSONTypeFormat . BooleanFormat > ( from: decoder) )
1967+ let coreContext = try CoreContext < JSONTypeFormat . BooleanFormat > ( from: decoder)
1968+ _warnings += coreContext. warnings
1969+ value = . boolean( coreContext)
19431970
19441971 } else {
19451972 let fragmentContext = try CoreContext < JSONTypeFormat . AnyFormat > ( from: decoder)
1973+ _warnings += fragmentContext. warnings
19461974 if fragmentContext. isEmpty && hintContainerCount > 0 {
19471975 _warnings. append (
19481976 . underlyingError(
0 commit comments