Skip to content

Commit 6f8bfe5

Browse files
committed
styling updates
1 parent 52c8f64 commit 6f8bfe5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/JsonApiDotNetCore/Controllers/BaseJsonApiController.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ public virtual async Task<IActionResult> PostAsync([FromBody] T entity)
153153

154154
if (!_jsonApiContext.Options.AllowClientGeneratedIds && !string.IsNullOrEmpty(entity.StringId))
155155
return Forbidden();
156-
if (!ModelState.IsValid) return BadRequest(ModelState.ConvertToErrorCollection());
156+
if (!ModelState.IsValid)
157+
return BadRequest(ModelState.ConvertToErrorCollection());
157158

158159
entity = await _create.CreateAsync(entity);
159160

@@ -166,7 +167,8 @@ public virtual async Task<IActionResult> PatchAsync(TId id, [FromBody] T entity)
166167

167168
if (entity == null)
168169
return UnprocessableEntity();
169-
if (!ModelState.IsValid) return BadRequest(ModelState.ConvertToErrorCollection());
170+
if (!ModelState.IsValid)
171+
return BadRequest(ModelState.ConvertToErrorCollection());
170172

171173
var updatedEntity = await _update.UpdateAsync(id, entity);
172174

src/JsonApiDotNetCore/Extensions/ModelStateExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public static ErrorCollection ConvertToErrorCollection(this ModelStateDictionary
1111
ErrorCollection errors = new ErrorCollection();
1212
foreach (var entry in modelState)
1313
{
14-
if (!entry.Value.Errors.Any()) continue;
14+
if (!entry.Value.Errors.Any())
15+
continue;
1516
foreach (var modelError in entry.Value.Errors)
1617
{
1718
errors.Errors.Add(new Error(400, entry.Key, modelError.ErrorMessage, modelError.Exception != null ? ErrorMeta.FromException(modelError.Exception) : null));

0 commit comments

Comments
 (0)