@@ -31,8 +31,7 @@ public MapNode CheckMapNode(string nodeName)
3131 var mapNode = this as MapNode ;
3232 if ( mapNode == null )
3333 {
34- Diagnostic . Errors . Add (
35- new OpenApiError ( "" , $ "{ nodeName } must be a map/object at " + Context . GetLocation ( ) ) ) ;
34+ throw new OpenApiException ( $ "{ nodeName } must be a map/object") ;
3635 }
3736
3837 return mapNode ;
@@ -69,49 +68,51 @@ public static ParseNode Create(ParsingContext context, OpenApiDiagnostic diagnos
6968
7069 public virtual List < T > CreateList < T > ( Func < MapNode , T > map )
7170 {
72- throw new OpenApiException ( "Cannot create list" ) ;
71+ throw new OpenApiException ( "Cannot create list from this type of node. " ) ;
7372 }
7473
7574 public virtual Dictionary < string , T > CreateMap < T > ( Func < MapNode , T > map )
7675 {
77- throw new OpenApiException ( "Cannot create map" ) ;
76+ throw new OpenApiException ( "Cannot create map from this type of node. " ) ;
7877 }
7978
8079 public virtual Dictionary < string , T > CreateMapWithReference < T > (
8180 ReferenceType referenceType ,
8281 Func < MapNode , T > map )
8382 where T : class , IOpenApiReferenceable
8483 {
85- throw new OpenApiException ( "Cannot create map from reference" ) ;
84+ throw new OpenApiException ( "Cannot create map from this reference. " ) ;
8685 }
8786
8887 public virtual List < T > CreateSimpleList < T > ( Func < ValueNode , T > map )
8988 {
90- throw new OpenApiException ( "Cannot create simple list" ) ;
89+ throw new OpenApiException ( "Cannot create simple list from this type of node. " ) ;
9190 }
9291
9392 public virtual Dictionary < string , T > CreateSimpleMap < T > ( Func < ValueNode , T > map )
9493 {
95- throw new OpenApiException ( "Cannot create simple map" ) ;
94+ throw new OpenApiException ( "Cannot create simple map from this type of node. " ) ;
9695 }
9796
98- /// <summary>
99- /// Create a <see cref="IOpenApiAny"/>
100- /// </summary>
101- /// <returns></returns>
10297 public virtual IOpenApiAny CreateAny ( )
10398 {
104- throw new NotSupportedException ( ) ;
99+ throw new OpenApiException ( "Cannot create an Any object this type of node." ) ;
105100 }
106101
107102 public virtual string GetRaw ( )
108103 {
109- throw new OpenApiException ( "Cannot get raw value" ) ;
104+ throw new OpenApiException ( "Cannot get raw value from this type of node. " ) ;
110105 }
111106
112107 public virtual string GetScalarValue ( )
113108 {
114- throw new OpenApiException ( "Cannot get scalar value" ) ;
109+ throw new OpenApiException ( "Cannot create a scalar value from this type of node. " ) ;
115110 }
111+
112+ public virtual List < IOpenApiAny > CreateListOfAny ( )
113+ {
114+ throw new OpenApiException ( "Cannot create a list from this type of node." ) ;
115+ }
116+
116117 }
117118}
0 commit comments