-
Notifications
You must be signed in to change notification settings - Fork 285
Integrate apis.guru directory of APIs to provide smoke test for library #220
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
11 commits
Select commit
Hold shift + click to select a range
0f1ee46
Added smoke tests
darrelmiller c340f61
Merged with master
darrelmiller f818b95
apis.guru does not throw any exceptions
darrelmiller ae0c646
Fixed issue with schema enum
darrelmiller f040970
Made smoke tests pass even with errors
darrelmiller d05491a
Fixed comment
darrelmiller 092af51
Fixed issue with additionalProperties #196
darrelmiller e7d874f
Merge remote-tracking branch 'origin/master' into dm/smoketests2
darrelmiller 219da17
Cleanup of ListNode
darrelmiller ba31015
Fixed based on code review
darrelmiller 0c7dac5
Merge remote-tracking branch 'origin/master' into dm/smoketests2
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,8 +31,7 @@ public MapNode CheckMapNode(string nodeName) | |
| var mapNode = this as MapNode; | ||
| if (mapNode == null) | ||
| { | ||
| Diagnostic.Errors.Add( | ||
| new OpenApiError("", $"{nodeName} must be a map/object at " + Context.GetLocation())); | ||
| throw new OpenApiException($"{nodeName} must be a map/object"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why change to throw exception? #Resolved
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it caused a cascade of errors as following code attempted to handle the null node. #Resolved |
||
| } | ||
|
|
||
| return mapNode; | ||
|
|
@@ -69,49 +68,51 @@ public static ParseNode Create(ParsingContext context, OpenApiDiagnostic diagnos | |
|
|
||
| public virtual List<T> CreateList<T>(Func<MapNode, T> map) | ||
| { | ||
| throw new OpenApiException("Cannot create list"); | ||
| throw new OpenApiException("Cannot create list from this type of node."); | ||
| } | ||
|
|
||
| public virtual Dictionary<string, T> CreateMap<T>(Func<MapNode, T> map) | ||
| { | ||
| throw new OpenApiException("Cannot create map"); | ||
| throw new OpenApiException("Cannot create map from this type of node."); | ||
| } | ||
|
|
||
| public virtual Dictionary<string, T> CreateMapWithReference<T>( | ||
| ReferenceType referenceType, | ||
| Func<MapNode, T> map) | ||
| where T : class, IOpenApiReferenceable | ||
| { | ||
| throw new OpenApiException("Cannot create map from reference"); | ||
| throw new OpenApiException("Cannot create map from this reference."); | ||
| } | ||
|
|
||
| public virtual List<T> CreateSimpleList<T>(Func<ValueNode, T> map) | ||
| { | ||
| throw new OpenApiException("Cannot create simple list"); | ||
| throw new OpenApiException("Cannot create simple list from this type of node."); | ||
| } | ||
|
|
||
| public virtual Dictionary<string, T> CreateSimpleMap<T>(Func<ValueNode, T> map) | ||
| { | ||
| throw new OpenApiException("Cannot create simple map"); | ||
| throw new OpenApiException("Cannot create simple map from this type of node."); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Create a <see cref="IOpenApiAny"/> | ||
| /// </summary> | ||
| /// <returns></returns> | ||
| public virtual IOpenApiAny CreateAny() | ||
| { | ||
| throw new NotSupportedException(); | ||
| throw new OpenApiException("Cannot create an Any object this type of node."); | ||
| } | ||
|
|
||
| public virtual string GetRaw() | ||
| { | ||
| throw new OpenApiException("Cannot get raw value"); | ||
| throw new OpenApiException("Cannot get raw value from this type of node."); | ||
| } | ||
|
|
||
| public virtual string GetScalarValue() | ||
| { | ||
| throw new OpenApiException("Cannot get scalar value"); | ||
| throw new OpenApiException("Cannot create a scalar value from this type of node."); | ||
| } | ||
|
|
||
| public virtual List<IOpenApiAny> CreateListOfAny() | ||
| { | ||
| throw new OpenApiException("Cannot create a list from this type of node."); | ||
| } | ||
|
|
||
| } | ||
| } | ||
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.
maybe to use the "default: throw ..." is better. #WontFix
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.
This chunk of code is going to change fairly significantly when adding support for resolving external files, so I'll review this in a future PR. #Closed