Skip to content

Commit 8408803

Browse files
committed
Unified naming: exclude -> omit
1 parent 428f376 commit 8408803

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/JsonApiDotNetCore/Builders/DocumentBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ private DocumentData GetData(ContextEntity contextEntity, IIdentifiable entity)
129129

130130
private bool ShouldIncludeAttribute(AttrAttribute attr, object attributeValue)
131131
{
132-
return !ExcludeNullValuedAttribute(attr, attributeValue)
132+
return !OmitNullValuedAttribute(attr, attributeValue)
133133
&& ((_jsonApiContext.QuerySet == null
134134
|| _jsonApiContext.QuerySet.Fields.Count == 0)
135135
|| _jsonApiContext.QuerySet.Fields.Contains(attr.InternalAttributeName));
136136
}
137137

138-
private bool ExcludeNullValuedAttribute(AttrAttribute attr, object attributeValue)
138+
private bool OmitNullValuedAttribute(AttrAttribute attr, object attributeValue)
139139
{
140140
return attributeValue == null && _documentBuilderOptions.OmitNullValuedAttributes;
141141
}

test/UnitTests/Builders/DocumentBuilder_Tests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,17 @@ public void Build_Can_Build_CustomIEnumerables()
151151
[InlineData(null,"foo",true)]
152152
[InlineData(false,"foo",true)]
153153
[InlineData(true,"foo",true)]
154-
public void DocumentBuilderOptions(bool? excludeNullValuedAttributes,
154+
public void DocumentBuilderOptions(bool? omitNullValuedAttributes,
155155
string attributeValue,
156156
bool resultContainsAttribute)
157157
{
158158
var documentBuilderBehaviourMock = new Mock<IDocumentBuilderBehavior>();
159-
if (excludeNullValuedAttributes.HasValue)
159+
if (omitNullValuedAttributes.HasValue)
160160
{
161161
documentBuilderBehaviourMock.Setup(m => m.GetDocumentBuilderOptions())
162-
.Returns(new DocumentBuilderOptions(excludeNullValuedAttributes.Value));
162+
.Returns(new DocumentBuilderOptions(omitNullValuedAttributes.Value));
163163
}
164-
var documentBuilder = new DocumentBuilder(_jsonApiContextMock.Object, null, excludeNullValuedAttributes.HasValue ? documentBuilderBehaviourMock.Object : null);
164+
var documentBuilder = new DocumentBuilder(_jsonApiContextMock.Object, null, omitNullValuedAttributes.HasValue ? documentBuilderBehaviourMock.Object : null);
165165
var document = documentBuilder.Build(new Model(){StringProperty = attributeValue});
166166

167167
Assert.Equal(resultContainsAttribute, document.Data.Attributes.ContainsKey("StringProperty"));

0 commit comments

Comments
 (0)