-
Notifications
You must be signed in to change notification settings - Fork 268
Validation for custom extensions #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
7b42b1b
Use rules to validate required properties instead of reader
darrelmiller 4ffe083
Use extension to validate
darrelmiller 2789c0b
Added context to validators and removed required check from reader
darrelmiller fed72e4
Removed remnants of required
darrelmiller 909a0d7
Merge remote-tracking branch 'origin/master' into dm/validation
darrelmiller 7ca70f2
Added support for custom extensions
darrelmiller 60a26b2
Merged validation code
darrelmiller 41b049d
Implemented extension validation
darrelmiller 048518a
Extension validation
darrelmiller a42e62a
Fixes based on PR reviews
darrelmiller 7e1f151
Merge branch 'master' into dm/validatedextensions
darrelmiller e9d2569
Validation fixes based on PR review
darrelmiller 3fd21d2
Merge remote-tracking branch 'origin/master' into dm/validatedextensions
darrelmiller 824e3e2
Merge remote-tracking branch 'origin/master' into dm/validatedextensions
darrelmiller acd1a45
Fixed extension tests
darrelmiller d4597fc
Refactored walker
darrelmiller c19a883
Updated Walker to clean up
darrelmiller 6d7eca5
Merge remote-tracking branch 'origin/master' into dm/validatedextensions
darrelmiller 85ba08c
Walker tests and loop detection
darrelmiller 0d68e70
Added copyright header
darrelmiller 9dba5fd
Changed configuration of Lazy to make it threadsafe
darrelmiller 2e7c33a
Updated visitbility on rules to be consistent
darrelmiller 474944d
Streamlined rule loading code
darrelmiller 576de46
Tried pre-loading the ruleset
darrelmiller 8d44882
Removed use of Lazy
darrelmiller de7e355
temporarily fixed failing test
darrelmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,27 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build", | ||
"type": "shell", | ||
"command": "msbuild", | ||
"args": [ | ||
"/property:GenerateFullPaths=true", | ||
"/t:build" | ||
], | ||
"group": "build", | ||
"presentation": { | ||
"reveal": "silent" | ||
}, | ||
"problemMatcher": "$msCompile" | ||
}, | ||
{ | ||
"label": "workbench", | ||
"type": "shell", | ||
"command": "src/Microsoft.OpenApi.WorkBench/bin/Debug/Microsoft.OpenApi.WorkBench.exe", | ||
"problemMatcher": [] | ||
} | ||
] | ||
} |
This file contains hidden or 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,29 @@ | ||
using Microsoft.OpenApi.Any; | ||
using Microsoft.OpenApi.Interfaces; | ||
using Microsoft.OpenApi.Readers.ParseNodes; | ||
using Microsoft.OpenApi.Validations; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.OpenApi.Readers | ||
{ | ||
/// <summary> | ||
/// Configuration settings to control how OpenAPI documents are parsed | ||
/// </summary> | ||
public class OpenApiReaderSettings | ||
{ | ||
/// <summary> | ||
/// Dictionary of parsers for converting extensions into strongly typed classes | ||
/// </summary> | ||
public Dictionary<string, Func<IOpenApiAny , IOpenApiExtension>> ExtensionParsers { get; set; } = new Dictionary<string, Func<IOpenApiAny, IOpenApiExtension>>(); | ||
|
||
/// <summary> | ||
/// Rules to use for validating OpenAPI specification. If none are provided a default set of rules are applied. | ||
/// </summary> | ||
public ValidationRuleSet RuleSet { get; set; } | ||
|
||
} | ||
} |
This file contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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 contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public? not internal? #WontFix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it needs to be public because it is part of an interface that will be implemented by any custom extension implementation.
In reply to: 161353844 [](ancestors = 161353844)