Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi.Readers/YamlReaders/MapNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ public string GetScalarValue(ValueNode key)
return scalarNode.Value;
}

public T GetReferencedObject<T>(string refPointer) where T : IReference
public T GetReferencedObject<T>(string refPointer) where T : IOpenApiReference
{
return (T)this.Context.GetReferencedObject(refPointer);
}
public T CreateOrReferenceDomainObject<T>(Func<T> factory) where T: IReference
public T CreateOrReferenceDomainObject<T>(Func<T> factory) where T: IOpenApiReference
{
T domainObject;
var refPointer = GetReferencePointer(); // What should the DOM of a reference look like?
Expand Down
32 changes: 16 additions & 16 deletions src/Microsoft.OpenApi.Readers/YamlReaders/OpenApiV2Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static class OpenApiV2Builder



private static void MakeServers(List<OpenApiServer> servers, ParsingContext context)
private static void MakeServers(IList<OpenApiServer> servers, ParsingContext context)
{
string host = context.GetTempStorage<string>("host");
string basePath = context.GetTempStorage<string>("basePath");
Expand All @@ -47,7 +47,7 @@ private static void MakeServers(List<OpenApiServer> servers, ParsingContext cont
public static PatternFieldMap<OpenApiDocument> OpenApiPatternFields = new PatternFieldMap<OpenApiDocument>
{
// We have no semantics to verify X- nodes, therefore treat them as just values.
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiDocument LoadOpenApi(RootNode rootNode)
Expand Down Expand Up @@ -84,7 +84,7 @@ public static OpenApiDocument LoadOpenApi(RootNode rootNode)

public static PatternFieldMap<OpenApiInfo> InfoPatternFields = new PatternFieldMap<OpenApiInfo>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};


Expand Down Expand Up @@ -115,7 +115,7 @@ public static OpenApiInfo LoadInfo(ParseNode node)

public static PatternFieldMap<OpenApiContact> ContactPatternFields = new PatternFieldMap<OpenApiContact>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiContact LoadContact(ParseNode node)
Expand All @@ -139,7 +139,7 @@ public static OpenApiContact LoadContact(ParseNode node)

public static PatternFieldMap<OpenApiLicense> LicensePatternFields = new PatternFieldMap<OpenApiLicense>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

internal static OpenApiLicense LoadLicense(ParseNode node)
Expand All @@ -164,7 +164,7 @@ internal static OpenApiLicense LoadLicense(ParseNode node)
public static PatternFieldMap<OpenApiPaths> PathsPatternFields = new PatternFieldMap<OpenApiPaths>
{
{ (s)=> s.StartsWith("/"), (o,k,n)=> o.Add(k, OpenApiV2Builder.LoadPathItem(n) ) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiPaths LoadPaths(ParseNode node)
Expand All @@ -190,7 +190,7 @@ public static OpenApiPaths LoadPaths(ParseNode node)

private static PatternFieldMap<OpenApiPathItem> PathItemPatternFields = new PatternFieldMap<OpenApiPathItem>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
{ (s)=> "get,put,post,delete,patch,options,head,patch".Contains(s),
(o,k,n)=> o.AddOperation(OperationTypeExtensions.ParseOperationType(k), OpenApiV2Builder.LoadOperation(n) ) }
};
Expand Down Expand Up @@ -228,7 +228,7 @@ public static OpenApiPathItem LoadPathItem(ParseNode node)

private static PatternFieldMap<OpenApiOperation> OperationPatternFields = new PatternFieldMap<OpenApiOperation>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};

internal static OpenApiOperation LoadOperation(ParseNode node)
Expand Down Expand Up @@ -418,7 +418,7 @@ private static void ProcessIn(OpenApiParameter o, ParseNode n)

private static PatternFieldMap<OpenApiParameter> ParameterPatternFields = new PatternFieldMap<OpenApiParameter>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};


Expand Down Expand Up @@ -465,7 +465,7 @@ public static OpenApiParameter LoadParameter(ParseNode node)

private static PatternFieldMap<OpenApiResponse> ResponsePatternFields = new PatternFieldMap<OpenApiResponse>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};

public static OpenApiResponse LoadResponse(ParseNode node)
Expand Down Expand Up @@ -523,7 +523,7 @@ private static void ProcessProduces(OpenApiResponse response, ParsingContext con

private static PatternFieldMap<OpenApiHeader> HeaderPatternFields = new PatternFieldMap<OpenApiHeader>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenApiString [](start = 75, length = 13)

Is it correct that these are all OpenApiString? I thought Extension can have different types (anything in OpenApiAny)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please refer to issue: #14

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My question is more like: Why is this specifically OpenApiString? Can't it be, for example, OpenApiObject? Should we make a method that converts n.GetScalarValue() to the most appropriate IOpenApiAny type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think OpenApiString is misleading. This is an extension that we do not have a registered extension for it. I created the GenericExtensions as an implementation of the extension interface for when we know nothing more about it. We may internally just treat it as a string, but it's not the same as a string value in the OpenAPI spec.

I am going to be on a plane and in airports for the next 24 hours, so I'm going to try and make some progress on handling extensions while travelling.

Copy link
Contributor Author

@xuzhg xuzhg Oct 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@darrelmiller Yes. I replace it as OpenApiString just because the original implement just accepts an string.

As you and Perth said, we can dig more and figure the right solution, for example, covert the input string as a correct IOpenApiAny. I created an issue to track on it: #26

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xuzhg I agree with Darrel that we should not use OpenApiString as a universal placeholder. It has a different semantics from the existing generic extension type.

I think this is what we should do:

  1. Have an OpenApiGenericExtension (which implements IOpenApiAny) for those extensions we do not know the type of. For now, use this type in all parsing (i.e. replace your OpenApiString in the Builder files by this type).

  2. In a future PR, I think we should try to parse the given extension on the best-effort basis. If the best effort fails, default the type to OpenApiGenericExtension.

Does this sound about right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't agree more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

};


Expand Down Expand Up @@ -555,7 +555,7 @@ public static OpenApiHeader LoadHeader(ParseNode node)

private static PatternFieldMap<OpenApiExample> ExamplePatternFields = new PatternFieldMap<OpenApiExample>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiExample LoadExample(ParseNode node)
Expand Down Expand Up @@ -643,7 +643,7 @@ internal static OpenApiTag LoadTag(ParseNode n)

private static PatternFieldMap<OpenApiSchema> SchemaPatternFields = new PatternFieldMap<OpenApiSchema>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};


Expand Down Expand Up @@ -689,7 +689,7 @@ public static OpenApiSchema LoadSchema(ParseNode node)

private static PatternFieldMap<OpenApiSecurityScheme> SecuritySchemePatternFields = new PatternFieldMap<OpenApiSecurityScheme>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiSecurityScheme LoadSecurityScheme(ParseNode node)
Expand Down Expand Up @@ -790,9 +790,9 @@ private static string GetReferenceTypeName(ReferenceType referenceType)
}


public static IReference LoadReference(OpenApiReference reference, object rootNode)
public static IOpenApiReference LoadReference(OpenApiReference reference, object rootNode)
{
IReference referencedObject = null;
IOpenApiReference referencedObject = null;
ParseNode node = ((RootNode)rootNode).Find(GetPointer(reference));

if (node == null && reference.ReferenceType != ReferenceType.Tags ) return null;
Expand Down
44 changes: 21 additions & 23 deletions src/Microsoft.OpenApi.Readers/YamlReaders/OpenApiV3Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal static class OpenApiV3Builder
public static PatternFieldMap<OpenApiDocument> OpenApiPatternFields = new PatternFieldMap<OpenApiDocument>
{
// We have no semantics to verify X- nodes, therefore treat them as just values.
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiDocument LoadOpenApi(RootNode rootNode)
Expand Down Expand Up @@ -56,10 +56,9 @@ public static OpenApiDocument LoadOpenApi(RootNode rootNode)

public static PatternFieldMap<OpenApiInfo> InfoPatternFields = new PatternFieldMap<OpenApiInfo>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};


public static OpenApiInfo LoadInfo(ParseNode node)
{
var mapNode = node.CheckMapNode("Info");
Expand All @@ -85,7 +84,7 @@ public static OpenApiInfo LoadInfo(ParseNode node)

public static PatternFieldMap<OpenApiContact> ContactPatternFields = new PatternFieldMap<OpenApiContact>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiContact LoadContact(ParseNode node)
Expand All @@ -109,7 +108,7 @@ public static OpenApiContact LoadContact(ParseNode node)

public static PatternFieldMap<OpenApiLicense> LicensePatternFields = new PatternFieldMap<OpenApiLicense>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

internal static OpenApiLicense LoadLicense(ParseNode node)
Expand All @@ -136,7 +135,7 @@ internal static OpenApiLicense LoadLicense(ParseNode node)

private static PatternFieldMap<OpenApiServer> ServerPatternFields = new PatternFieldMap<OpenApiServer>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, n.GetScalarValue()) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiServer LoadServer(ParseNode node)
Expand All @@ -163,7 +162,7 @@ public static OpenApiServer LoadServer(ParseNode node)

private static PatternFieldMap<OpenApiServerVariable> ServerVariablePatternFields = new PatternFieldMap<OpenApiServerVariable>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, n.GetScalarValue()) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiServerVariable LoadServerVariable(ParseNode node)
Expand Down Expand Up @@ -195,7 +194,7 @@ public static OpenApiServerVariable LoadServerVariable(ParseNode node)

public static PatternFieldMap<OpenApiComponents> ComponentsPatternFields = new PatternFieldMap<OpenApiComponents>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiComponents LoadComponents(ParseNode node)
Expand All @@ -219,7 +218,7 @@ public static OpenApiComponents LoadComponents(ParseNode node)
public static PatternFieldMap<OpenApiPaths> PathsPatternFields = new PatternFieldMap<OpenApiPaths>
{
{ (s)=> s.StartsWith("/"), (o,k,n)=> o.Add(k, LoadPathItem(n) ) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiPaths LoadPaths(ParseNode node)
Expand Down Expand Up @@ -248,7 +247,7 @@ public static OpenApiPaths LoadPaths(ParseNode node)

private static PatternFieldMap<OpenApiPathItem> PathItemPatternFields = new PatternFieldMap<OpenApiPathItem>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
{ (s)=> "get,put,post,delete,patch,options,head,patch,trace".Contains(s),
(o,k,n)=> o.AddOperation(OperationTypeExtensions.ParseOperationType(k), LoadOperation(n) ) }
};
Expand Down Expand Up @@ -287,7 +286,7 @@ public static OpenApiPathItem LoadPathItem(ParseNode node)

private static PatternFieldMap<OpenApiOperation> OperationPatternFields = new PatternFieldMap<OpenApiOperation>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};

internal static OpenApiOperation LoadOperation(ParseNode node)
Expand Down Expand Up @@ -350,7 +349,7 @@ public static OpenApiExternalDocs LoadExternalDocs(ParseNode node)

private static PatternFieldMap<OpenApiParameter> ParameterPatternFields = new PatternFieldMap<OpenApiParameter>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};


Expand Down Expand Up @@ -384,7 +383,7 @@ public static OpenApiParameter LoadParameter(ParseNode node)

private static PatternFieldMap<OpenApiRequestBody> RequestBodyPatternFields = new PatternFieldMap<OpenApiRequestBody>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, n.GetScalarValue()) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};

public static OpenApiRequestBody LoadRequestBody(ParseNode node)
Expand Down Expand Up @@ -414,7 +413,7 @@ public static OpenApiRequestBody LoadRequestBody(ParseNode node)

private static PatternFieldMap<OpenApiMediaType> MediaTypePatternFields = new PatternFieldMap<OpenApiMediaType>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, n.GetScalarValue()) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiMediaType LoadMediaType(ParseNode node)
Expand Down Expand Up @@ -453,7 +452,7 @@ public static OpenApiMediaType LoadMediaType(ParseNode node)

private static PatternFieldMap<OpenApiResponse> ResponsePatternFields = new PatternFieldMap<OpenApiResponse>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};

public static OpenApiResponse LoadResponse(ParseNode node)
Expand Down Expand Up @@ -512,10 +511,9 @@ public static OpenApiCallback LoadCallback(ParseNode node)

private static PatternFieldMap<OpenApiLink> LinkPatternFields = new PatternFieldMap<OpenApiLink>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, n.GetScalarValue()) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};


public static OpenApiLink LoadLink(ParseNode node)
{
var mapNode = node.CheckMapNode("link");
Expand Down Expand Up @@ -547,7 +545,7 @@ public static OpenApiLink LoadLink(ParseNode node)

private static PatternFieldMap<OpenApiHeader> HeaderPatternFields = new PatternFieldMap<OpenApiHeader>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) },
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) },
};


Expand Down Expand Up @@ -575,7 +573,7 @@ public static OpenApiHeader LoadHeader(ParseNode node)

private static PatternFieldMap<OpenApiExample> ExamplePatternFields = new PatternFieldMap<OpenApiExample>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiExample LoadExample(ParseNode node)
Expand Down Expand Up @@ -676,7 +674,7 @@ internal static OpenApiTag LoadTag(ParseNode n)

private static PatternFieldMap<OpenApiSchema> SchemaPatternFields = new PatternFieldMap<OpenApiSchema>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiSchema LoadSchema(string schema)
Expand Down Expand Up @@ -727,7 +725,7 @@ public static OpenApiSchema LoadSchema(ParseNode node)

private static PatternFieldMap<OpenApiSecurityScheme> SecuritySchemePatternFields = new PatternFieldMap<OpenApiSecurityScheme>
{
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new GenericOpenApiExtension(n.GetScalarValue())) }
{ (s)=> s.StartsWith("x-"), (o,k,n)=> o.Extensions.Add(k, new OpenApiString(n.GetScalarValue())) }
};

public static OpenApiSecurityScheme LoadSecurityScheme(ParseNode node)
Expand Down Expand Up @@ -764,9 +762,9 @@ public static OpenApiSecurityRequirement LoadSecurityRequirement(ParseNode node)

#endregion

public static IReference LoadReference(OpenApiReference pointer, object rootNode)
public static IOpenApiReference LoadReference(OpenApiReference pointer, object rootNode)
{
IReference referencedObject = null;
IOpenApiReference referencedObject = null;

var node = ((RootNode)rootNode).Find(pointer.GetLocalPointer());
if (node == null && pointer.ReferenceType != ReferenceType.Tags) return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/YamlReaders/ParseNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public virtual Dictionary<string, T> CreateMap<T>(Func<MapNode, T> map)
{
throw new OpenApiException("Cannot create map");
}
public virtual Dictionary<string, T> CreateMapWithReference<T>(string refpointer, Func<MapNode, T> map) where T : class, IReference
public virtual Dictionary<string, T> CreateMapWithReference<T>(string refpointer, Func<MapNode, T> map) where T : class, IOpenApiReference
{
throw new OpenApiException("Cannot create map from reference");
}
Expand Down
Loading