-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from Microsoft/dm/validation
Alternative Validation implementation
- Loading branch information
Showing
36 changed files
with
2,219 additions
and
119 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/Microsoft.OpenApi/Extensions/OpenApiElementExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.OpenApi.Interfaces; | ||
using Microsoft.OpenApi.Models; | ||
using Microsoft.OpenApi.Services; | ||
using Microsoft.OpenApi.Validations; | ||
|
||
namespace Microsoft.OpenApi.Extensions | ||
{ | ||
/// <summary> | ||
/// Extension methods that apply across all OpenAPIElements | ||
/// </summary> | ||
public static class OpenApiElementExtensions | ||
{ | ||
/// <summary> | ||
/// Validate element and all child elements | ||
/// </summary> | ||
/// <typeparam name="T"></typeparam> | ||
/// <param name="element"></param> | ||
/// <returns></returns> | ||
public static IEnumerable<ValidationError> Validate(this IOpenApiElement element) { | ||
var validator = new OpenApiValidator(); | ||
var walker = new OpenApiWalker(validator); | ||
walker.Walk(element); | ||
return validator.Errors; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.