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
3 changes: 3 additions & 0 deletions src/NJsonSchema.Benchmark/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<!-- here to avoid inheriting anything from root -->
</Project>
1 change: 1 addition & 0 deletions src/NJsonSchema.Benchmark/NJsonSchema.Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<SignAssembly>false</SignAssembly>
<Nullable>disable</Nullable>
<EnableNETAnalyzers>false</EnableNETAnalyzers>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
Expand Down
21 changes: 17 additions & 4 deletions src/NJsonSchema/JsonReferenceResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ namespace NJsonSchema
/// <summary>Resolves JSON Pointer references.</summary>
public class JsonReferenceResolver
{
private static readonly List<ContextualAccessorInfo> JsonSchemaContextualAccessors = typeof(JsonSchema).GetContextualAccessors()
.Where(p => !p.IsAttributeDefined<JsonIgnoreAttribute>(inherit: true))
.ToList();

private readonly JsonSchemaAppender _schemaAppender;
private readonly Dictionary<string, IJsonReference> _resolvedObjects = [];

Expand Down Expand Up @@ -312,10 +316,19 @@ private async Task<IJsonReference> ResolveUrlReferenceWithAlreadyResolvedCheckAs
return ResolveDocumentReference(extensionObj.ExtensionData[firstSegment]!, segments.Skip(1).ToList(), targetType, contractResolver, checkedObjects);
}

foreach (var member in obj
.GetType()
.GetContextualAccessors()
.Where(p => !p.IsAttributeDefined<JsonIgnoreAttribute>(true)))
IEnumerable<ContextualAccessorInfo> properties;
if (obj.GetType() == typeof(JsonSchema))
{
properties = JsonSchemaContextualAccessors;
}
else
{
properties = obj.GetType()
.GetContextualAccessors()
.Where(p => !p.IsAttributeDefined<JsonIgnoreAttribute>(inherit: true));
}

foreach (var member in properties)
{
var pathSegment = member.GetName();
if (pathSegment == firstSegment)
Expand Down